Normand Briere
2019-07-21 76522bc3ee92bd50dbd946d7f865666be4ad7bac
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,16 +80,28 @@
7480 this.copy = this.group = copy;
7581 //selectees = this.group.selectees;
7682
77
- SetupMenu2(objEditor);
83
+ SetupMenu2(this); //objEditor);
7884 SetupUI2(objEditor);
7985 objEditor.SetupUI(true);
8086 SetupViews(objEditor);
8187
8288 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
89
+
90
+ if (copy.versions == null)
91
+ {
92
+ copy.versions = new byte[100][];
93
+ copy.versionindex = -1;
94
+
95
+ Save(true);
96
+ }
8397 }
8498
8599 void CloneSelection(boolean supports)
86100 {
101
+ if (Globals.REPLACEONMAKE)
102
+ Save();
103
+ boolean keep = Globals.REPLACEONMAKE;
104
+ Globals.REPLACEONMAKE = false;
87105 // Object3D keep = GrafreeD.clipboard;
88106 //Object3D obj;
89107 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +112,19 @@
94112
95113 makeSomething(clone, i==group.selection.size()-1);
96114 }
115
+ Globals.REPLACEONMAKE = keep;
97116 }
98117
99118 void CloneClipboard(boolean supports)
100119 {
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));
120
+ assert(Grafreed.clipboard.parent == null);
121
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
122
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
123
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
124
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106125 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
126
+ makeSomething(CloneObject(Grafreed.clipboard, false));
127
+ Grafreed.clipboard.get(0).parent = keepparent;
109128 }
110129
111130 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +138,7 @@
119138 // obj.support = null;
120139 if (!supports)
121140 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
141
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123142 obj.parent = parent;
124143 // obj.support = support;
125144 // clone.support = support; // aout 2013
....@@ -148,28 +167,21 @@
148167
149168 //JTextField nameField;
150169
151
- void SetupMenu2(ObjEditor oe)
170
+ void SetupMenu2(GroupEditor oe)
152171 {
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
-
172
+ oe.jTree = new cTree();
173
+
168174 Menu menu;
169175 oe.menuBar.add(menu = new Menu("Edit"));
170176 //editItem = menu.add(new MenuItem("Edit"));
171177 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
178
+
179
+// undoItem = menu.add(new MenuItem("Undo"));
180
+// undoItem.addActionListener(this);
181
+// redoItem = menu.add(new MenuItem("Redo"));
182
+// redoItem.addActionListener(this);
183
+// menu.add("-");
184
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173185 duplicateItem.addActionListener(this);
174186 cloneItem = menu.add(new MenuItem("Clone"));
175187 cloneItem.addActionListener(this);
....@@ -185,7 +197,6 @@
185197 copyItem.addActionListener(this);
186198 pasteItem = menu.add(new MenuItem("Paste"));
187199 pasteItem.addActionListener(this);
188
- menu.add("-");
189200
190201 menu.add("-");
191202 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -197,8 +208,8 @@
197208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
198209 // pasteExpandItem.addActionListener(this);
199210 menu.add("-");
200
- clearItem = menu.add(new MenuItem("Clear"));
201
- clearItem.addActionListener(this);
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
202213
203214 if (Globals.ADVANCED)
204215 {
....@@ -206,14 +217,97 @@
206217 clearAllItem = menu.add(new MenuItem("Clear All"));
207218 clearAllItem.addActionListener(this);
208219 }
220
+
221
+ menuBar.add(cameraMenu = new Menu("View"));
222
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
223
+ //zBufferItem.addActionListener(this);
224
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
225
+ //normalLensItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
228
+
229
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
230
+// toggleFullScreenItem.addItemListener(this);
231
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
232
+// cameraMenu.add("-");
233
+//
234
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
235
+// toggleTextureItem.addItemListener(this);
236
+// toggleTextureItem.setState(CameraPane.textureon);
237
+//
238
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
239
+// toggleSwitchItem.addItemListener(this);
240
+// toggleSwitchItem.setState(CameraPane.SWITCH);
241
+
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
243
+ toggleHandleItem.addItemListener(this);
244
+ toggleHandleItem.setState(CameraPane.HANDLES);
245
+
246
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
247
+ togglePaintItem.addItemListener(this);
248
+ togglePaintItem.setState(CameraPane.PAINTMODE);
249
+
250
+ if (Globals.ADVANCED)
251
+ {
252
+ cameraMenu.add("-");
253
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
254
+ toggleLiveItem.addItemListener(this);
255
+ toggleLiveItem.setState(Globals.isLIVE());
209256
257
+ cameraMenu.add(stepItem = new MenuItem("Step"));
258
+ stepItem.addActionListener(this);
259
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
260
+ // toggleDLItem.addItemListener(this);
261
+ // toggleDLItem.setState(false);
262
+
263
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
264
+ toggleRenderItem.addItemListener(this);
265
+ toggleRenderItem.setState(!CameraPane.frozen);
266
+
267
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
268
+ toggleDebugItem.addItemListener(this);
269
+ toggleDebugItem.setState(Globals.DEBUG);
270
+
271
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
272
+ toggleFrustumItem.addItemListener(this);
273
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
274
+
275
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
276
+ toggleFootContactItem.addItemListener(this);
277
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
278
+
279
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
280
+ toggleTimelineItem.addItemListener(this);
281
+ }
282
+
283
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
284
+// toggleRootItem.addItemListener(this);
285
+// toggleRootItem.setState(false);
286
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
287
+// animationItem.addItemListener(this);
288
+// animationItem.setState(CameraPane.ANIMATION);
289
+ cameraMenu.add("-");
290
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
291
+ editCameraItem.addActionListener(this);
292
+
293
+ if (Globals.ADVANCED)
294
+ {
295
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
296
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
298
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
299
+ oe.cameraMenu.add("-");
300
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
301
+ openWindowItem.addActionListener(this);
302
+ editLeafItem.addActionListener(this);
303
+ lookAtItem.addActionListener(this);
304
+ //lookFromItem.addActinoListener(this);
305
+ //switchViewItem.addActionListener(this);
306
+ }
307
+
210308 oe.menuBar.add(menu = new Menu("Setting"));
211309 if (Globals.ADVANCED)
212310 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217311 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218312 revertMeshItem.addActionListener(this);
219313 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -253,21 +347,29 @@
253347 }
254348
255349 oe.menuBar.add(menu = new Menu("Group"));
256
- grabItem = menu.add(new MenuItem("Grab"));
257
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
258352 backItem = menu.add(new MenuItem("Back"));
259353 backItem.addActionListener(this);
260354 frontItem = menu.add(new MenuItem("Front"));
261355 frontItem.addActionListener(this);
262
- compositeItem = menu.add(new MenuItem("Composite"));
263
- compositeItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
264361 hideItem = menu.add(new MenuItem("Hidden Group"));
265362 hideItem.addActionListener(this);
363
+ }
266364 ungroupItem = menu.add(new MenuItem("Ungroup"));
267365 ungroupItem.addActionListener(this);
268
- menu.add("-");
269
- randomItem = menu.add(new MenuItem("Switch node"));
270
- randomItem.addActionListener(this);
366
+
367
+// menu.add("-");
368
+//
369
+// switchItem = menu.add(new MenuItem("Switch node"));
370
+// switchItem.addActionListener(this);
371
+ if (Globals.ADVANCED)
372
+ {
271373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
272374 switchGeoItem.addActionListener(this);
273375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -275,8 +377,6 @@
275377 morphItem = menu.add(new MenuItem("Morph Group"));
276378 morphItem.addActionListener(this);
277379
278
- if (Globals.ADVANCED)
279
- {
280380 menu.add("-");
281381 physicsItem = menu.add(new MenuItem("Physics"));
282382 physicsItem.addActionListener(this);
....@@ -284,30 +384,29 @@
284384 frameselectorItem.addActionListener(this);
285385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
286386 scriptNodeItem.addActionListener(this);
287
- cameraItem = menu.add(new MenuItem("Camera"));
288
- cameraItem.addActionListener(this);
289387 }
290388
291389 oe.menuBar.add(menu = new Menu("Object"));
292
- textureItem = menu.add(new MenuItem("Texture"));
293
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
294392 billboardItem = menu.add(new MenuItem("Billboard"));
295393 billboardItem.addActionListener(this);
296394 csgItem = menu.add(new MenuItem("CSG"));
297395 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
396
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299397 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
398
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301399 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
400
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
304405 if (Globals.ADVANCED)
305406 {
306407 menu.add("-");
307408 linkerItem = menu.add(new MenuItem("Linker"));
308409 linkerItem.addActionListener(this);
309
- attributeItem = menu.add(new MenuItem("Attribute"));
310
- attributeItem.addActionListener(this);
311410 templateItem = menu.add(new MenuItem("Template"));
312411 templateItem.addActionListener(this);
313412 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -318,8 +417,12 @@
318417 resetTransformItem.addActionListener(this);
319418 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
320419 resetCentroidItem.addActionListener(this);
321
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
322
- transformgeometryItem.addActionListener(this);
420
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
421
+ resetCentroidXZItem.addActionListener(this);
422
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
423
+ transformGeometryItem.addActionListener(this);
424
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
425
+ transformChildrenItem.addActionListener(this);
323426
324427 oe.menuBar.add(menu = new Menu("Geometry"));
325428 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -332,7 +435,7 @@
332435 genNormalsMESHItem.addActionListener(this);
333436 if (Globals.ADVANCED)
334437 {
335
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
336439 genNormalsMINEItem.addActionListener(this);
337440 }
338441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -368,6 +471,10 @@
368471 oe.menuBar.add(menu = new Menu("Attributes"));
369472 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
370473 clearMaterialsItem.addActionListener(this);
474
+ resetAllItem = menu.add(new MenuItem("Reset All"));
475
+ resetAllItem.addActionListener(this);
476
+ stepAllItem = menu.add(new MenuItem("Step All"));
477
+ stepAllItem.addActionListener(this);
371478 menu.add("-");
372479 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
373480 liveleavesItem.addActionListener(this);
....@@ -388,6 +495,14 @@
388495 markleavesItem.addActionListener(this);
389496 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
390497 unmarkleavesItem.addActionListener(this);
498
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
499
+ rewindleavesItem.addActionListener(this);
500
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
501
+ unrewindleavesItem.addActionListener(this);
502
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
503
+ randomleavesItem.addActionListener(this);
504
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
505
+ unrandomleavesItem.addActionListener(this);
391506 menu.add("-");
392507 flipVItem = menu.add(new MenuItem("Flip V"));
393508 flipVItem.addActionListener(this);
....@@ -422,41 +537,42 @@
422537 sortbysizeItem.addActionListener(this);
423538 sortbynameItem = menu.add(new MenuItem("Sort by name"));
424539 sortbynameItem.addActionListener(this);
540
+ menu.add("-");
541
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
542
+ shareGeometriesItem.addActionListener(this);
543
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
544
+ mergeGeometriesItem.addActionListener(this);
425545 if (Globals.ADVANCED)
426546 {
427
- menu.add("-");
547
+ // Pretty much the same as duplicate and clone.
428548 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
429549 extractGeometriesItem.addActionListener(this);
430550 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
431551 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);
436552 }
437553
438554 oe.menuBar.add(menu = new Menu("Insert"));
439555 buildCreateMenu(menu);
440556
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
-
454557 oe.menuBar.add(menu = new Menu("Tools"));
455558 buildToolsMenu(menu);
456559 }
457560
561
+
458562 void SetupUI2(ObjEditor oe)
459563 {
564
+ // June 2019
565
+ if (oe == null)
566
+ {
567
+ //super.SetupUI2(this);
568
+ //return;
569
+ }
570
+
571
+ if (copy != group)
572
+ {
573
+ //super.SetupUI2(this);
574
+ }
575
+
460576 //new Exception().printStackTrace();
461577
462578 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -485,97 +601,230 @@
485601 oe.radioPanel.add(dummyButton);
486602 oe.buttonGroup.add(dummyButton);
487603 */
604
+ cGridBag copyOptionsPanel = new cGridBag();
605
+
606
+ copyOptionsPanel.preferredHeight = 1;
607
+
488608 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
489609
490
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
491
- liveCB.setToolTipText("Enabled animation");
610
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ //minButton.setToolTipText("Minimize window");
612
+ //minButton.addActionListener(this);
613
+
614
+ if (Globals.ADVANCED)
615
+ {
616
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617
+ maxButton.setToolTipText("Maximize window");
618
+ maxButton.addActionListener(this);
619
+ }
620
+
621
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
622
+ fullButton.setToolTipText("Full-screen window");
623
+ fullButton.addActionListener(this);
624
+
625
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
+ screenfitButton.setToolTipText("Screen fit");
627
+ screenfitButton.addActionListener(this);
628
+
629
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreCameraButton.setToolTipText("Restore viewpoint");
631
+ restoreCameraButton.addActionListener(this);
632
+
633
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ saveButton.setToolTipText("New version");
635
+ saveButton.addActionListener(this);
636
+
637
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
+ undoButton.setToolTipText("Previous version");
639
+ undoButton.addActionListener(this);
640
+ undoButton.setEnabled(false);
641
+
642
+ cGridBag updown = new cGridBag().setVertical(true);
643
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ restoreButton.setToolTipText("Restore current");
645
+ restoreButton.addActionListener(this);
646
+ restoreButton.setEnabled(false);
647
+
648
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ replaceButton.setToolTipText("Replace current");
650
+ replaceButton.addActionListener(this);
651
+ replaceButton.setEnabled(false);
652
+
653
+ copyOptionsPanel.add(updown);
654
+
655
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ redoButton.setToolTipText("Next version");
657
+ redoButton.addActionListener(this);
658
+ redoButton.setEnabled(false);
659
+
660
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
661
+ liveCB.setToolTipText("Enable animation");
492662 liveCB.addItemListener(this);
493663
494
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
495665 oneStepButton.setToolTipText("Animate one step forward");
496666 oneStepButton.addActionListener(this);
497667
498
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
668
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
499669 fastCB.setToolTipText("Fast mode");
500670 fastCB.addItemListener(this);
501671
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);
672
+ //oe.toolboxPanel.Return();
673
+
674
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
675
+// trackCB.setToolTipText("Enable tracking");
676
+// trackCB.addItemListener(this);
509677
510678 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
511679 // screenfitpointButton.addActionListener(this);
512680
513681 if (Globals.ADVANCED)
514682 {
515
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
683
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
516684 snapobjectButton.addActionListener(this);
517685 snapobjectButton.setToolTipText("Snap Object");
518686 }
519687
520
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
521
- flashSelectionButton.setToolTipText("Show selection");
522
- flashSelectionButton.addActionListener(this);
688
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
523689
524
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
525
-
526
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
527
- twoButton.setToolTipText("Show center view only");
528
- twoButton.addActionListener(this);
529
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
530691 fourButton.addActionListener(this);
531692 fourButton.setToolTipText("Show left panel only");
532
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
533
- sixButton.setToolTipText("2-column layout left");
693
+
694
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ twoButton.setToolTipText("Show right view only");
696
+ twoButton.addActionListener(this);
697
+ this.fullscreenLayout = twoButton;
698
+
699
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ sixButton.setToolTipText("Show left and right");
534701 sixButton.addActionListener(this);
535
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
536
- threeButton.setToolTipText("2-column layout right");
537
- threeButton.addActionListener(this);
538
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
539
- sevenButton.setToolTipText("3-column layout");
540
- sevenButton.addActionListener(this);
702
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+// threeButton.setToolTipText("2-column layout right");
704
+// threeButton.addActionListener(this);
705
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
706
+// sevenButton.setToolTipText("3-column layout");
707
+// sevenButton.addActionListener(this);
541708 //
542709
543
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
544
- rootButton.setToolTipText("Edit selection in new tab");
710
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ rootButton.setToolTipText("Open selection in new tab");
545712 rootButton.addActionListener(this);
546713
547
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
714
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
548715 closeButton.setToolTipText("Close tab");
549716 closeButton.addActionListener(this);
550717 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
551718 //clearButton.addActionListener(this);
552
-
553
- cGridBag commandsPanel = new cGridBag();
719
+
720
+ // INSERT
721
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
722
+ gridButton.setToolTipText("Create grid");
723
+ gridButton.addActionListener(this);
724
+
725
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
726
+ boxButton.setToolTipText("Create box");
727
+ boxButton.addActionListener(this);
728
+
729
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ sphereButton.setToolTipText("Create sphere");
731
+ sphereButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ coneButton.setToolTipText("Create cone");
735
+ coneButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ torusButton.setToolTipText("Create torus");
739
+ torusButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ superButton.setToolTipText("Create superellipsoid");
743
+ superButton.addActionListener(this);
744
+
745
+ if (Globals.ADVANCED)
746
+ {
747
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ kleinButton.setToolTipText("Create Klein bottle");
749
+ kleinButton.addActionListener(this);
750
+ }
554751
555
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
556
- editButton.setToolTipText("Edit selection");
752
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ particlesButton.setToolTipText("Create particle system");
754
+ particlesButton.addActionListener(this);
755
+
756
+ oe.toolboxPanel.Return();
757
+
758
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
759
+ groupButton.setToolTipText("Create group");
760
+ groupButton.addActionListener(this);
761
+
762
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
763
+ compositeButton.setToolTipText("Create composite");
764
+ compositeButton.addActionListener(this);
765
+
766
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
767
+ switchButton.setToolTipText("Create item switcher");
768
+ switchButton.addActionListener(this);
769
+
770
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ loopButton.setToolTipText("Create loop");
772
+ loopButton.addActionListener(this);
773
+
774
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ textureButton.setToolTipText("Create texture");
776
+ textureButton.addActionListener(this);
777
+
778
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
779
+ overlayButton.setToolTipText("Create overlay");
780
+ overlayButton.addActionListener(this);
781
+
782
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
783
+ lightButton.setToolTipText("Create light");
784
+ lightButton.addActionListener(this);
785
+
786
+ for (int i=6; --i>=0;)
787
+ {
788
+ oe.toolboxPanel.Return();
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
+ oe.toolboxPanel.add(new cGridBag());
795
+ oe.toolboxPanel.add(new cGridBag());
796
+ }
797
+
798
+ // EDIT panel
799
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editButton.setToolTipText("Pin selection controls");
557801 editButton.addActionListener(this);
558802
559
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
560
- uneditButton.setToolTipText("Unedit selection");
803
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ uneditButton.setToolTipText("Remove selection controls");
561805 uneditButton.addActionListener(this);
562806
563
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
564
- allParamsButton.setToolTipText("Edit all params");
807
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
808
+ allParamsButton.setToolTipText("Show all controle");
565809 allParamsButton.addActionListener(this);
566810
567
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
811
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
568812 clearPanelButton.setToolTipText("Clear edit panel");
569813 clearPanelButton.addActionListener(this);
570814
571
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
815
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
572816 unselectButton.setToolTipText("Unselect");
573817 unselectButton.addActionListener(this);
574818
575
- commandsPanel.preferredHeight = 1;
819
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
820
+ flashSelectionButton.setToolTipText("Highlight selection");
821
+ flashSelectionButton.addActionListener(this);
576822
577
- oe.treePanel.add(commandsPanel);
578
- oe.treePanel.Return();
823
+ editCommandsPanel.preferredHeight = 1;
824
+
825
+ SetPinStates(false);
826
+// oe.treePanel.add(commandsPanel);
827
+// oe.treePanel.Return();
579828
580829 // oe.aConstraints.gridx += 1;
581830 // oe.aConstraints.weighty = 0;
....@@ -592,29 +841,17 @@
592841
593842 JScrollPane jSP;
594843 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
595
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
844
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
596845 ResetModel();
597846
598847 oe.treePanel.add(jSPPanel);
599848 oe.treePanel.Return();
600849
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;
616850 oe.treePanel.add(copyOptionsPanel);
617851 oe.treePanel.Return();
852
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
853
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
854
+ sliderPane.preferredHeight = 1;
618855
619856 // mainPanel.setDividerLocation(0.5); //1.0);
620857 // mainPanel.setResizeWeight(0.5);
....@@ -637,29 +874,49 @@
637874 dgr.addDragGestureListener(this);
638875 }catch(Exception e) {}
639876 */
640
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
641878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
642879 }
643880
644881 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
645882 {
883
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
884
+ colorCB.setToolTipText("Copy color when dropped");
885
+ colorCB.addItemListener(this);
886
+
887
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
888
+ materialCB.setToolTipText("Copy material when dropped");
889
+ materialCB.addItemListener(this);
890
+
891
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
892
+ textureCB.setToolTipText("Copy texture when dropped");
893
+ textureCB.addItemListener(this);
894
+
895
+ panel.Return();
896
+
646897 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
647898 boxCB.setToolTipText("Display bounding boxes");
648899 boxCB.addItemListener(this);
649900
650901 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
651
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
902
+ zoomBoxCB.setToolTipText("Display only for wheel");
652903 zoomBoxCB.addItemListener(this);
653904
654
- if (Globals.ADVANCED)
905
+ if (true) // Globals.ADVANCED)
655906 {
656
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
657
- supportCB.setToolTipText("Enable rigging");
658
- supportCB.addItemListener(this);
907
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
908
+// supportCB.setToolTipText("Enable rigging");
909
+// supportCB.addItemListener(this);
910
+
911
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
912
+ freezeCB.setToolTipText("Fast moving camera");
913
+ freezeCB.addItemListener(this);
659914
660915 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
661916 // localCB.addItemListener(this);
662917
918
+ panel.Return();
919
+
663920 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
664921 crowdCB.setToolTipText("Used for crowds");
665922 crowdCB.addItemListener(this);
....@@ -676,6 +933,8 @@
676933 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
677934 // speakerMocapCB.addItemListener(this);
678935
936
+ panel.Return();
937
+
679938 if (false)
680939 {
681940 // handled in scripts
....@@ -690,42 +949,85 @@
690949 //constraints.gridy += 1;
691950 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
692951 smoothfocusCB.addItemListener(this);
952
+ panel.Return();
693953 }
694954
695955 //constraints.gridx += 1;
696956 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
697957 // debugCB.addItemListener(this);
698958
959
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
960
+ trackCB.setToolTipText("Enable tracking target");
961
+ trackCB.addItemListener(this);
962
+
699963 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
964
+ oeilCB.setToolTipText("Move camera when tracking");
700965 oeilCB.addItemListener(this);
701966
967
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
968
+ shadowCB.setToolTipText("When live compute shadows");
969
+ shadowCB.addItemListener(this);
970
+
971
+ panel.Return();
972
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
973
+ toggleTextureCB.setToolTipText("Load textures");
974
+ toggleTextureCB.addItemListener(this);
975
+
976
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
977
+ toggleSwitchCB.setToolTipText("Choose a single item");
978
+ toggleSwitchCB.addItemListener(this);
979
+
980
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
981
+ autokeepCB.setToolTipText("On structure change");
982
+ autokeepCB.addItemListener(this);
983
+
984
+ panel.Return();
985
+ if (Globals.ADVANCED)
986
+ {
702987 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
703988 lookAtCB.setToolTipText("Look-at target");
704989 lookAtCB.addItemListener(this);
990
+ }
705991
706992 }
707993
708994 cGridBag fill = new cGridBag();
709
-
710995 fill.preferredHeight = 200;
996
+ cGridBag fill2 = new cGridBag();
997
+ fill2.preferredHeight = 200;
998
+ cGridBag fill3 = new cGridBag();
999
+ fill3.preferredHeight = 200;
7111000
7121001 panel.add(fill);
1002
+ panel.add(fill2);
1003
+ panel.add(fill3);
7131004
7141005 }
7151006
7161007 void EditObject(Object3D obj)
7171008 {
7181009 cRadio radioButton = new cRadio(obj.name);
1010
+
1011
+ // June 2019. Patch to avoid bug with transparency.
1012
+ radioButton.hadMaterial = obj.material != null;
1013
+ if (!radioButton.hadMaterial)
1014
+ {
1015
+ obj.material = new cMaterial();
1016
+ }
1017
+
7191018 radioButton.SetObject(obj);
720
- radioButton.layout = sevenButton;
1019
+ radioButton.layout = sixButton; // sevenButton;
7211020 radioButton.SetCamera(cameraView.renderCamera, false);
7221021 radioButton.addActionListener(this);
7231022 radioPanel.add(radioButton);
7241023 buttonGroup.add(radioButton);
7251024 radioButton.doClick();
7261025 }
1026
+
7271027 void SetupViews(ObjEditor oe)
7281028 {
1029
+ theFrame = this;
1030
+
7291031 oe.SetupViews();
7301032
7311033 System.out.println("SetupViews");
....@@ -734,23 +1036,28 @@
7341036 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7351037 }
7361038
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;
1039
+ cToggleButton liveCB;
1040
+ cCheckBox supportCB;
1041
+ cCheckBox localCB;
1042
+ cCheckBox crowdCB;
1043
+ cCheckBox smoothCB;
1044
+ cToggleButton fastCB;
1045
+ cCheckBox slowCB;
1046
+ cCheckBox boxCB;
1047
+ cCheckBox zoomBoxCB;
1048
+ cCheckBox freezeCB;
1049
+ //cToggleButton trackCB;
1050
+ cCheckBox trackCB;
1051
+ cCheckBox smoothfocusCB;
7481052 // JCheckBox speakerMocapCB;
749
- JCheckBox speakerCameraCB;
750
- JCheckBox speakerFocusCB;
751
- JCheckBox debugCB;
752
- JCheckBox oeilCB;
753
- JCheckBox lookAtCB;
1053
+ cCheckBox speakerCameraCB;
1054
+ cCheckBox speakerFocusCB;
1055
+ cCheckBox debugCB;
1056
+
1057
+ cCheckBox oeilCB;
1058
+ cCheckBox shadowCB;
1059
+ cCheckBox autokeepCB;
1060
+ cCheckBox lookAtCB;
7541061
7551062 // static int COLOR = 1;
7561063 // static int MATERIAL = 2;
....@@ -758,9 +1065,9 @@
7581065
7591066 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7601067
761
- JCheckBox colorCB;
762
- JCheckBox materialCB;
763
- JCheckBox textureCB;
1068
+ cCheckBox colorCB;
1069
+ cCheckBox materialCB;
1070
+ cCheckBox textureCB;
7641071
7651072 public void itemStateChanged(ItemEvent e)
7661073 {
....@@ -788,6 +1095,7 @@
7881095 } else if(e.getSource() == liveCB)
7891096 {
7901097 cameraView.ToggleLive();
1098
+ refreshContents(false);
7911099 }
7921100 else if(e.getSource() == supportCB)
7931101 {
....@@ -852,6 +1160,18 @@
8521160 {
8531161 cameraView.ToggleOeil();
8541162 }
1163
+ else if(e.getSource() == shadowCB)
1164
+ {
1165
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1166
+ }
1167
+ else if(e.getSource() == freezeCB)
1168
+ {
1169
+ Globals.FREEZEONMOVE ^= true;
1170
+ }
1171
+ else if(e.getSource() == autokeepCB)
1172
+ {
1173
+ Globals.REPLACEONMAKE ^= true;
1174
+ }
8551175 else if(e.getSource() == lookAtCB)
8561176 {
8571177 cameraView.ToggleLookAt();
....@@ -868,7 +1188,8 @@
8681188
8691189 /**/
8701190 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
871
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1191
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1192
+ TreePath path = objEditor.jTree.getSelectionPath();
8721193 if ((path == null) || (path.getPathCount() <= 1)) {
8731194 // We can't move the root node or an empty selection
8741195 return;
....@@ -931,8 +1252,6 @@
9311252 }
9321253 }
9331254
934
- String string = (String) object;
935
-
9361255 System.out.println("Transfer = " + object + "; drop : " + target);
9371256 // if( object instanceof java.io.File[])
9381257 // {
....@@ -940,7 +1259,11 @@
9401259 // objEditor.DropFile((java.io.File[]) object, true);
9411260 // return;
9421261 // }
943
- if (string.charAt(0) == '/')
1262
+
1263
+ String string = object.toString();
1264
+
1265
+ // File path for Mac and Windows
1266
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9441267 {
9451268 // file(s)
9461269 String[] names = string.split("\n");
....@@ -967,7 +1290,7 @@
9671290
9681291 flashIt = false;
9691292 CameraPane pane = (CameraPane) target;
970
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1293
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9711294 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9721295
9731296 if (group.selection.size() == 1)
....@@ -983,23 +1306,33 @@
9831306
9841307 assert target == objEditor.jTree;
9851308 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1309
+ Object3D destinationLeaf;
9861310 try {
987
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1311
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9881312 } catch (Exception e) {
9891313 System.out.println("destinationPath : " + destinationPath);
9901314 return;
9911315 }
9921316
993
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1317
+ for (int i=group.selection.size(); --i>=0;)
9941318 {
1319
+ Object3D child = (Object3D)group.selection.elementAt(i);
1320
+
1321
+ // Cannot move into itself
1322
+ if (child == destinationLeaf)
1323
+ return;
1324
+ }
1325
+
1326
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1327
+// {
9951328 loadClipboard(true);
9961329 objEditor.jTree.setSelectionPath(destinationPath);
9971330 pasteInto(false, false);
998
- } else {
999
- loadClipboard(false);
1000
- objEditor.jTree.setSelectionPath(destinationPath);
1001
- pasteInto(false, false); // true); // ???
1002
- }
1331
+// } else {
1332
+// loadClipboard(false);
1333
+// objEditor.jTree.setSelectionPath(destinationPath);
1334
+// pasteInto(false, false); // true); // ???
1335
+// }
10031336 }
10041337 public void dropActionChanged(DropTargetDragEvent dtde)
10051338 // Called if the user has modified the current drop gesture
....@@ -1104,22 +1437,30 @@
11041437 {
11051438 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11061439 //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);
1440
+// gridItem = menu.add(new MenuItem("Grid"));
1441
+// gridItem.addActionListener(this);
1442
+// rectoidItem = menu.add(new MenuItem("Box"));
1443
+// rectoidItem.addActionListener(this);
1444
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1445
+// ellipsoidItem.addActionListener(this);
1446
+// coneItem = menu.add(new MenuItem("Cone"));
1447
+// coneItem.addActionListener(this);
1448
+// torusItem = menu.add(new MenuItem("Torus"));
1449
+// torusItem.addActionListener(this);
1450
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1451
+// superItem.addActionListener(this);
1452
+
1453
+ cameraItem = menu.add(new MenuItem("Camera"));
1454
+ cameraItem.addActionListener(this);
1455
+
1456
+ if (!Globals.ADVANCED)
1457
+ {
11191458 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11201459 kleinItem.addActionListener(this);
1121
- particleItem = menu.add(new MenuItem("Particle system"));
1122
- particleItem.addActionListener(this);
1460
+ }
1461
+
1462
+// particleItem = menu.add(new MenuItem("Particle system"));
1463
+// particleItem.addActionListener(this);
11231464 if (Globals.ADVANCED)
11241465 {
11251466 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1145,15 +1486,15 @@
11451486 }
11461487 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11471488 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);
1489
+// overlayItem = menu.add(new MenuItem("Overlay"));
1490
+// overlayItem.addActionListener(this);
1491
+// lightItem = menu.add(new MenuItem("Light"));
1492
+// lightItem.addActionListener(this);
11521493 menu.add("-");
11531494 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11541495 //superLoopItem.addActionListener(this);
1155
- loopItem = menu.add(new MenuItem("Loop"));
1156
- loopItem.addActionListener(this);
1496
+// loopItem = menu.add(new MenuItem("Loop"));
1497
+// loopItem.addActionListener(this);
11571498 doubleItem = menu.add(new MenuItem("Fork"));
11581499 doubleItem.addActionListener(this);
11591500 if (Globals.ADVANCED)
....@@ -1169,6 +1510,9 @@
11691510 animationItem.addItemListener(this);
11701511 animationItem.setState(Globals.ANIMATION);
11711512
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
1515
+
11721516 menu.add("-");
11731517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11741518 parseverticesItem.addActionListener(this);
....@@ -1181,6 +1525,8 @@
11811525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11821526 reduce34MorphItem.addActionListener(this);
11831527 menu.add("-");
1528
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1529
+ memoryItem.addActionListener(this);
11841530 menu.add(computeAOItem = new MenuItem("Compute AO"));
11851531 computeAOItem.addActionListener(this);
11861532
....@@ -1189,11 +1535,9 @@
11891535 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11901536 mirrorItem.addActionListener(this);
11911537 menu.add("-");
1192
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1193
- memoryItem.addActionListener(this);
11941538 menu.add(analyzeItem = new MenuItem("Analyze"));
11951539 analyzeItem.addActionListener(this);
1196
- menu.add(dumpItem = new MenuItem("Dump"));
1540
+ menu.add(dumpItem = new MenuItem("Print"));
11971541 dumpItem.addActionListener(this);
11981542 // menu.add(pathItem = new MenuItem("From-to path"));
11991543 // pathItem.addActionListener(this);
....@@ -1334,9 +1678,34 @@
13341678 shadow.material = new cMaterial(obj.material);
13351679 shadow.material.diffuse = 0.0001f;
13361680 shadow.material.specular = 0.0001f;
1681
+ //shadow.projectedVertices[1].x = 300;
13371682
13381683 makeSomething(shadow);
13391684 }
1685
+
1686
+ private void ClearUnpinned()
1687
+ {
1688
+ //for (Object3D obj : listUI)
1689
+ for (int i=listUI.size(); --i>=0;)
1690
+ {
1691
+ Object3D obj = listUI.elementAt(i);
1692
+ if (!obj.pinned)
1693
+ {
1694
+ obj.CloseUI();
1695
+ listUI.remove(i);
1696
+ }
1697
+ }
1698
+ }
1699
+
1700
+ private void EditElement(Object3D elem, boolean newWindow)
1701
+ {
1702
+ // if (!(elem instanceof Composite))
1703
+ // newWindow = false;
1704
+ listUI.add(elem);
1705
+ elem.openEditWindow(this, newWindow); //, false);
1706
+ System.out.println("edit : " + elem);
1707
+ elem.editWindow.refreshContents(true); // ? new
1708
+ }
13401709
13411710 /**
13421711 * applyExample
....@@ -1540,9 +1909,9 @@
15401909
15411910 void Overwrite(int mask)
15421911 {
1543
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1912
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15441913 {
1545
- Object3D content = GrafreeD.clipboard.get(0);
1914
+ Object3D content = Grafreed.clipboard.get(0);
15461915
15471916 if (content instanceof cGroup && ((cGroup)content).transientlink )
15481917 content = ((cGroup)content).get(0);
....@@ -1581,7 +1950,7 @@
15811950 {
15821951 ScreenFit();
15831952 } else
1584
- if (source == switchItem)
1953
+ if (source == switchViewItem)
15851954 {
15861955 cVector v1 = new cVector();
15871956 cVector v2 = new cVector();
....@@ -1590,11 +1959,11 @@
15901959 objEditor.cameraView.renderCamera.setAim(v2, v1);
15911960 objEditor.cameraView.repaint();
15921961 } else
1593
- if (source == rectoidItem)
1962
+ if (source == rectoidItem || source == boxButton)
15941963 {
15951964 makeSomething(new Box());
15961965 } else
1597
- if (source == particleItem)
1966
+ if (source == particleItem || source == particlesButton)
15981967 {
15991968 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16001969 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1673,27 +2042,27 @@
16732042
16742043 makeSomething(obj);
16752044 } else
1676
- if (source == gridItem)
2045
+ if (source == gridItem || source == gridButton)
16772046 {
16782047 makeSomething(new Grid());
16792048 } else
1680
- if (source == ellipsoidItem)
2049
+ if (source == ellipsoidItem || source == sphereButton)
16812050 {
16822051 makeSomething(new Sphere());
16832052 } else
1684
- if (source == coneItem)
2053
+ if (source == coneItem || source == coneButton)
16852054 {
16862055 makeSomething(new Cone());
16872056 } else
1688
- if (source == torusItem)
2057
+ if (source == torusItem || source == torusButton)
16892058 {
16902059 makeSomething(new Torus());
16912060 } else
1692
- if (source == superItem)
2061
+ if (source == superItem || source == superButton)
16932062 {
16942063 makeSomething(new Superellipsoid());
16952064 } else
1696
- if (source == kleinItem)
2065
+ if (source == kleinItem || source == kleinButton)
16972066 {
16982067 makeSomething(new Klein());
16992068 } else
....@@ -1713,7 +2082,7 @@
17132082 {
17142083 makeSomething(new BezierSurface());
17152084 } else
1716
- if (source == overlayItem)
2085
+ if (source == overlayItem || source == overlayButton)
17172086 {
17182087 /*
17192088 Object3D obj = new BezierSurface(5,8);
....@@ -1761,7 +2130,7 @@
17612130 s.setup();
17622131 makeSomething(s);
17632132 } else
1764
- if (source == lightItem)
2133
+ if (source == lightItem || source == lightButton)
17652134 {
17662135 makeSomething(new Light());
17672136 } else
....@@ -1811,30 +2180,30 @@
18112180
18122181 group(g);
18132182 } else
1814
- if (source == loopItem)
2183
+ if (source == loopItem || source == loopButton)
18152184 {
18162185 Composite csg = new GroupLeaf();
18172186 csg.count = 5;
18182187 group(csg);
1819
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
18202189 csg.addChild(child);
18212190 child.addChild(csg);
18222191 } else
18232192 if (source == doubleItem)
18242193 {
1825
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
18262195 csg.count = 5;
18272196 group(csg);
1828
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
18292198 csg.addChild(child);
18302199 child.addChild(csg);
1831
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
18322201 csg.addChild(child);
18332202 child.addChild(csg);
18342203 } else
18352204 if (source == tripleItem)
18362205 {
1837
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
18382207 csg.count = 4;
18392208 group(csg);
18402209 Composite child = new cGroup();
....@@ -1846,31 +2215,6 @@
18462215 child = new cGroup();
18472216 csg.addChild(child);
18482217 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
- }
18742218 } else
18752219 if (source == computeAOItem)
18762220 {
....@@ -1890,7 +2234,7 @@
18902234 if (source == invariantsItem)
18912235 {
18922236 System.out.println("Invariants:");
1893
- GrafreeD.grafreeD.universe.invariants();
2237
+ Grafreed.grafreeD.universe.invariants();
18942238 } else
18952239 if (source == memoryItem)
18962240 {
....@@ -1909,6 +2253,46 @@
19092253 {
19102254 DumpObject();
19112255 } else
2256
+ if (source == minButton)
2257
+ {
2258
+ Minimize();
2259
+ } else
2260
+ if (source == maxButton)
2261
+ {
2262
+ Maximize();
2263
+ } else
2264
+ if (source == fullButton)
2265
+ {
2266
+ ToggleFullScreen();
2267
+ } else
2268
+ if (source == undoButton)
2269
+ {
2270
+ // Go to previous version
2271
+ //if (!Undo())
2272
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2273
+ Undo();
2274
+ } else
2275
+ if (source == restoreButton)
2276
+ {
2277
+ // Restore current version
2278
+ Restore();
2279
+ } else
2280
+ if (source == replaceButton)
2281
+ {
2282
+ // Overwrite current version
2283
+ Replace();
2284
+ } else
2285
+ if (source == redoButton)
2286
+ {
2287
+ // Go to next version
2288
+ Redo();
2289
+ } else
2290
+ if (source == saveButton)
2291
+ {
2292
+ // Save a new version
2293
+ if (!Save(true))
2294
+ java.awt.Toolkit.getDefaultToolkit().beep();
2295
+ } else
19122296 if (source == oneStepButton)
19132297 {
19142298 Globals.ONESTEP = true;
....@@ -1916,17 +2300,14 @@
19162300 } else
19172301 if (source == screenfitButton)
19182302 {
1919
- //Reload(lastConverter, lastFilename, true);
19202303 ScreenFit();
19212304 } else
19222305 if (source == screenfitpointButton)
19232306 {
1924
- //Reload(lastConverter, lastFilename, true);
19252307 ScreenFitPoint();
19262308 } else
19272309 if (source == snapobjectButton)
19282310 {
1929
- //Reload(lastConverter, lastFilename, true);
19302311 SnapObject();
19312312 } else
19322313 // if (event.getSource() == recompileButton)
....@@ -1963,12 +2344,20 @@
19632344 {
19642345 loadClipboard(true);
19652346 } else
2347
+ if (source == undoItem)
2348
+ {
2349
+ Undo();
2350
+ } else
2351
+ if (source == redoItem)
2352
+ {
2353
+ Redo();
2354
+ } else
19662355 if (source == duplicateItem)
19672356 {
1968
- Object3D keep = GrafreeD.clipboard;
2357
+ Object3D keep = Grafreed.clipboard;
19692358 loadClipboard(false);
19702359 paste(false);
1971
- GrafreeD.clipboard = keep;
2360
+ Grafreed.clipboard = keep;
19722361 } else
19732362 if (source == cloneItem)
19742363 {
....@@ -2188,9 +2577,9 @@
21882577 // group.selection.get(0).setMasterThis(content); // should be identity
21892578 // refreshContents();
21902579 // }
2191
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2580
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21922581 {
2193
- Object3D content = GrafreeD.clipboard.get(0);
2582
+ Object3D content = Grafreed.clipboard.get(0);
21942583
21952584 if (content instanceof cGroup && ((cGroup)content).transientlink )
21962585 content = ((cGroup)content).get(0);
....@@ -2240,9 +2629,9 @@
22402629 } else
22412630 if (source == setMasterItem)
22422631 {
2243
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2632
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22442633 {
2245
- Object3D content = GrafreeD.clipboard.get(0);
2634
+ Object3D content = Grafreed.clipboard.get(0);
22462635
22472636 if (content instanceof cGroup && ((cGroup)content).transientlink )
22482637 content = ((cGroup)content).get(0);
....@@ -2255,9 +2644,9 @@
22552644 {
22562645 if (group.selection.size() == 1)
22572646 {
2258
- if (GrafreeD.clipboard.size() == 1)
2647
+ if (Grafreed.clipboard.size() == 1)
22592648 {
2260
- Object3D content = GrafreeD.clipboard.get(0);
2649
+ Object3D content = Grafreed.clipboard.get(0);
22612650
22622651 if (content instanceof cGroup && ((cGroup)content).transientlink )
22632652 content = ((cGroup)content).get(0);
....@@ -2274,7 +2663,7 @@
22742663 {
22752664 RevertMeshes();
22762665 } else
2277
- if (source == resetMeshItem)
2666
+ if (source == resetAllItem)
22782667 {
22792668 ResetAll();
22802669 } else
....@@ -2282,7 +2671,7 @@
22822671 {
22832672 StepAll();
22842673 } else
2285
- if (source == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
22862675 {
22872676 //int indices[] = jList.getSelectedIndices();
22882677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2294,9 +2683,9 @@
22942683 {
22952684 ClearSelection(true);
22962685 } else
2297
- if (source == grabItem)
2686
+ if (source == grabItem || source == groupButton)
22982687 {
2299
- group(new cGroup(), true);
2688
+ group(new cGroup(), false); // true);
23002689 } else
23012690 if (source == hideItem)
23022691 {
....@@ -2314,11 +2703,11 @@
23142703 {
23152704 makeSomething(new Camera());
23162705 } else
2317
- if (source == compositeItem)
2706
+ if (source == compositeItem || source == compositeButton)
23182707 {
23192708 group(new Composite());
23202709 } else
2321
- if (source == randomItem)
2710
+ if (source == switchItem || source == switchButton)
23222711 {
23232712 RandomNode random = new RandomNode();
23242713 group(random);
....@@ -2420,7 +2809,7 @@
24202809 {
24212810 group(new cLinker());
24222811 } else
2423
- if (source == textureItem)
2812
+ if (source == textureItem || source == textureButton)
24242813 {
24252814 group(new TextureNode());
24262815 } else
....@@ -2440,17 +2829,30 @@
24402829 {
24412830 CastShadow(2);
24422831 } else
2443
- if (source == ungroupItem)
2832
+ if (source == ungroupItem || source == ungroupButton)
24442833 {
2445
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
24462836 for (int i=0; i<group.selection.size(); i++)
24472837 {
2448
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
24492843 }
24502844
2451
- ClearSelection(false);
2452
-
2453
- refreshContents();
2845
+ if (!hasRoot)
2846
+ {
2847
+ for (int i=0; i<group.selection.size(); i++)
2848
+ {
2849
+ Ungroup(group.selection.get(i));
2850
+ }
2851
+
2852
+ ClearSelection(false);
2853
+
2854
+ refreshContents();
2855
+ }
24542856 } else
24552857 if (source == genUVItem)
24562858 {
....@@ -2462,7 +2864,7 @@
24622864 } else
24632865 if (source == genNormalsMESHItem)
24642866 {
2465
- GenNormals(true); // TODO
2867
+ GenNormalsMESH();
24662868 } else
24672869 if (source == genNormalsORGANItem)
24682870 {
....@@ -2527,6 +2929,22 @@
25272929 if (source == unmarkleavesItem)
25282930 {
25292931 MarkLeaves(false);
2932
+ } else
2933
+ if (source == rewindleavesItem)
2934
+ {
2935
+ RewindLeaves(true);
2936
+ } else
2937
+ if (source == unrewindleavesItem)
2938
+ {
2939
+ RewindLeaves(false);
2940
+ } else
2941
+ if (source == randomleavesItem)
2942
+ {
2943
+ RandomLeaves(true);
2944
+ } else
2945
+ if (source == unrandomleavesItem)
2946
+ {
2947
+ RandomLeaves(false);
25302948 } else
25312949 if (source == flipVItem)
25322950 {
....@@ -2612,9 +3030,13 @@
26123030 {
26133031 SmoothMesh();
26143032 } else
2615
- if (source == transformgeometryItem)
3033
+ if (source == transformGeometryItem)
26163034 {
26173035 TransformGeometry();
3036
+ } else
3037
+ if (source == transformChildrenItem)
3038
+ {
3039
+ TransformChildren();
26183040 } else
26193041 if (source == resetTransformItem)
26203042 {
....@@ -2622,7 +3044,11 @@
26223044 } else
26233045 if (source == resetCentroidItem)
26243046 {
2625
- ResetCentroid();
3047
+ ResetCentroid(true);
3048
+ } else
3049
+ if (source == resetCentroidXZItem)
3050
+ {
3051
+ ResetCentroid(false);
26263052 } else
26273053 if (source == resetParentItem)
26283054 {
....@@ -2754,6 +3180,10 @@
27543180 if (source == twoButton)
27553181 {
27563182 radio.layout = twoButton;
3183
+
3184
+ if (CameraPane.FULLSCREEN)
3185
+ fullscreenLayout = radio.layout;
3186
+
27573187 // bug
27583188 //gridPanel.setDividerLocation(1.0);
27593189 //bigPanel.setDividerLocation(0.0);
....@@ -2786,10 +3216,31 @@
27863216 bigThree.ClearUI();
27873217 bigThree.add(centralPanel);
27883218 bigThree.FlushUI();
3219
+
3220
+ cameraView.requestFocusInWindow();
3221
+
3222
+// refreshContents(true);
3223
+//
3224
+// try
3225
+// {
3226
+// java.awt.Robot bot = new java.awt.Robot();
3227
+// int mask = InputEvent.BUTTON1_MASK;
3228
+// bot.mouseMove(100, 100);
3229
+// bot.mousePress(mask);
3230
+// bot.mouseRelease(mask);
3231
+// }
3232
+// catch (Exception e)
3233
+// {
3234
+//
3235
+// }
3236
+
27893237 } else
27903238 if (source == threeButton)
27913239 {
27923240 radio.layout = threeButton;
3241
+
3242
+ if (CameraPane.FULLSCREEN)
3243
+ fullscreenLayout = radio.layout;
27933244
27943245 // bigThree.remove(scenePanel);
27953246 // bigThree.remove(centralPanel);
....@@ -2822,10 +3273,15 @@
28223273 bigThree.add(centralPanel);
28233274 bigThree.add(XYZPanel);
28243275 bigThree.FlushUI();
3276
+
3277
+ cameraView.requestFocusInWindow();
28253278 } else
28263279 if (source == fourButton)
28273280 {
28283281 radio.layout = fourButton;
3282
+
3283
+ if (CameraPane.FULLSCREEN)
3284
+ fullscreenLayout = radio.layout;
28293285
28303286 // bigThree.remove(scenePanel);
28313287 // bigThree.remove(centralPanel);
....@@ -2857,10 +3313,15 @@
28573313 bigThree.ClearUI();
28583314 bigThree.add(scenePanel);
28593315 bigThree.FlushUI();
3316
+
3317
+ cameraView.requestFocusInWindow();
28603318 } else
28613319 if (source == sixButton)
28623320 {
28633321 radio.layout = sixButton;
3322
+
3323
+ if (CameraPane.FULLSCREEN)
3324
+ fullscreenLayout = radio.layout;
28643325
28653326 // bigThree.remove(scenePanel);
28663327 // bigThree.remove(centralPanel);
....@@ -2893,10 +3354,15 @@
28933354 bigThree.add(scenePanel);
28943355 bigThree.add(centralPanel);
28953356 bigThree.FlushUI();
3357
+
3358
+ cameraView.requestFocusInWindow();
28963359 } else
28973360 if (source == sevenButton)
28983361 {
28993362 radio.layout = sevenButton;
3363
+
3364
+ if (CameraPane.FULLSCREEN)
3365
+ fullscreenLayout = radio.layout;
29003366
29013367 // bigThree.remove(scenePanel);
29023368 // bigThree.remove(centralPanel);
....@@ -2930,6 +3396,8 @@
29303396 bigThree.add(centralPanel);
29313397 bigThree.add(XYZPanel);
29323398 bigThree.FlushUI();
3399
+
3400
+ cameraView.requestFocusInWindow();
29333401 } else
29343402 if (source == rootButton)
29353403 {
....@@ -2941,6 +3409,7 @@
29413409 EditObject(obj);
29423410 }
29433411
3412
+ cameraView.requestFocusInWindow();
29443413 refreshContents(true);
29453414 } else
29463415 if (source == closeButton)
....@@ -2950,22 +3419,37 @@
29503419 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29513420 {
29523421 ab = (cRadio)e.nextElement();
2953
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3422
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29543423 {
3424
+ // Patch to avoid bug with transparency.
3425
+ if (!ab.hadMaterial)
3426
+ {
3427
+ ab.object.material = null;
3428
+ }
3429
+
29553430 buttonGroup.remove(ab);
29563431 radioPanel.remove(ab);
29573432
2958
- ab.GetObject().editWindow = null;
3433
+ //ab.GetObject().editWindow = null;
3434
+ ab.GetObject().manipWindow = null;
29593435 // ab.GetObject().objectUI = null; // ?????????
29603436
29613437 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29623438 break;
29633439 }
29643440 }
3441
+
3442
+ cameraView.requestFocusInWindow();
29653443 refreshContents(true);
29663444 } else
29673445 if (source == editItem || source == editButton)
29683446 {
3447
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3448
+ {
3449
+ Object3D child = (Object3D)e.nextElement();
3450
+ child.pinned = true;
3451
+ }
3452
+
29693453 EditSelection(false);
29703454 } else
29713455 if (source == uneditButton)
....@@ -2975,10 +3459,11 @@
29753459 Object3D child = (Object3D)e.nextElement();
29763460 if(child.editWindow != null)
29773461 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3462
+ child.pinned = false;
29783463 child.CloseUI();
29793464 listUI.remove(child);
29803465
2981
- child.editWindow = null; // ???????????
3466
+ //child.editWindow = null; // ???????????
29823467 }
29833468 objEditor.ctrlPanel.FlushUI();
29843469 //objEditor.jTree.clearSelection();
....@@ -2991,6 +3476,7 @@
29913476 //copy.ClearUI();
29923477 for (Object3D obj : listUI)
29933478 {
3479
+ obj.pinned = false;
29943480 obj.CloseUI();
29953481 }
29963482 listUI.clear();
....@@ -3000,7 +3486,7 @@
30003486 {
30013487 assert(copy == group);
30023488
3003
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3489
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30043490
30053491 for (Object3D obj : listUI)
30063492 {
....@@ -3049,6 +3535,9 @@
30493535 }
30503536
30513537 copy = group;
3538
+
3539
+ SetUndoStates();
3540
+
30523541 //Globals.theRenderer.object = group;
30533542 if(!useclient)
30543543 {
....@@ -3064,20 +3553,46 @@
30643553 frontView.object = group;
30653554 sideView.object = group;
30663555 }
3067
- group.editWindow = this;
3556
+
3557
+// fix "+" issue
3558
+ //group.editWindow = this;
3559
+ group.manipWindow = this;
3560
+
30683561 /*
30693562 currentLayout = radio.layout;
30703563 if (currentLayout == null)
30713564 currentLayout = sevenButton;
30723565 */
30733566 radio.layout.doClick();
3567
+
3568
+ ClearUnpinned();
3569
+ //Grafreed.Assert(group != null);
3570
+ //Grafreed.Assert(group.selection != null);
3571
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3572
+ if (group.selection == null || group.selection.size() == 1)
3573
+ EditSelection(false);
30743574 keepparent = group.parent;
30753575 // PARENT = NULL or not???
30763576 //group.parent = null; // ROOT
30773577 //group.attributes = -1;
30783578 ResetModel();
3579
+
3580
+ cameraView.requestFocusInWindow();
30793581 refreshContents(true);
3080
- }
3582
+ } else if (event.getSource() == editCameraItem)
3583
+ {
3584
+ cameraView.ProtectCamera();
3585
+ cameraView.repaint();
3586
+ return;
3587
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3588
+ {
3589
+ cameraView.RevertCamera();
3590
+ cameraView.repaint();
3591
+ return;
3592
+ // } else if (event.getSource() == textureButton)
3593
+ // {
3594
+ // return; // true;
3595
+ }
30813596 else
30823597 {
30833598 //return super.action(event, arg);
....@@ -3086,7 +3601,6 @@
30863601 }
30873602
30883603 boolean useclient = false;
3089
- cRadio radio;
30903604
30913605 void ToggleRoot()
30923606 {
....@@ -3138,6 +3652,28 @@
31383652 refreshContents();
31393653 }
31403654
3655
+ void TransformChildren()
3656
+ {
3657
+ Object3D obj;
3658
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3659
+ {
3660
+ obj = (Object3D)e.nextElement();
3661
+ obj.KeepTextureMatrices();
3662
+ obj.TransformChildren();
3663
+ obj.RestoreTextureMatrices();
3664
+
3665
+// if (obj.parent == null)
3666
+// {
3667
+// System.out.println("NULL PARENT!");
3668
+// new Exception().printStackTrace();
3669
+// }
3670
+// else
3671
+// TouchTransform(obj);
3672
+// //obj.parent.Touch();
3673
+ }
3674
+
3675
+ refreshContents();
3676
+ }
31413677
31423678 void ResetTransform()
31433679 {
....@@ -3250,7 +3786,7 @@
32503786 refreshContents();
32513787 }
32523788
3253
- void ResetCentroid()
3789
+ void ResetCentroid(boolean full)
32543790 {
32553791 Object3D obj;
32563792 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3265,12 +3801,16 @@
32653801 LA.matIdentity(Object3D.mat);
32663802 obj.getBounds(minima, maxima, false);
32673803 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3268
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3804
+ if (full)
3805
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32693806 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32703807 obj.TransformMesh(Object3D.mat);
3808
+
32713809 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3272
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3810
+ if (full)
3811
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32733812 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3813
+
32743814 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32753815 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32763816 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3299,7 +3839,8 @@
32993839
33003840 int size = obj.MemorySize();
33013841
3302
- System.err.println((size/1024) + " KB is the size of " + obj);
3842
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3843
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33033844 }
33043845 }
33053846 catch (Exception e)
....@@ -3336,9 +3877,9 @@
33363877 obj = (Object3D)e.nextElement();
33373878
33383879 System.out.println("Object is: " + obj);
3339
- GrafreeD.AnalyzeObject(obj);
3880
+ Grafreed.AnalyzeObject(obj);
33403881 System.out.println("Boundary rep: " + obj.bRep);
3341
- GrafreeD.AnalyzeObject(obj.bRep);
3882
+ Grafreed.AnalyzeObject(obj.bRep);
33423883
33433884 // System.err.println((size/1024) + " KB is the size of " + obj);
33443885 }
....@@ -3380,6 +3921,13 @@
33803921 void GenNormals(boolean crease)
33813922 {
33823923 group.GenNormalsS(crease);
3924
+
3925
+ refreshContents();
3926
+ }
3927
+
3928
+ void GenNormalsMESH()
3929
+ {
3930
+ group.GenNormalsMeshS();
33833931
33843932 refreshContents();
33853933 }
....@@ -3552,8 +4100,8 @@
35524100
35534101 void ParseVertices()
35544102 {
3555
- boolean epsequal = GrafreeD.epsequal;
3556
- GrafreeD.epsequal = true;
4103
+ boolean epsequal = Grafreed.epsequal;
4104
+ Grafreed.epsequal = true;
35574105
35584106 for (int i=0; i<group.selection.size(); i++)
35594107 {
....@@ -3578,7 +4126,7 @@
35784126 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35794127 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35804128
3581
- g.add(GrafreeD.clipboard);
4129
+ g.add(Grafreed.clipboard);
35824130
35834131 buffer.add(g);
35844132 }
....@@ -3593,7 +4141,7 @@
35934141 makeSomething(buffer, i==group.selection.size()-1);
35944142 }
35954143
3596
- GrafreeD.epsequal = epsequal;
4144
+ Grafreed.epsequal = epsequal;
35974145
35984146 refreshContents();
35994147 }
....@@ -3611,7 +4159,16 @@
36114159 String pigment = Object3D.GetPigment(tex);
36124160 //String bump = Object3D.GetBump(tex);
36134161
3614
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4162
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4163
+
4164
+ try
4165
+ {
4166
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4167
+ }
4168
+ catch (Exception e)
4169
+ {
4170
+ System.err.println("FAIL: " + node);
4171
+ }
36154172
36164173 double s = v.s;
36174174
....@@ -3743,7 +4300,7 @@
37434300 return;
37444301
37454302 Object3D poses = group.selection.get(0);
3746
- Object3D ref = GrafreeD.clipboard.get(0);
4303
+ Object3D ref = Grafreed.clipboard.get(0);
37474304
37484305 Object3D newgroup = new Object3D("Po:" + poses.name);
37494306
....@@ -3937,9 +4494,9 @@
39374494
39384495 void ClipMesh()
39394496 {
3940
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4497
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39414498 {
3942
- Object3D content = GrafreeD.clipboard.get(0);
4499
+ Object3D content = Grafreed.clipboard.get(0);
39434500
39444501 if (content instanceof cGroup && ((cGroup)content).transientlink )
39454502 content = ((cGroup)content).get(0);
....@@ -3948,7 +4505,7 @@
39484505 // {
39494506 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39504507 // }
3951
- group.selection.ClipMesh(GrafreeD.clipboard);
4508
+ group.selection.ClipMesh(Grafreed.clipboard);
39524509 }
39534510 // group.selection.ClipMesh(GrafreeD.clipboard);
39544511 System.out.println("DONE.");
....@@ -3995,6 +4552,18 @@
39954552 void MarkLeaves(boolean hide)
39964553 {
39974554 group.selection.MarkLeaves(hide);
4555
+ refreshContents();
4556
+ }
4557
+
4558
+ void RewindLeaves(boolean hide)
4559
+ {
4560
+ group.selection.RewindLeaves(hide);
4561
+ refreshContents();
4562
+ }
4563
+
4564
+ void RandomLeaves(boolean hide)
4565
+ {
4566
+ group.selection.RandomLeaves(hide);
39984567 refreshContents();
39994568 }
40004569
....@@ -4069,28 +4638,25 @@
40694638 // }
40704639 // }
40714640
4072
- static boolean allparams = true;
4073
-
4074
- static Vector<Object3D> listUI = new Vector<Object3D>();
4075
-
40764641 void EditSelection(boolean newWindow)
40774642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
40784649 // aConstraints.gridy = 0;
40794650 for (int i=0; i<group.selection.size(); i++)
40804651 {
40814652 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40824653 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4083
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4654
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40844655
40854656 Object3D elem = (Object3D)group.selection.elementAt(i);
4086
- if(elem != group)
4657
+ if(elem != group || !newWindow)
40874658 {
4088
- // if (!(elem instanceof Composite))
4089
- // newWindow = false;
4090
- listUI.add(elem);
4091
- elem.openEditWindow(this, newWindow); //, false);
4092
- System.out.println("edit : " + elem);
4093
- elem.editWindow.refreshContents(true); // ? new
4659
+ EditElement(elem, newWindow); // ? new
40944660 }
40954661 }
40964662 }
....@@ -4165,7 +4731,8 @@
41654731 //new Exception().printStackTrace();
41664732
41674733 freezemodel = true;
4168
-
4734
+ ClearUnpinned();
4735
+
41694736 /**/
41704737 //switch (event.id)
41714738 {
....@@ -4173,7 +4740,6 @@
41734740 //case 702: // Event.LIST_DESELECT
41744741 group.deselectAll();
41754742 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4176
- objEditor.ClearInfo(); // .GetMaterial());
41774743 if (tps != null)
41784744 {
41794745 for (int i=0; i < tps.length; i++)
....@@ -4182,10 +4748,8 @@
41824748
41834749 //if (child.parent != null)
41844750 //child.parent.addSelectee(child);
4751
+ objEditor.SetMaterial(child);
41854752 group.addSelectee(child);
4186
- objEditor.SetMaterial(child); // .GetMaterial());
4187
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4188
- System.err.println("info : " + child.GetPath());
41894753 }
41904754 }
41914755 // else
....@@ -4195,20 +4759,28 @@
41954759 // System.err.println("info : " + group.GetPath());
41964760 // }
41974761
4198
- objEditor.SetText(); // jan 2014
4199
-
4200
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4762
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42014763 CameraPane.flash = true;
42024764
4203
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4765
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42044766 // a camera
42054767 {
4206
- CameraPane.camerachangeframe = 0; // don't refuse it
4207
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4768
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4769
+ {
4770
+ CameraPane.camerachangeframe = 0; // don't refuse it
4771
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4772
+ }
42084773 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42094774 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42104775 }
42114776
4777
+ if (tps != null && tps.length == 1)
4778
+ {
4779
+ EditSelection(false);
4780
+ }
4781
+
4782
+ SetPinStates(tps != null && tps.length > 0);
4783
+
42124784 refreshContents();
42134785 //return true;
42144786 }
....@@ -4217,6 +4789,35 @@
42174789
42184790 freezemodel = false;
42194791 }
4792
+
4793
+ void SetPinStates(boolean enabled)
4794
+ {
4795
+ editButton.setEnabled(enabled);
4796
+ uneditButton.setEnabled(enabled);
4797
+ unselectButton.setEnabled(enabled);
4798
+ flashSelectionButton.setEnabled(enabled);
4799
+ }
4800
+
4801
+ void refreshContents(boolean cp)
4802
+ {
4803
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4804
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4805
+ {
4806
+ objEditor.ClearInfo(); // .GetMaterial());
4807
+
4808
+ for (int i=0; i < group.selection.Size(); i++)
4809
+ {
4810
+ Object3D child = (Object3D) group.selection.get(i);
4811
+
4812
+ objEditor.AddInfo(child, this, true);
4813
+ System.err.println("info : " + child.GetPath());
4814
+ }
4815
+
4816
+ objEditor.SetText(); // jan 2014
4817
+ }
4818
+
4819
+ super.refreshContents(cp);
4820
+ }
42204821
42214822 void linkSomething(Object3D thing)
42224823 {
....@@ -4288,16 +4889,19 @@
42884889 {
42894890 if (group.selection.isEmpty())
42904891 return;
4291
- GrafreeD.clipboardIsTempGroup = false;
4892
+
4893
+ Grafreed.clipboardIsTempGroup = false;
42924894 Composite tGroup = null;
42934895 if (group.selection.size() > 0) // 1)
42944896 {
42954897 tGroup = new cGroup();
4296
- GrafreeD.clipboardIsTempGroup = true;
4898
+ Grafreed.clipboardIsTempGroup = true;
42974899 }
42984900
42994901 if (cut)
43004902 {
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
43014905 //int indices[] = jList.getSelectedIndices();
43024906 //for (int i = indices.length - 1; i >= 0; i--)
43034907 //jList.remove(indices[i]);
....@@ -4333,16 +4937,16 @@
43334937 //System.out.println("cut " + child);
43344938 //System.out.println("parent = " + child.parent);
43354939 // tmp.addChild(child);
4336
- if (GrafreeD.clipboardIsTempGroup)
4940
+ if (Grafreed.clipboardIsTempGroup)
43374941 tGroup.add/*Child*/(tmp);
43384942 else
4339
- GrafreeD.clipboard = tmp;
4943
+ Grafreed.clipboard = tmp;
43404944 }
43414945 else
4342
- if (GrafreeD.clipboardIsTempGroup)
4946
+ if (Grafreed.clipboardIsTempGroup)
43434947 tGroup.add/*Child*/(child);
43444948 else
4345
- GrafreeD.clipboard = child;
4949
+ Grafreed.clipboard = child;
43464950 }
43474951
43484952 //ResetModel();
....@@ -4374,21 +4978,23 @@
43744978 //System.out.println("cut " + elem);
43754979 //System.out.println("parent = " + elem.parent);
43764980 // tmp.addChild(elem);
4377
- if (GrafreeD.clipboardIsTempGroup)
4981
+ if (Grafreed.clipboardIsTempGroup)
43784982 tGroup.add/*Child*/(tmp);
43794983 else
4380
- GrafreeD.clipboard = tmp;
4984
+ Grafreed.clipboard = tmp;
43814985 }
43824986 else
4383
- if (GrafreeD.clipboardIsTempGroup)
4987
+ if (Grafreed.clipboardIsTempGroup)
43844988 tGroup.add/*Child*/(child);
43854989 else
4386
- GrafreeD.clipboard = child;
4990
+ Grafreed.clipboard = child;
43874991 }
43884992
43894993 }
4390
- if (GrafreeD.clipboardIsTempGroup)
4391
- GrafreeD.clipboard = tGroup;
4994
+
4995
+ if (Grafreed.clipboardIsTempGroup)
4996
+ Grafreed.clipboard = tGroup;
4997
+
43924998 if (cut)
43934999 {
43945000 ResetModel();
....@@ -4398,11 +5004,15 @@
43985004
43995005 void paste(boolean expand)
44005006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
44015011 // if (GrafreeD.clipboard == null)
44025012 // return;
44035013 boolean first = true;
44045014
4405
- if (GrafreeD.clipboardIsTempGroup)
5015
+ if (Grafreed.clipboardIsTempGroup)
44065016 {
44075017 Composite temp;
44085018
....@@ -4413,7 +5023,7 @@
44135023 temp = (Composite)Applet3D.clipboard.deepCopy();
44145024 */
44155025 Object3D elem;
4416
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5026
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
44175027 {
44185028 Object3D child = (Object3D)e.nextElement();
44195029
....@@ -4447,16 +5057,17 @@
44475057 //Object3D cb = Applet3D.clipboard;
44485058 //temp.addChild(cb);
44495059 //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());
5060
+ assert(Grafreed.clipboard.parent == null);
5061
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5062
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5063
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5064
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44555065 else
4456
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4457
- GrafreeD.clipboard.get(0).parent = keepparent;
5066
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5067
+ Grafreed.clipboard.get(0).parent = keepparent;
44585068 }
44595069
5070
+ Globals.REPLACEONMAKE = keep;
44605071 ResetModel();
44615072 refreshContents();
44625073 }
....@@ -4503,9 +5114,9 @@
45035114 {
45045115 boolean first = true;
45055116
4506
- if (GrafreeD.clipboardIsTempGroup)
5117
+ if (Grafreed.clipboardIsTempGroup)
45075118 {
4508
- Composite temp = (Composite)GrafreeD.clipboard;
5119
+ Composite temp = (Composite)Grafreed.clipboard;
45095120 Object3D copy;
45105121 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45115122 {
....@@ -4515,7 +5126,7 @@
45155126 }
45165127 } else
45175128 {
4518
- linkSomething(GrafreeD.clipboard); //.get(0));
5129
+ linkSomething(Grafreed.clipboard); //.get(0));
45195130 }
45205131 }
45215132 }
....@@ -4592,6 +5203,10 @@
45925203
45935204 void group(Object3D csg, boolean grab)
45945205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
45955210 if (//false) // why??
45965211 !group.selection.isEmpty())
45975212 {
....@@ -4705,10 +5320,15 @@
47055320 //node.add(csg);
47065321 //makeSomething(node);
47075322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
47085324 }
47095325
47105326 void Ungroup(Object3D g)
47115327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
47125332 if (g instanceof HiddenObject)
47135333 {
47145334 HiddenObject h = (HiddenObject) g;
....@@ -4725,6 +5345,7 @@
47255345 objEditor.makeSomething(g.get(i), false);
47265346 }
47275347 }
5348
+ Globals.REPLACEONMAKE = keep;
47285349 }
47295350
47305351 void ungroup()
....@@ -4920,21 +5541,6 @@
49205541 }
49215542 */
49225543
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
-
49385544 /*
49395545 public void Callback(Object obj)
49405546 {
....@@ -4958,26 +5564,9 @@
49585564 }
49595565 */
49605566
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
-
49785567 String GetFile(String dialogName)
49795568 {
4980
- if (GrafreeD.standAlone)
5569
+ if (Grafreed.standAlone)
49815570 {
49825571 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49835572 browser.show();
....@@ -5045,7 +5634,28 @@
50455634 cButton clearpanelButton;
50465635 cButton unselectButton;
50475636
5637
+ cButton restoreCameraButton;
5638
+
5639
+ cButton saveButton;
50485640 cButton oneStepButton;
5641
+
5642
+ cButton groupButton;
5643
+ cButton ungroupButton;
5644
+ cButton compositeButton;
5645
+ cButton switchButton;
5646
+ cButton loopButton;
5647
+ cButton textureButton;
5648
+
5649
+ cButton gridButton;
5650
+ cButton boxButton;
5651
+ cButton sphereButton;
5652
+ cButton coneButton;
5653
+ cButton torusButton;
5654
+ cButton superButton;
5655
+ cButton kleinButton;
5656
+ cButton particlesButton;
5657
+ cButton overlayButton;
5658
+ cButton lightButton;
50495659
50505660 cButton screenfitButton;
50515661 cButton screenfitpointButton;
....@@ -5058,14 +5668,6 @@
50585668
50595669 cButton setsupportButton;
50605670
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
-
50695671 //
50705672 //Composite
50715673 Object3D // to do !!
....@@ -5075,9 +5677,11 @@
50755677 //JTree jTree;
50765678 private MenuItem lookAtItem;
50775679 private MenuItem lookFromItem;
5078
- private MenuItem switchItem;
5680
+ private MenuItem switchViewItem;
50795681 private MenuItem cutItem;
5080
- private MenuItem duplicateItem;
5682
+ private MenuItem undoItem;
5683
+ private MenuItem redoItem;
5684
+ private JMenuItem duplicateItem;
50815685 private MenuItem cloneItem;
50825686 private MenuItem cloneSupportItem;
50835687 private MenuItem overwriteGeoItem;
....@@ -5090,7 +5694,7 @@
50905694 private MenuItem linkverticesItem;
50915695 private MenuItem relinkverticesItem;
50925696 private MenuItem setMasterItem;
5093
- private MenuItem resetMeshItem;
5697
+ private MenuItem resetAllItem;
50945698 private MenuItem stepAllItem;
50955699 private MenuItem revertMeshItem;
50965700 private MenuItem poseMeshItem;
....@@ -5105,7 +5709,7 @@
51055709 private MenuItem pasteLinkItem;
51065710 private MenuItem pasteCloneItem;
51075711 private MenuItem pasteExpandItem;
5108
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
51095713 private MenuItem clearAllItem;
51105714 private MenuItem genUVItem;
51115715 private MenuItem genNormalsMESHItem;
....@@ -5140,6 +5744,10 @@
51405744 private MenuItem showleavesItem;
51415745 private MenuItem markleavesItem;
51425746 private MenuItem unmarkleavesItem;
5747
+ private MenuItem rewindleavesItem;
5748
+ private MenuItem unrewindleavesItem;
5749
+ private MenuItem randomleavesItem;
5750
+ private MenuItem unrandomleavesItem;
51435751
51445752 private MenuItem flipVItem;
51455753 private MenuItem unflipVItem;
....@@ -5151,15 +5759,17 @@
51515759 private MenuItem panoTexturesItem;
51525760
51535761 private MenuItem resetCentroidItem;
5154
- private MenuItem transformgeometryItem;
5762
+ private MenuItem resetCentroidXZItem;
51555763 private MenuItem resetTransformItem;
5764
+ private MenuItem transformGeometryItem;
5765
+ private MenuItem transformChildrenItem;
51565766 private MenuItem hideItem;
51575767 private MenuItem grabItem;
51585768 private MenuItem backItem;
51595769 private MenuItem frontItem;
51605770 private MenuItem cameraItem;
51615771 private MenuItem compositeItem;
5162
- private MenuItem randomItem;
5772
+ private MenuItem switchItem;
51635773 private MenuItem physicsItem;
51645774 private MenuItem frameselectorItem;
51655775 private MenuItem scriptNodeItem;
....@@ -5221,11 +5831,6 @@
52215831 private MenuItem doubleItem;
52225832 private MenuItem tripleItem;
52235833
5224
- private MenuItem importGFDItem;
5225
- private MenuItem importVRMLX3DItem;
5226
- private MenuItem import3DSItem;
5227
- private MenuItem importOBJItem;
5228
-
52295834 private MenuItem computeAOItem;
52305835 private MenuItem recompileItem;
52315836 private MenuItem editScriptItem;
....@@ -5235,4 +5840,8 @@
52355840 private MenuItem analyzeItem;
52365841 private MenuItem dumpItem;
52375842 //boolean freezemodel = false;
5843
+
5844
+ Menu cameraMenu;
5845
+ MenuItem editCameraItem;
5846
+ MenuItem restoreCameraItem;
52385847 }