Normand Briere
2019-07-18 d7a17c35c443e2cb6c09eaa3cfeaf590a571faa1
GroupEditor.java
....@@ -60,6 +60,12 @@
6060 this.copy = this.group = group;
6161 //selectees = this.group.selectees;
6262
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6369 if(ui)
6470 SetupUI(objEditor);
6571 }
....@@ -74,7 +80,13 @@
7480 this.copy = this.group = copy;
7581 //selectees = this.group.selectees;
7682
77
- SetupMenu2(objEditor);
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
89
+ SetupMenu2(this); //objEditor);
7890 SetupUI2(objEditor);
7991 objEditor.SetupUI(true);
8092 SetupViews(objEditor);
....@@ -84,6 +96,10 @@
8496
8597 void CloneSelection(boolean supports)
8698 {
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
87103 // Object3D keep = GrafreeD.clipboard;
88104 //Object3D obj;
89105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +110,19 @@
94110
95111 makeSomething(clone, i==group.selection.size()-1);
96112 }
113
+ Globals.REPLACEONMAKE = keep;
97114 }
98115
99116 void CloneClipboard(boolean supports)
100117 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
118
+ assert(Grafreed.clipboard.parent == null);
119
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
120
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
121
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
122
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106123 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
124
+ makeSomething(CloneObject(Grafreed.clipboard, false));
125
+ Grafreed.clipboard.get(0).parent = keepparent;
109126 }
110127
111128 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +136,7 @@
119136 // obj.support = null;
120137 if (!supports)
121138 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
139
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123140 obj.parent = parent;
124141 // obj.support = support;
125142 // clone.support = support; // aout 2013
....@@ -148,40 +165,37 @@
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);
184
+ cloneItem = menu.add(new MenuItem("Clone"));
185
+ cloneItem.addActionListener(this);
186
+ if (Globals.ADVANCED)
187
+ {
188
+ cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
189
+ cloneSupportItem.addActionListener(this);
190
+ }
191
+ menu.add("-");
174192 cutItem = menu.add(new MenuItem("Cut"));
175193 cutItem.addActionListener(this);
176194 copyItem = menu.add(new MenuItem("Copy"));
177195 copyItem.addActionListener(this);
178196 pasteItem = menu.add(new MenuItem("Paste"));
179197 pasteItem.addActionListener(this);
180
- menu.add("-");
181
- cloneItem = menu.add(new MenuItem("Clone"));
182
- cloneItem.addActionListener(this);
183
- cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
184
- cloneSupportItem.addActionListener(this);
198
+
185199 menu.add("-");
186200 pasteIntoItem = menu.add(new MenuItem("Paste into"));
187201 pasteIntoItem.addActionListener(this);
....@@ -201,14 +215,97 @@
201215 clearAllItem = menu.add(new MenuItem("Clear All"));
202216 clearAllItem.addActionListener(this);
203217 }
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());
204254
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
+
205306 oe.menuBar.add(menu = new Menu("Setting"));
206307 if (Globals.ADVANCED)
207308 {
208
- resetMeshItem = menu.add(new MenuItem("Reset All"));
209
- resetMeshItem.addActionListener(this);
210
- stepAllItem = menu.add(new MenuItem("Step All"));
211
- stepAllItem.addActionListener(this);
212309 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
213310 revertMeshItem.addActionListener(this);
214311 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -248,21 +345,29 @@
248345 }
249346
250347 oe.menuBar.add(menu = new Menu("Group"));
251
- grabItem = menu.add(new MenuItem("Grab"));
252
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
253350 backItem = menu.add(new MenuItem("Back"));
254351 backItem.addActionListener(this);
255352 frontItem = menu.add(new MenuItem("Front"));
256353 frontItem.addActionListener(this);
257
- compositeItem = menu.add(new MenuItem("Composite"));
258
- compositeItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
259359 hideItem = menu.add(new MenuItem("Hidden Group"));
260360 hideItem.addActionListener(this);
361
+ }
261362 ungroupItem = menu.add(new MenuItem("Ungroup"));
262363 ungroupItem.addActionListener(this);
263
- menu.add("-");
264
- randomItem = menu.add(new MenuItem("Switch node"));
265
- 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
+ {
266371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
267372 switchGeoItem.addActionListener(this);
268373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -270,49 +375,52 @@
270375 morphItem = menu.add(new MenuItem("Morph Group"));
271376 morphItem.addActionListener(this);
272377
273
- if (Globals.ADVANCED)
274
- {
378
+ menu.add("-");
275379 physicsItem = menu.add(new MenuItem("Physics"));
276380 physicsItem.addActionListener(this);
277381 frameselectorItem = menu.add(new MenuItem("Frame Selector"));
278382 frameselectorItem.addActionListener(this);
279383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
280384 scriptNodeItem.addActionListener(this);
281
- cameraItem = menu.add(new MenuItem("Camera"));
282
- cameraItem.addActionListener(this);
283385 }
284386
285387 oe.menuBar.add(menu = new Menu("Object"));
286
- textureItem = menu.add(new MenuItem("Texture"));
287
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
288390 billboardItem = menu.add(new MenuItem("Billboard"));
289391 billboardItem.addActionListener(this);
290392 csgItem = menu.add(new MenuItem("CSG"));
291393 csgItem.addActionListener(this);
292
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
293395 shadowXItem.addActionListener(this);
294
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
295397 shadowYItem.addActionListener(this);
296
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
297399 shadowZItem.addActionListener(this);
298
- if (Globals.ADVANCED)
299
- {
300
- linkerItem = menu.add(new MenuItem("Linker"));
301
- linkerItem.addActionListener(this);
302400 attributeItem = menu.add(new MenuItem("Attribute"));
303401 attributeItem.addActionListener(this);
402
+
403
+ if (Globals.ADVANCED)
404
+ {
405
+ menu.add("-");
406
+ linkerItem = menu.add(new MenuItem("Linker"));
407
+ linkerItem.addActionListener(this);
304408 templateItem = menu.add(new MenuItem("Template"));
305409 templateItem.addActionListener(this);
306410 pointflowItem = menu.add(new MenuItem("Point Flow"));
307411 pointflowItem.addActionListener(this);
308
- menu.add("-");
309412 }
413
+ menu.add("-");
310414 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
311415 resetTransformItem.addActionListener(this);
312416 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
313417 resetCentroidItem.addActionListener(this);
314
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
315
- 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);
316424
317425 oe.menuBar.add(menu = new Menu("Geometry"));
318426 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -361,6 +469,10 @@
361469 oe.menuBar.add(menu = new Menu("Attributes"));
362470 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
363471 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);
364476 menu.add("-");
365477 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
366478 liveleavesItem.addActionListener(this);
....@@ -381,6 +493,14 @@
381493 markleavesItem.addActionListener(this);
382494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
383495 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);
384504 menu.add("-");
385505 flipVItem = menu.add(new MenuItem("Flip V"));
386506 flipVItem.addActionListener(this);
....@@ -415,38 +535,42 @@
415535 sortbysizeItem.addActionListener(this);
416536 sortbynameItem = menu.add(new MenuItem("Sort by name"));
417537 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);
418543 if (Globals.ADVANCED)
419544 {
420
- menu.add("-");
545
+ // Pretty much the same as duplicate and clone.
421546 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
422547 extractGeometriesItem.addActionListener(this);
423548 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
424549 cloneGeometriesItem.addActionListener(this);
425
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
426
- shareGeometriesItem.addActionListener(this);
427
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
428
- mergeGeometriesItem.addActionListener(this);
429550 }
430551
431552 oe.menuBar.add(menu = new Menu("Insert"));
432553 buildCreateMenu(menu);
433554
434
- oe.menuBar.add(menu = new Menu("Include"));
435
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
436
- importGFDItem.addActionListener(this);
437
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
438
- importVRMLX3DItem.addActionListener(this);
439
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
440
- importOBJItem.addActionListener(this);
441
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
442
- import3DSItem.addActionListener(this);
443
-
444555 oe.menuBar.add(menu = new Menu("Tools"));
445556 buildToolsMenu(menu);
446557 }
447558
559
+
448560 void SetupUI2(ObjEditor oe)
449561 {
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
+
450574 //new Exception().printStackTrace();
451575
452576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -475,97 +599,229 @@
475599 oe.radioPanel.add(dummyButton);
476600 oe.buttonGroup.add(dummyButton);
477601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
478606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
479607
480
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
481
- 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");
482660 liveCB.addItemListener(this);
483661
484
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
485663 oneStepButton.setToolTipText("Animate one step forward");
486664 oneStepButton.addActionListener(this);
487665
488
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
489667 fastCB.setToolTipText("Fast mode");
490668 fastCB.addItemListener(this);
491669
492
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
493
- trackCB.setToolTipText("Enable tracking");
494
- trackCB.addItemListener(this);
495
-
496
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
497
- screenfitButton.setToolTipText("Screen fit");
498
- 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);
499675
500676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
501677 // screenfitpointButton.addActionListener(this);
502678
503679 if (Globals.ADVANCED)
504680 {
505
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
681
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
506682 snapobjectButton.addActionListener(this);
507683 snapobjectButton.setToolTipText("Snap Object");
508684 }
509685
510
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
511
- flashSelectionButton.setToolTipText("Show selection");
512
- flashSelectionButton.addActionListener(this);
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
513687
514
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
515
-
516
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
517689 twoButton.setToolTipText("Show center view only");
518690 twoButton.addActionListener(this);
519
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
691
+ this.fullscreenLayout = twoButton;
692
+
693
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
520694 fourButton.addActionListener(this);
521695 fourButton.setToolTipText("Show left panel only");
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
696
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
523697 sixButton.setToolTipText("2-column layout left");
524698 sixButton.addActionListener(this);
525
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526700 threeButton.setToolTipText("2-column layout right");
527701 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
702
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
529703 sevenButton.setToolTipText("3-column layout");
530704 sevenButton.addActionListener(this);
531705 //
532706
533
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
707
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
534708 rootButton.setToolTipText("Edit selection in new tab");
535709 rootButton.addActionListener(this);
536710
537
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
711
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538712 closeButton.setToolTipText("Close tab");
539713 closeButton.addActionListener(this);
540714 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
541715 //clearButton.addActionListener(this);
542
-
543
- cGridBag commandsPanel = new cGridBag();
716
+
717
+ // INSERT
718
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ gridButton.setToolTipText("Create grid");
720
+ gridButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ boxButton.setToolTipText("Create box");
724
+ boxButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ sphereButton.setToolTipText("Create sphere");
728
+ sphereButton.addActionListener(this);
729
+
730
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
731
+ coneButton.setToolTipText("Create cone");
732
+ coneButton.addActionListener(this);
733
+
734
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
735
+ torusButton.setToolTipText("Create torus");
736
+ torusButton.addActionListener(this);
737
+
738
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
739
+ superButton.setToolTipText("Create superellipsoid");
740
+ superButton.addActionListener(this);
741
+
742
+ if (Globals.ADVANCED)
743
+ {
744
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ kleinButton.setToolTipText("Create Klein bottle");
746
+ kleinButton.addActionListener(this);
747
+ }
544748
545
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
546
- editButton.setToolTipText("Edit selection");
749
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ particlesButton.setToolTipText("Create particle system");
751
+ particlesButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.Return();
754
+
755
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ groupButton.setToolTipText("Create group");
757
+ groupButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ compositeButton.setToolTipText("Create composite");
761
+ compositeButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ switchButton.setToolTipText("Create item switcher");
765
+ switchButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ loopButton.setToolTipText("Create loop");
769
+ loopButton.addActionListener(this);
770
+
771
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
772
+ textureButton.setToolTipText("Create texture");
773
+ textureButton.addActionListener(this);
774
+
775
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
776
+ overlayButton.setToolTipText("Create overlay");
777
+ overlayButton.addActionListener(this);
778
+
779
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ lightButton.setToolTipText("Create light");
781
+ lightButton.addActionListener(this);
782
+
783
+ for (int i=6; --i>=0;)
784
+ {
785
+ oe.toolboxPanel.Return();
786
+ oe.toolboxPanel.add(new cGridBag());
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ }
794
+
795
+ // EDIT panel
796
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ editButton.setToolTipText("Pin selection controls");
547798 editButton.addActionListener(this);
548799
549
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
550
- uneditButton.setToolTipText("Unedit selection");
800
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ uneditButton.setToolTipText("Remove selection controls");
551802 uneditButton.addActionListener(this);
552803
553
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
554
- allParamsButton.setToolTipText("Edit all params");
804
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
805
+ allParamsButton.setToolTipText("Show all controle");
555806 allParamsButton.addActionListener(this);
556807
557
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
808
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
558809 clearPanelButton.setToolTipText("Clear edit panel");
559810 clearPanelButton.addActionListener(this);
560811
561
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
812
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
562813 unselectButton.setToolTipText("Unselect");
563814 unselectButton.addActionListener(this);
564815
565
- commandsPanel.preferredHeight = 1;
816
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ flashSelectionButton.setToolTipText("Highlight selection");
818
+ flashSelectionButton.addActionListener(this);
566819
567
- oe.treePanel.add(commandsPanel);
568
- oe.treePanel.Return();
820
+ editCommandsPanel.preferredHeight = 1;
821
+
822
+ SetPinStates(false);
823
+// oe.treePanel.add(commandsPanel);
824
+// oe.treePanel.Return();
569825
570826 // oe.aConstraints.gridx += 1;
571827 // oe.aConstraints.weighty = 0;
....@@ -582,29 +838,17 @@
582838
583839 JScrollPane jSP;
584840 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
585
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
841
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
586842 ResetModel();
587843
588844 oe.treePanel.add(jSPPanel);
589845 oe.treePanel.Return();
590846
591
- cGridBag copyOptionsPanel = new cGridBag();
592
-
593
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
594
- colorCB.setToolTipText("Copy color when dropped");
595
- colorCB.addItemListener(this);
596
-
597
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
598
- materialCB.setToolTipText("Copy material when dropped");
599
- materialCB.addItemListener(this);
600
-
601
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
602
- textureCB.setToolTipText("Copy texture when dropped");
603
- textureCB.addItemListener(this);
604
-
605
- copyOptionsPanel.preferredHeight = 1;
606847 oe.treePanel.add(copyOptionsPanel);
607848 oe.treePanel.Return();
849
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
850
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
851
+ sliderPane.preferredHeight = 1;
608852
609853 // mainPanel.setDividerLocation(0.5); //1.0);
610854 // mainPanel.setResizeWeight(0.5);
....@@ -633,23 +877,43 @@
633877
634878 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
635879 {
880
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
881
+ colorCB.setToolTipText("Copy color when dropped");
882
+ colorCB.addItemListener(this);
883
+
884
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
885
+ materialCB.setToolTipText("Copy material when dropped");
886
+ materialCB.addItemListener(this);
887
+
888
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
889
+ textureCB.setToolTipText("Copy texture when dropped");
890
+ textureCB.addItemListener(this);
891
+
892
+ panel.Return();
893
+
636894 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
637895 boxCB.setToolTipText("Display bounding boxes");
638896 boxCB.addItemListener(this);
639897
640898 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
641
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
899
+ zoomBoxCB.setToolTipText("Display only for wheel");
642900 zoomBoxCB.addItemListener(this);
643901
644
- if (Globals.ADVANCED)
902
+ if (true) // Globals.ADVANCED)
645903 {
646
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
647
- supportCB.setToolTipText("Enable rigging");
648
- supportCB.addItemListener(this);
904
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
905
+// supportCB.setToolTipText("Enable rigging");
906
+// supportCB.addItemListener(this);
907
+
908
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
909
+ freezeCB.setToolTipText("Fast moving camera");
910
+ freezeCB.addItemListener(this);
649911
650912 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
651913 // localCB.addItemListener(this);
652914
915
+ panel.Return();
916
+
653917 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
654918 crowdCB.setToolTipText("Used for crowds");
655919 crowdCB.addItemListener(this);
....@@ -666,6 +930,8 @@
666930 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
667931 // speakerMocapCB.addItemListener(this);
668932
933
+ panel.Return();
934
+
669935 if (false)
670936 {
671937 // handled in scripts
....@@ -680,32 +946,72 @@
680946 //constraints.gridy += 1;
681947 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
682948 smoothfocusCB.addItemListener(this);
949
+ panel.Return();
683950 }
684951
685952 //constraints.gridx += 1;
686953 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
687954 // debugCB.addItemListener(this);
688955
956
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
957
+ trackCB.setToolTipText("Enable tracking target");
958
+ trackCB.addItemListener(this);
959
+
689960 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
961
+ oeilCB.setToolTipText("Move camera when tracking");
690962 oeilCB.addItemListener(this);
691963
964
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
965
+ shadowCB.setToolTipText("When live compute shadows");
966
+ shadowCB.addItemListener(this);
967
+
968
+ panel.Return();
969
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
970
+ toggleTextureCB.setToolTipText("Load textures");
971
+ toggleTextureCB.addItemListener(this);
972
+
973
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
974
+ toggleSwitchCB.setToolTipText("Choose a single item");
975
+ toggleSwitchCB.addItemListener(this);
976
+
977
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
978
+ autokeepCB.setToolTipText("On structure change");
979
+ autokeepCB.addItemListener(this);
980
+
981
+ panel.Return();
982
+ if (Globals.ADVANCED)
983
+ {
692984 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
693985 lookAtCB.setToolTipText("Look-at target");
694986 lookAtCB.addItemListener(this);
987
+ }
695988
696989 }
697990
698991 cGridBag fill = new cGridBag();
699
-
700992 fill.preferredHeight = 200;
993
+ cGridBag fill2 = new cGridBag();
994
+ fill2.preferredHeight = 200;
995
+ cGridBag fill3 = new cGridBag();
996
+ fill3.preferredHeight = 200;
701997
702998 panel.add(fill);
999
+ panel.add(fill2);
1000
+ panel.add(fill3);
7031001
7041002 }
7051003
7061004 void EditObject(Object3D obj)
7071005 {
7081006 cRadio radioButton = new cRadio(obj.name);
1007
+
1008
+ // June 2019. Patch to avoid bug with transparency.
1009
+ radioButton.hadMaterial = obj.material != null;
1010
+ if (!radioButton.hadMaterial)
1011
+ {
1012
+ obj.material = new cMaterial();
1013
+ }
1014
+
7091015 radioButton.SetObject(obj);
7101016 radioButton.layout = sevenButton;
7111017 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -714,8 +1020,11 @@
7141020 buttonGroup.add(radioButton);
7151021 radioButton.doClick();
7161022 }
1023
+
7171024 void SetupViews(ObjEditor oe)
7181025 {
1026
+ theFrame = this;
1027
+
7191028 oe.SetupViews();
7201029
7211030 System.out.println("SetupViews");
....@@ -724,23 +1033,28 @@
7241033 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7251034 }
7261035
727
- JCheckBox liveCB;
728
- JCheckBox supportCB;
729
- JCheckBox localCB;
730
- JCheckBox crowdCB;
731
- JCheckBox smoothCB;
732
- JCheckBox fastCB;
733
- JCheckBox slowCB;
734
- JCheckBox boxCB;
735
- JCheckBox zoomBoxCB;
736
- JCheckBox trackCB;
737
- JCheckBox smoothfocusCB;
1036
+ cToggleButton liveCB;
1037
+ cCheckBox supportCB;
1038
+ cCheckBox localCB;
1039
+ cCheckBox crowdCB;
1040
+ cCheckBox smoothCB;
1041
+ cToggleButton fastCB;
1042
+ cCheckBox slowCB;
1043
+ cCheckBox boxCB;
1044
+ cCheckBox zoomBoxCB;
1045
+ cCheckBox freezeCB;
1046
+ //cToggleButton trackCB;
1047
+ cCheckBox trackCB;
1048
+ cCheckBox smoothfocusCB;
7381049 // JCheckBox speakerMocapCB;
739
- JCheckBox speakerCameraCB;
740
- JCheckBox speakerFocusCB;
741
- JCheckBox debugCB;
742
- JCheckBox oeilCB;
743
- JCheckBox lookAtCB;
1050
+ cCheckBox speakerCameraCB;
1051
+ cCheckBox speakerFocusCB;
1052
+ cCheckBox debugCB;
1053
+
1054
+ cCheckBox oeilCB;
1055
+ cCheckBox shadowCB;
1056
+ cCheckBox autokeepCB;
1057
+ cCheckBox lookAtCB;
7441058
7451059 // static int COLOR = 1;
7461060 // static int MATERIAL = 2;
....@@ -748,9 +1062,9 @@
7481062
7491063 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7501064
751
- JCheckBox colorCB;
752
- JCheckBox materialCB;
753
- JCheckBox textureCB;
1065
+ cCheckBox colorCB;
1066
+ cCheckBox materialCB;
1067
+ cCheckBox textureCB;
7541068
7551069 public void itemStateChanged(ItemEvent e)
7561070 {
....@@ -778,6 +1092,7 @@
7781092 } else if(e.getSource() == liveCB)
7791093 {
7801094 cameraView.ToggleLive();
1095
+ refreshContents(false);
7811096 }
7821097 else if(e.getSource() == supportCB)
7831098 {
....@@ -842,6 +1157,18 @@
8421157 {
8431158 cameraView.ToggleOeil();
8441159 }
1160
+ else if(e.getSource() == shadowCB)
1161
+ {
1162
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1163
+ }
1164
+ else if(e.getSource() == freezeCB)
1165
+ {
1166
+ Globals.FREEZEONMOVE ^= true;
1167
+ }
1168
+ else if(e.getSource() == autokeepCB)
1169
+ {
1170
+ Globals.REPLACEONMAKE ^= true;
1171
+ }
8451172 else if(e.getSource() == lookAtCB)
8461173 {
8471174 cameraView.ToggleLookAt();
....@@ -858,7 +1185,8 @@
8581185
8591186 /**/
8601187 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
861
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1188
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ TreePath path = objEditor.jTree.getSelectionPath();
8621190 if ((path == null) || (path.getPathCount() <= 1)) {
8631191 // We can't move the root node or an empty selection
8641192 return;
....@@ -921,8 +1249,6 @@
9211249 }
9221250 }
9231251
924
- String string = (String) object;
925
-
9261252 System.out.println("Transfer = " + object + "; drop : " + target);
9271253 // if( object instanceof java.io.File[])
9281254 // {
....@@ -930,7 +1256,11 @@
9301256 // objEditor.DropFile((java.io.File[]) object, true);
9311257 // return;
9321258 // }
933
- if (string.charAt(0) == '/')
1259
+
1260
+ String string = object.toString();
1261
+
1262
+ // File path for Mac and Windows
1263
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9341264 {
9351265 // file(s)
9361266 String[] names = string.split("\n");
....@@ -957,7 +1287,7 @@
9571287
9581288 flashIt = false;
9591289 CameraPane pane = (CameraPane) target;
960
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1290
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9611291 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9621292
9631293 if (group.selection.size() == 1)
....@@ -973,23 +1303,33 @@
9731303
9741304 assert target == objEditor.jTree;
9751305 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1306
+ Object3D destinationLeaf;
9761307 try {
977
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1308
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9781309 } catch (Exception e) {
9791310 System.out.println("destinationPath : " + destinationPath);
9801311 return;
9811312 }
9821313
983
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1314
+ for (int i=group.selection.size(); --i>=0;)
9841315 {
1316
+ Object3D child = (Object3D)group.selection.elementAt(i);
1317
+
1318
+ // Cannot move into itself
1319
+ if (child == destinationLeaf)
1320
+ return;
1321
+ }
1322
+
1323
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1324
+// {
9851325 loadClipboard(true);
9861326 objEditor.jTree.setSelectionPath(destinationPath);
9871327 pasteInto(false, false);
988
- } else {
989
- loadClipboard(false);
990
- objEditor.jTree.setSelectionPath(destinationPath);
991
- pasteInto(false, false); // true); // ???
992
- }
1328
+// } else {
1329
+// loadClipboard(false);
1330
+// objEditor.jTree.setSelectionPath(destinationPath);
1331
+// pasteInto(false, false); // true); // ???
1332
+// }
9931333 }
9941334 public void dropActionChanged(DropTargetDragEvent dtde)
9951335 // Called if the user has modified the current drop gesture
....@@ -1094,22 +1434,30 @@
10941434 {
10951435 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10961436 //heightFieldItem.addActionListener(this);
1097
- gridItem = menu.add(new MenuItem("Grid"));
1098
- gridItem.addActionListener(this);
1099
- rectoidItem = menu.add(new MenuItem("Box"));
1100
- rectoidItem.addActionListener(this);
1101
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1102
- ellipsoidItem.addActionListener(this);
1103
- coneItem = menu.add(new MenuItem("Cone"));
1104
- coneItem.addActionListener(this);
1105
- torusItem = menu.add(new MenuItem("Torus"));
1106
- torusItem.addActionListener(this);
1107
- superItem = menu.add(new MenuItem("Superellipsoid"));
1108
- superItem.addActionListener(this);
1437
+// gridItem = menu.add(new MenuItem("Grid"));
1438
+// gridItem.addActionListener(this);
1439
+// rectoidItem = menu.add(new MenuItem("Box"));
1440
+// rectoidItem.addActionListener(this);
1441
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1442
+// ellipsoidItem.addActionListener(this);
1443
+// coneItem = menu.add(new MenuItem("Cone"));
1444
+// coneItem.addActionListener(this);
1445
+// torusItem = menu.add(new MenuItem("Torus"));
1446
+// torusItem.addActionListener(this);
1447
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1448
+// superItem.addActionListener(this);
1449
+
1450
+ cameraItem = menu.add(new MenuItem("Camera"));
1451
+ cameraItem.addActionListener(this);
1452
+
1453
+ if (!Globals.ADVANCED)
1454
+ {
11091455 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11101456 kleinItem.addActionListener(this);
1111
- particleItem = menu.add(new MenuItem("Particle system"));
1112
- particleItem.addActionListener(this);
1457
+ }
1458
+
1459
+// particleItem = menu.add(new MenuItem("Particle system"));
1460
+// particleItem.addActionListener(this);
11131461 if (Globals.ADVANCED)
11141462 {
11151463 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1135,15 +1483,15 @@
11351483 }
11361484 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11371485 bezierItem.addActionListener(this);
1138
- overlayItem = menu.add(new MenuItem("Overlay"));
1139
- overlayItem.addActionListener(this);
1140
- lightItem = menu.add(new MenuItem("Light"));
1141
- lightItem.addActionListener(this);
1486
+// overlayItem = menu.add(new MenuItem("Overlay"));
1487
+// overlayItem.addActionListener(this);
1488
+// lightItem = menu.add(new MenuItem("Light"));
1489
+// lightItem.addActionListener(this);
11421490 menu.add("-");
11431491 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11441492 //superLoopItem.addActionListener(this);
1145
- loopItem = menu.add(new MenuItem("Loop"));
1146
- loopItem.addActionListener(this);
1493
+// loopItem = menu.add(new MenuItem("Loop"));
1494
+// loopItem.addActionListener(this);
11471495 doubleItem = menu.add(new MenuItem("Fork"));
11481496 doubleItem.addActionListener(this);
11491497 if (Globals.ADVANCED)
....@@ -1159,18 +1507,23 @@
11591507 animationItem.addItemListener(this);
11601508 animationItem.setState(Globals.ANIMATION);
11611509
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
1512
+
11621513 menu.add("-");
11631514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11641515 parseverticesItem.addActionListener(this);
11651516 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11661517 textureFieldItem.addActionListener(this);
1167
- alignItem = menu.add(new MenuItem("Align Object"));
1518
+ alignItem = menu.add(new MenuItem("Align Objects"));
11681519 alignItem.addActionListener(this);
11691520 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11701521 reduceMorphItem.addActionListener(this);
11711522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11721523 reduce34MorphItem.addActionListener(this);
1173
-
1524
+ menu.add("-");
1525
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1526
+ memoryItem.addActionListener(this);
11741527 menu.add(computeAOItem = new MenuItem("Compute AO"));
11751528 computeAOItem.addActionListener(this);
11761529
....@@ -1179,11 +1532,9 @@
11791532 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11801533 mirrorItem.addActionListener(this);
11811534 menu.add("-");
1182
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1183
- memoryItem.addActionListener(this);
11841535 menu.add(analyzeItem = new MenuItem("Analyze"));
11851536 analyzeItem.addActionListener(this);
1186
- menu.add(dumpItem = new MenuItem("Dump"));
1537
+ menu.add(dumpItem = new MenuItem("Print"));
11871538 dumpItem.addActionListener(this);
11881539 // menu.add(pathItem = new MenuItem("From-to path"));
11891540 // pathItem.addActionListener(this);
....@@ -1324,9 +1675,24 @@
13241675 shadow.material = new cMaterial(obj.material);
13251676 shadow.material.diffuse = 0.0001f;
13261677 shadow.material.specular = 0.0001f;
1678
+ //shadow.projectedVertices[1].x = 300;
13271679
13281680 makeSomething(shadow);
13291681 }
1682
+
1683
+ private void ClearUnpinned()
1684
+ {
1685
+ //for (Object3D obj : listUI)
1686
+ for (int i=listUI.size(); --i>=0;)
1687
+ {
1688
+ Object3D obj = listUI.elementAt(i);
1689
+ if (!obj.pinned)
1690
+ {
1691
+ obj.CloseUI();
1692
+ listUI.remove(i);
1693
+ }
1694
+ }
1695
+ }
13301696
13311697 /**
13321698 * applyExample
....@@ -1530,9 +1896,9 @@
15301896
15311897 void Overwrite(int mask)
15321898 {
1533
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1899
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15341900 {
1535
- Object3D content = GrafreeD.clipboard.get(0);
1901
+ Object3D content = Grafreed.clipboard.get(0);
15361902
15371903 if (content instanceof cGroup && ((cGroup)content).transientlink )
15381904 content = ((cGroup)content).get(0);
....@@ -1571,7 +1937,7 @@
15711937 {
15721938 ScreenFit();
15731939 } else
1574
- if (source == switchItem)
1940
+ if (source == switchViewItem)
15751941 {
15761942 cVector v1 = new cVector();
15771943 cVector v2 = new cVector();
....@@ -1580,11 +1946,11 @@
15801946 objEditor.cameraView.renderCamera.setAim(v2, v1);
15811947 objEditor.cameraView.repaint();
15821948 } else
1583
- if (source == rectoidItem)
1949
+ if (source == rectoidItem || source == boxButton)
15841950 {
15851951 makeSomething(new Box());
15861952 } else
1587
- if (source == particleItem)
1953
+ if (source == particleItem || source == particlesButton)
15881954 {
15891955 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15901956 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1663,27 +2029,27 @@
16632029
16642030 makeSomething(obj);
16652031 } else
1666
- if (source == gridItem)
2032
+ if (source == gridItem || source == gridButton)
16672033 {
16682034 makeSomething(new Grid());
16692035 } else
1670
- if (source == ellipsoidItem)
2036
+ if (source == ellipsoidItem || source == sphereButton)
16712037 {
16722038 makeSomething(new Sphere());
16732039 } else
1674
- if (source == coneItem)
2040
+ if (source == coneItem || source == coneButton)
16752041 {
16762042 makeSomething(new Cone());
16772043 } else
1678
- if (source == torusItem)
2044
+ if (source == torusItem || source == torusButton)
16792045 {
16802046 makeSomething(new Torus());
16812047 } else
1682
- if (source == superItem)
2048
+ if (source == superItem || source == superButton)
16832049 {
16842050 makeSomething(new Superellipsoid());
16852051 } else
1686
- if (source == kleinItem)
2052
+ if (source == kleinItem || source == kleinButton)
16872053 {
16882054 makeSomething(new Klein());
16892055 } else
....@@ -1703,7 +2069,7 @@
17032069 {
17042070 makeSomething(new BezierSurface());
17052071 } else
1706
- if (source == overlayItem)
2072
+ if (source == overlayItem || source == overlayButton)
17072073 {
17082074 /*
17092075 Object3D obj = new BezierSurface(5,8);
....@@ -1751,7 +2117,7 @@
17512117 s.setup();
17522118 makeSomething(s);
17532119 } else
1754
- if (source == lightItem)
2120
+ if (source == lightItem || source == lightButton)
17552121 {
17562122 makeSomething(new Light());
17572123 } else
....@@ -1801,30 +2167,30 @@
18012167
18022168 group(g);
18032169 } else
1804
- if (source == loopItem)
2170
+ if (source == loopItem || source == loopButton)
18052171 {
18062172 Composite csg = new GroupLeaf();
18072173 csg.count = 5;
18082174 group(csg);
1809
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
18102176 csg.addChild(child);
18112177 child.addChild(csg);
18122178 } else
18132179 if (source == doubleItem)
18142180 {
1815
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
18162182 csg.count = 5;
18172183 group(csg);
1818
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
18192185 csg.addChild(child);
18202186 child.addChild(csg);
1821
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
18222188 csg.addChild(child);
18232189 child.addChild(csg);
18242190 } else
18252191 if (source == tripleItem)
18262192 {
1827
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
18282194 csg.count = 4;
18292195 group(csg);
18302196 Composite child = new cGroup();
....@@ -1836,23 +2202,6 @@
18362202 child = new cGroup();
18372203 csg.addChild(child);
18382204 child.addChild(csg);
1839
- } else
1840
-
1841
- if (source == importGFDItem)
1842
- {
1843
- ImportGFD();
1844
- } else
1845
- if (source == importVRMLX3DItem)
1846
- {
1847
- ImportVRMLX3D();
1848
- } else
1849
- if (source == import3DSItem)
1850
- {
1851
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1852
- } else
1853
- if (source == importOBJItem)
1854
- {
1855
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
18562205 } else
18572206 if (source == computeAOItem)
18582207 {
....@@ -1872,7 +2221,7 @@
18722221 if (source == invariantsItem)
18732222 {
18742223 System.out.println("Invariants:");
1875
- GrafreeD.grafreeD.universe.invariants();
2224
+ Grafreed.grafreeD.universe.invariants();
18762225 } else
18772226 if (source == memoryItem)
18782227 {
....@@ -1891,6 +2240,46 @@
18912240 {
18922241 DumpObject();
18932242 } else
2243
+ if (source == minButton)
2244
+ {
2245
+ Minimize();
2246
+ } else
2247
+ if (source == maxButton)
2248
+ {
2249
+ Maximize();
2250
+ } else
2251
+ if (source == fullButton)
2252
+ {
2253
+ ToggleFullScreen();
2254
+ } else
2255
+ if (source == undoButton)
2256
+ {
2257
+ // Go to previous version
2258
+ //if (!Undo())
2259
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2260
+ Undo();
2261
+ } else
2262
+ if (source == restoreButton)
2263
+ {
2264
+ // Restore current version
2265
+ Restore();
2266
+ } else
2267
+ if (source == replaceButton)
2268
+ {
2269
+ // Overwrite current version
2270
+ Replace();
2271
+ } else
2272
+ if (source == redoButton)
2273
+ {
2274
+ // Go to next version
2275
+ Redo();
2276
+ } else
2277
+ if (source == saveButton)
2278
+ {
2279
+ // Save a new version
2280
+ if (!Save(true))
2281
+ java.awt.Toolkit.getDefaultToolkit().beep();
2282
+ } else
18942283 if (source == oneStepButton)
18952284 {
18962285 Globals.ONESTEP = true;
....@@ -1898,17 +2287,14 @@
18982287 } else
18992288 if (source == screenfitButton)
19002289 {
1901
- //Reload(lastConverter, lastFilename, true);
19022290 ScreenFit();
19032291 } else
19042292 if (source == screenfitpointButton)
19052293 {
1906
- //Reload(lastConverter, lastFilename, true);
19072294 ScreenFitPoint();
19082295 } else
19092296 if (source == snapobjectButton)
19102297 {
1911
- //Reload(lastConverter, lastFilename, true);
19122298 SnapObject();
19132299 } else
19142300 // if (event.getSource() == recompileButton)
....@@ -1945,12 +2331,20 @@
19452331 {
19462332 loadClipboard(true);
19472333 } else
2334
+ if (source == undoItem)
2335
+ {
2336
+ Undo();
2337
+ } else
2338
+ if (source == redoItem)
2339
+ {
2340
+ Redo();
2341
+ } else
19482342 if (source == duplicateItem)
19492343 {
1950
- Object3D keep = GrafreeD.clipboard;
2344
+ Object3D keep = Grafreed.clipboard;
19512345 loadClipboard(false);
19522346 paste(false);
1953
- GrafreeD.clipboard = keep;
2347
+ Grafreed.clipboard = keep;
19542348 } else
19552349 if (source == cloneItem)
19562350 {
....@@ -2170,9 +2564,9 @@
21702564 // group.selection.get(0).setMasterThis(content); // should be identity
21712565 // refreshContents();
21722566 // }
2173
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2567
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21742568 {
2175
- Object3D content = GrafreeD.clipboard.get(0);
2569
+ Object3D content = Grafreed.clipboard.get(0);
21762570
21772571 if (content instanceof cGroup && ((cGroup)content).transientlink )
21782572 content = ((cGroup)content).get(0);
....@@ -2222,9 +2616,9 @@
22222616 } else
22232617 if (source == setMasterItem)
22242618 {
2225
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2619
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22262620 {
2227
- Object3D content = GrafreeD.clipboard.get(0);
2621
+ Object3D content = Grafreed.clipboard.get(0);
22282622
22292623 if (content instanceof cGroup && ((cGroup)content).transientlink )
22302624 content = ((cGroup)content).get(0);
....@@ -2237,9 +2631,9 @@
22372631 {
22382632 if (group.selection.size() == 1)
22392633 {
2240
- if (GrafreeD.clipboard.size() == 1)
2634
+ if (Grafreed.clipboard.size() == 1)
22412635 {
2242
- Object3D content = GrafreeD.clipboard.get(0);
2636
+ Object3D content = Grafreed.clipboard.get(0);
22432637
22442638 if (content instanceof cGroup && ((cGroup)content).transientlink )
22452639 content = ((cGroup)content).get(0);
....@@ -2256,7 +2650,7 @@
22562650 {
22572651 RevertMeshes();
22582652 } else
2259
- if (source == resetMeshItem)
2653
+ if (source == resetAllItem)
22602654 {
22612655 ResetAll();
22622656 } else
....@@ -2276,9 +2670,9 @@
22762670 {
22772671 ClearSelection(true);
22782672 } else
2279
- if (source == grabItem)
2673
+ if (source == grabItem || source == groupButton)
22802674 {
2281
- group(new cGroup(), true);
2675
+ group(new cGroup(), false); // true);
22822676 } else
22832677 if (source == hideItem)
22842678 {
....@@ -2296,11 +2690,11 @@
22962690 {
22972691 makeSomething(new Camera());
22982692 } else
2299
- if (source == compositeItem)
2693
+ if (source == compositeItem || source == compositeButton)
23002694 {
23012695 group(new Composite());
23022696 } else
2303
- if (source == randomItem)
2697
+ if (source == switchItem || source == switchButton)
23042698 {
23052699 RandomNode random = new RandomNode();
23062700 group(random);
....@@ -2402,7 +2796,7 @@
24022796 {
24032797 group(new cLinker());
24042798 } else
2405
- if (source == textureItem)
2799
+ if (source == textureItem || source == textureButton)
24062800 {
24072801 group(new TextureNode());
24082802 } else
....@@ -2422,17 +2816,30 @@
24222816 {
24232817 CastShadow(2);
24242818 } else
2425
- if (source == ungroupItem)
2819
+ if (source == ungroupItem || source == ungroupButton)
24262820 {
2427
- //ungroup();
2821
+ boolean hasRoot = false;
2822
+
24282823 for (int i=0; i<group.selection.size(); i++)
24292824 {
2430
- Ungroup(group.selection.get(i));
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
24312830 }
24322831
2433
- ClearSelection(false);
2434
-
2435
- refreshContents();
2832
+ if (!hasRoot)
2833
+ {
2834
+ for (int i=0; i<group.selection.size(); i++)
2835
+ {
2836
+ Ungroup(group.selection.get(i));
2837
+ }
2838
+
2839
+ ClearSelection(false);
2840
+
2841
+ refreshContents();
2842
+ }
24362843 } else
24372844 if (source == genUVItem)
24382845 {
....@@ -2444,7 +2851,7 @@
24442851 } else
24452852 if (source == genNormalsMESHItem)
24462853 {
2447
- GenNormals(true); // TODO
2854
+ GenNormalsMESH();
24482855 } else
24492856 if (source == genNormalsORGANItem)
24502857 {
....@@ -2509,6 +2916,22 @@
25092916 if (source == unmarkleavesItem)
25102917 {
25112918 MarkLeaves(false);
2919
+ } else
2920
+ if (source == rewindleavesItem)
2921
+ {
2922
+ RewindLeaves(true);
2923
+ } else
2924
+ if (source == unrewindleavesItem)
2925
+ {
2926
+ RewindLeaves(false);
2927
+ } else
2928
+ if (source == randomleavesItem)
2929
+ {
2930
+ RandomLeaves(true);
2931
+ } else
2932
+ if (source == unrandomleavesItem)
2933
+ {
2934
+ RandomLeaves(false);
25122935 } else
25132936 if (source == flipVItem)
25142937 {
....@@ -2594,9 +3017,13 @@
25943017 {
25953018 SmoothMesh();
25963019 } else
2597
- if (source == transformgeometryItem)
3020
+ if (source == transformGeometryItem)
25983021 {
25993022 TransformGeometry();
3023
+ } else
3024
+ if (source == transformChildrenItem)
3025
+ {
3026
+ TransformChildren();
26003027 } else
26013028 if (source == resetTransformItem)
26023029 {
....@@ -2604,7 +3031,11 @@
26043031 } else
26053032 if (source == resetCentroidItem)
26063033 {
2607
- ResetCentroid();
3034
+ ResetCentroid(true);
3035
+ } else
3036
+ if (source == resetCentroidXZItem)
3037
+ {
3038
+ ResetCentroid(false);
26083039 } else
26093040 if (source == resetParentItem)
26103041 {
....@@ -2736,6 +3167,10 @@
27363167 if (source == twoButton)
27373168 {
27383169 radio.layout = twoButton;
3170
+
3171
+ if (CameraPane.FULLSCREEN)
3172
+ fullscreenLayout = radio.layout;
3173
+
27393174 // bug
27403175 //gridPanel.setDividerLocation(1.0);
27413176 //bigPanel.setDividerLocation(0.0);
....@@ -2768,10 +3203,31 @@
27683203 bigThree.ClearUI();
27693204 bigThree.add(centralPanel);
27703205 bigThree.FlushUI();
3206
+
3207
+ cameraView.requestFocusInWindow();
3208
+
3209
+// refreshContents(true);
3210
+//
3211
+// try
3212
+// {
3213
+// java.awt.Robot bot = new java.awt.Robot();
3214
+// int mask = InputEvent.BUTTON1_MASK;
3215
+// bot.mouseMove(100, 100);
3216
+// bot.mousePress(mask);
3217
+// bot.mouseRelease(mask);
3218
+// }
3219
+// catch (Exception e)
3220
+// {
3221
+//
3222
+// }
3223
+
27713224 } else
27723225 if (source == threeButton)
27733226 {
27743227 radio.layout = threeButton;
3228
+
3229
+ if (CameraPane.FULLSCREEN)
3230
+ fullscreenLayout = radio.layout;
27753231
27763232 // bigThree.remove(scenePanel);
27773233 // bigThree.remove(centralPanel);
....@@ -2804,10 +3260,15 @@
28043260 bigThree.add(centralPanel);
28053261 bigThree.add(XYZPanel);
28063262 bigThree.FlushUI();
3263
+
3264
+ cameraView.requestFocusInWindow();
28073265 } else
28083266 if (source == fourButton)
28093267 {
28103268 radio.layout = fourButton;
3269
+
3270
+ if (CameraPane.FULLSCREEN)
3271
+ fullscreenLayout = radio.layout;
28113272
28123273 // bigThree.remove(scenePanel);
28133274 // bigThree.remove(centralPanel);
....@@ -2839,10 +3300,15 @@
28393300 bigThree.ClearUI();
28403301 bigThree.add(scenePanel);
28413302 bigThree.FlushUI();
3303
+
3304
+ cameraView.requestFocusInWindow();
28423305 } else
28433306 if (source == sixButton)
28443307 {
28453308 radio.layout = sixButton;
3309
+
3310
+ if (CameraPane.FULLSCREEN)
3311
+ fullscreenLayout = radio.layout;
28463312
28473313 // bigThree.remove(scenePanel);
28483314 // bigThree.remove(centralPanel);
....@@ -2875,10 +3341,15 @@
28753341 bigThree.add(scenePanel);
28763342 bigThree.add(centralPanel);
28773343 bigThree.FlushUI();
3344
+
3345
+ cameraView.requestFocusInWindow();
28783346 } else
28793347 if (source == sevenButton)
28803348 {
28813349 radio.layout = sevenButton;
3350
+
3351
+ if (CameraPane.FULLSCREEN)
3352
+ fullscreenLayout = radio.layout;
28823353
28833354 // bigThree.remove(scenePanel);
28843355 // bigThree.remove(centralPanel);
....@@ -2912,6 +3383,8 @@
29123383 bigThree.add(centralPanel);
29133384 bigThree.add(XYZPanel);
29143385 bigThree.FlushUI();
3386
+
3387
+ cameraView.requestFocusInWindow();
29153388 } else
29163389 if (source == rootButton)
29173390 {
....@@ -2923,6 +3396,7 @@
29233396 EditObject(obj);
29243397 }
29253398
3399
+ cameraView.requestFocusInWindow();
29263400 refreshContents(true);
29273401 } else
29283402 if (source == closeButton)
....@@ -2932,22 +3406,37 @@
29323406 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29333407 {
29343408 ab = (cRadio)e.nextElement();
2935
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3409
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29363410 {
3411
+ // Patch to avoid bug with transparency.
3412
+ if (!ab.hadMaterial)
3413
+ {
3414
+ ab.object.material = null;
3415
+ }
3416
+
29373417 buttonGroup.remove(ab);
29383418 radioPanel.remove(ab);
29393419
2940
- ab.GetObject().editWindow = null;
3420
+ //ab.GetObject().editWindow = null;
3421
+ ab.GetObject().manipWindow = null;
29413422 // ab.GetObject().objectUI = null; // ?????????
29423423
29433424 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29443425 break;
29453426 }
29463427 }
3428
+
3429
+ cameraView.requestFocusInWindow();
29473430 refreshContents(true);
29483431 } else
29493432 if (source == editItem || source == editButton)
29503433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
29513440 EditSelection(false);
29523441 } else
29533442 if (source == uneditButton)
....@@ -2957,10 +3446,11 @@
29573446 Object3D child = (Object3D)e.nextElement();
29583447 if(child.editWindow != null)
29593448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
29603450 child.CloseUI();
29613451 listUI.remove(child);
29623452
2963
- child.editWindow = null; // ???????????
3453
+ //child.editWindow = null; // ???????????
29643454 }
29653455 objEditor.ctrlPanel.FlushUI();
29663456 //objEditor.jTree.clearSelection();
....@@ -2973,6 +3463,7 @@
29733463 //copy.ClearUI();
29743464 for (Object3D obj : listUI)
29753465 {
3466
+ obj.pinned = false;
29763467 obj.CloseUI();
29773468 }
29783469 listUI.clear();
....@@ -2982,7 +3473,7 @@
29823473 {
29833474 assert(copy == group);
29843475
2985
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29863477
29873478 for (Object3D obj : listUI)
29883479 {
....@@ -3031,6 +3522,9 @@
30313522 }
30323523
30333524 copy = group;
3525
+
3526
+ SetUndoStates();
3527
+
30343528 //Globals.theRenderer.object = group;
30353529 if(!useclient)
30363530 {
....@@ -3046,20 +3540,46 @@
30463540 frontView.object = group;
30473541 sideView.object = group;
30483542 }
3049
- group.editWindow = this;
3543
+
3544
+// fix "+" issue
3545
+ //group.editWindow = this;
3546
+ group.manipWindow = this;
3547
+
30503548 /*
30513549 currentLayout = radio.layout;
30523550 if (currentLayout == null)
30533551 currentLayout = sevenButton;
30543552 */
30553553 radio.layout.doClick();
3554
+
3555
+ ClearUnpinned();
3556
+ Grafreed.Assert(group != null);
3557
+ Grafreed.Assert(group.selection != null);
3558
+ SetPinStates(group.selection.size() > 0);
3559
+ if (group.selection.size() == 1)
3560
+ EditSelection(false);
30563561 keepparent = group.parent;
30573562 // PARENT = NULL or not???
30583563 //group.parent = null; // ROOT
30593564 //group.attributes = -1;
30603565 ResetModel();
3566
+
3567
+ cameraView.requestFocusInWindow();
30613568 refreshContents(true);
3062
- }
3569
+ } else if (event.getSource() == editCameraItem)
3570
+ {
3571
+ cameraView.ProtectCamera();
3572
+ cameraView.repaint();
3573
+ return;
3574
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3575
+ {
3576
+ cameraView.RevertCamera();
3577
+ cameraView.repaint();
3578
+ return;
3579
+ // } else if (event.getSource() == textureButton)
3580
+ // {
3581
+ // return; // true;
3582
+ }
30633583 else
30643584 {
30653585 //return super.action(event, arg);
....@@ -3068,7 +3588,6 @@
30683588 }
30693589
30703590 boolean useclient = false;
3071
- cRadio radio;
30723591
30733592 void ToggleRoot()
30743593 {
....@@ -3120,6 +3639,28 @@
31203639 refreshContents();
31213640 }
31223641
3642
+ void TransformChildren()
3643
+ {
3644
+ Object3D obj;
3645
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3646
+ {
3647
+ obj = (Object3D)e.nextElement();
3648
+ obj.KeepTextureMatrices();
3649
+ obj.TransformChildren();
3650
+ obj.RestoreTextureMatrices();
3651
+
3652
+// if (obj.parent == null)
3653
+// {
3654
+// System.out.println("NULL PARENT!");
3655
+// new Exception().printStackTrace();
3656
+// }
3657
+// else
3658
+// TouchTransform(obj);
3659
+// //obj.parent.Touch();
3660
+ }
3661
+
3662
+ refreshContents();
3663
+ }
31233664
31243665 void ResetTransform()
31253666 {
....@@ -3232,7 +3773,7 @@
32323773 refreshContents();
32333774 }
32343775
3235
- void ResetCentroid()
3776
+ void ResetCentroid(boolean full)
32363777 {
32373778 Object3D obj;
32383779 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3247,12 +3788,16 @@
32473788 LA.matIdentity(Object3D.mat);
32483789 obj.getBounds(minima, maxima, false);
32493790 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3250
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3791
+ if (full)
3792
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32513793 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32523794 obj.TransformMesh(Object3D.mat);
3795
+
32533796 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3254
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3797
+ if (full)
3798
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32553799 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3800
+
32563801 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32573802 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32583803 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3281,7 +3826,8 @@
32813826
32823827 int size = obj.MemorySize();
32833828
3284
- System.err.println((size/1024) + " KB is the size of " + obj);
3829
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3830
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32853831 }
32863832 }
32873833 catch (Exception e)
....@@ -3318,9 +3864,9 @@
33183864 obj = (Object3D)e.nextElement();
33193865
33203866 System.out.println("Object is: " + obj);
3321
- GrafreeD.AnalyzeObject(obj);
3867
+ Grafreed.AnalyzeObject(obj);
33223868 System.out.println("Boundary rep: " + obj.bRep);
3323
- GrafreeD.AnalyzeObject(obj.bRep);
3869
+ Grafreed.AnalyzeObject(obj.bRep);
33243870
33253871 // System.err.println((size/1024) + " KB is the size of " + obj);
33263872 }
....@@ -3362,6 +3908,13 @@
33623908 void GenNormals(boolean crease)
33633909 {
33643910 group.GenNormalsS(crease);
3911
+
3912
+ refreshContents();
3913
+ }
3914
+
3915
+ void GenNormalsMESH()
3916
+ {
3917
+ group.GenNormalsMeshS();
33653918
33663919 refreshContents();
33673920 }
....@@ -3534,8 +4087,8 @@
35344087
35354088 void ParseVertices()
35364089 {
3537
- boolean epsequal = GrafreeD.epsequal;
3538
- GrafreeD.epsequal = true;
4090
+ boolean epsequal = Grafreed.epsequal;
4091
+ Grafreed.epsequal = true;
35394092
35404093 for (int i=0; i<group.selection.size(); i++)
35414094 {
....@@ -3560,7 +4113,7 @@
35604113 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35614114 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35624115
3563
- g.add(GrafreeD.clipboard);
4116
+ g.add(Grafreed.clipboard);
35644117
35654118 buffer.add(g);
35664119 }
....@@ -3575,7 +4128,7 @@
35754128 makeSomething(buffer, i==group.selection.size()-1);
35764129 }
35774130
3578
- GrafreeD.epsequal = epsequal;
4131
+ Grafreed.epsequal = epsequal;
35794132
35804133 refreshContents();
35814134 }
....@@ -3593,7 +4146,16 @@
35934146 String pigment = Object3D.GetPigment(tex);
35944147 //String bump = Object3D.GetBump(tex);
35954148
3596
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4149
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4150
+
4151
+ try
4152
+ {
4153
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4154
+ }
4155
+ catch (Exception e)
4156
+ {
4157
+ System.err.println("FAIL: " + node);
4158
+ }
35974159
35984160 double s = v.s;
35994161
....@@ -3725,7 +4287,7 @@
37254287 return;
37264288
37274289 Object3D poses = group.selection.get(0);
3728
- Object3D ref = GrafreeD.clipboard.get(0);
4290
+ Object3D ref = Grafreed.clipboard.get(0);
37294291
37304292 Object3D newgroup = new Object3D("Po:" + poses.name);
37314293
....@@ -3919,9 +4481,9 @@
39194481
39204482 void ClipMesh()
39214483 {
3922
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4484
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39234485 {
3924
- Object3D content = GrafreeD.clipboard.get(0);
4486
+ Object3D content = Grafreed.clipboard.get(0);
39254487
39264488 if (content instanceof cGroup && ((cGroup)content).transientlink )
39274489 content = ((cGroup)content).get(0);
....@@ -3930,7 +4492,7 @@
39304492 // {
39314493 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39324494 // }
3933
- group.selection.ClipMesh(GrafreeD.clipboard);
4495
+ group.selection.ClipMesh(Grafreed.clipboard);
39344496 }
39354497 // group.selection.ClipMesh(GrafreeD.clipboard);
39364498 System.out.println("DONE.");
....@@ -3977,6 +4539,18 @@
39774539 void MarkLeaves(boolean hide)
39784540 {
39794541 group.selection.MarkLeaves(hide);
4542
+ refreshContents();
4543
+ }
4544
+
4545
+ void RewindLeaves(boolean hide)
4546
+ {
4547
+ group.selection.RewindLeaves(hide);
4548
+ refreshContents();
4549
+ }
4550
+
4551
+ void RandomLeaves(boolean hide)
4552
+ {
4553
+ group.selection.RandomLeaves(hide);
39804554 refreshContents();
39814555 }
39824556
....@@ -4051,10 +4625,6 @@
40514625 // }
40524626 // }
40534627
4054
- static boolean allparams = true;
4055
-
4056
- static Vector<Object3D> listUI = new Vector<Object3D>();
4057
-
40584628 void EditSelection(boolean newWindow)
40594629 {
40604630 // aConstraints.gridy = 0;
....@@ -4062,10 +4632,10 @@
40624632 {
40634633 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40644634 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4065
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4635
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40664636
40674637 Object3D elem = (Object3D)group.selection.elementAt(i);
4068
- if(elem != group)
4638
+ if(elem != group || !newWindow)
40694639 {
40704640 // if (!(elem instanceof Composite))
40714641 // newWindow = false;
....@@ -4147,7 +4717,8 @@
41474717 //new Exception().printStackTrace();
41484718
41494719 freezemodel = true;
4150
-
4720
+ ClearUnpinned();
4721
+
41514722 /**/
41524723 //switch (event.id)
41534724 {
....@@ -4155,7 +4726,6 @@
41554726 //case 702: // Event.LIST_DESELECT
41564727 group.deselectAll();
41574728 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4158
- objEditor.ClearInfo(); // .GetMaterial());
41594729 if (tps != null)
41604730 {
41614731 for (int i=0; i < tps.length; i++)
....@@ -4164,10 +4734,8 @@
41644734
41654735 //if (child.parent != null)
41664736 //child.parent.addSelectee(child);
4737
+ objEditor.SetMaterial(child);
41674738 group.addSelectee(child);
4168
- objEditor.SetMaterial(child); // .GetMaterial());
4169
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4170
- System.err.println("info : " + child.GetPath());
41714739 }
41724740 }
41734741 // else
....@@ -4177,20 +4745,28 @@
41774745 // System.err.println("info : " + group.GetPath());
41784746 // }
41794747
4180
- objEditor.SetText(); // jan 2014
4181
-
4182
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4748
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41834749 CameraPane.flash = true;
41844750
4185
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4751
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41864752 // a camera
41874753 {
4188
- CameraPane.camerachangeframe = 0; // don't refuse it
4189
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4754
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4755
+ {
4756
+ CameraPane.camerachangeframe = 0; // don't refuse it
4757
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4758
+ }
41904759 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41914760 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41924761 }
41934762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
41944770 refreshContents();
41954771 //return true;
41964772 }
....@@ -4199,6 +4775,35 @@
41994775
42004776 freezemodel = false;
42014777 }
4778
+
4779
+ void SetPinStates(boolean enabled)
4780
+ {
4781
+ editButton.setEnabled(enabled);
4782
+ uneditButton.setEnabled(enabled);
4783
+ unselectButton.setEnabled(enabled);
4784
+ flashSelectionButton.setEnabled(enabled);
4785
+ }
4786
+
4787
+ void refreshContents(boolean cp)
4788
+ {
4789
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4790
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4791
+ {
4792
+ objEditor.ClearInfo(); // .GetMaterial());
4793
+
4794
+ for (int i=0; i < group.selection.Size(); i++)
4795
+ {
4796
+ Object3D child = (Object3D) group.selection.get(i);
4797
+
4798
+ objEditor.AddInfo(child, this, true);
4799
+ System.err.println("info : " + child.GetPath());
4800
+ }
4801
+
4802
+ objEditor.SetText(); // jan 2014
4803
+ }
4804
+
4805
+ super.refreshContents(cp);
4806
+ }
42024807
42034808 void linkSomething(Object3D thing)
42044809 {
....@@ -4270,16 +4875,19 @@
42704875 {
42714876 if (group.selection.isEmpty())
42724877 return;
4273
- GrafreeD.clipboardIsTempGroup = false;
4878
+
4879
+ Grafreed.clipboardIsTempGroup = false;
42744880 Composite tGroup = null;
42754881 if (group.selection.size() > 0) // 1)
42764882 {
42774883 tGroup = new cGroup();
4278
- GrafreeD.clipboardIsTempGroup = true;
4884
+ Grafreed.clipboardIsTempGroup = true;
42794885 }
42804886
42814887 if (cut)
42824888 {
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
42834891 //int indices[] = jList.getSelectedIndices();
42844892 //for (int i = indices.length - 1; i >= 0; i--)
42854893 //jList.remove(indices[i]);
....@@ -4315,16 +4923,16 @@
43154923 //System.out.println("cut " + child);
43164924 //System.out.println("parent = " + child.parent);
43174925 // tmp.addChild(child);
4318
- if (GrafreeD.clipboardIsTempGroup)
4926
+ if (Grafreed.clipboardIsTempGroup)
43194927 tGroup.add/*Child*/(tmp);
43204928 else
4321
- GrafreeD.clipboard = tmp;
4929
+ Grafreed.clipboard = tmp;
43224930 }
43234931 else
4324
- if (GrafreeD.clipboardIsTempGroup)
4932
+ if (Grafreed.clipboardIsTempGroup)
43254933 tGroup.add/*Child*/(child);
43264934 else
4327
- GrafreeD.clipboard = child;
4935
+ Grafreed.clipboard = child;
43284936 }
43294937
43304938 //ResetModel();
....@@ -4356,21 +4964,23 @@
43564964 //System.out.println("cut " + elem);
43574965 //System.out.println("parent = " + elem.parent);
43584966 // tmp.addChild(elem);
4359
- if (GrafreeD.clipboardIsTempGroup)
4967
+ if (Grafreed.clipboardIsTempGroup)
43604968 tGroup.add/*Child*/(tmp);
43614969 else
4362
- GrafreeD.clipboard = tmp;
4970
+ Grafreed.clipboard = tmp;
43634971 }
43644972 else
4365
- if (GrafreeD.clipboardIsTempGroup)
4973
+ if (Grafreed.clipboardIsTempGroup)
43664974 tGroup.add/*Child*/(child);
43674975 else
4368
- GrafreeD.clipboard = child;
4976
+ Grafreed.clipboard = child;
43694977 }
43704978
43714979 }
4372
- if (GrafreeD.clipboardIsTempGroup)
4373
- GrafreeD.clipboard = tGroup;
4980
+
4981
+ if (Grafreed.clipboardIsTempGroup)
4982
+ Grafreed.clipboard = tGroup;
4983
+
43744984 if (cut)
43754985 {
43764986 ResetModel();
....@@ -4380,11 +4990,15 @@
43804990
43814991 void paste(boolean expand)
43824992 {
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
43834997 // if (GrafreeD.clipboard == null)
43844998 // return;
43854999 boolean first = true;
43865000
4387
- if (GrafreeD.clipboardIsTempGroup)
5001
+ if (Grafreed.clipboardIsTempGroup)
43885002 {
43895003 Composite temp;
43905004
....@@ -4395,7 +5009,7 @@
43955009 temp = (Composite)Applet3D.clipboard.deepCopy();
43965010 */
43975011 Object3D elem;
4398
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5012
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43995013 {
44005014 Object3D child = (Object3D)e.nextElement();
44015015
....@@ -4429,16 +5043,17 @@
44295043 //Object3D cb = Applet3D.clipboard;
44305044 //temp.addChild(cb);
44315045 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4432
- assert(GrafreeD.clipboard.parent == null);
4433
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4434
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4435
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4436
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5046
+ assert(Grafreed.clipboard.parent == null);
5047
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5048
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5049
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5050
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44375051 else
4438
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4439
- GrafreeD.clipboard.get(0).parent = keepparent;
5052
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5053
+ Grafreed.clipboard.get(0).parent = keepparent;
44405054 }
44415055
5056
+ Globals.REPLACEONMAKE = keep;
44425057 ResetModel();
44435058 refreshContents();
44445059 }
....@@ -4485,9 +5100,9 @@
44855100 {
44865101 boolean first = true;
44875102
4488
- if (GrafreeD.clipboardIsTempGroup)
5103
+ if (Grafreed.clipboardIsTempGroup)
44895104 {
4490
- Composite temp = (Composite)GrafreeD.clipboard;
5105
+ Composite temp = (Composite)Grafreed.clipboard;
44915106 Object3D copy;
44925107 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44935108 {
....@@ -4497,7 +5112,7 @@
44975112 }
44985113 } else
44995114 {
4500
- linkSomething(GrafreeD.clipboard); //.get(0));
5115
+ linkSomething(Grafreed.clipboard); //.get(0));
45015116 }
45025117 }
45035118 }
....@@ -4574,6 +5189,10 @@
45745189
45755190 void group(Object3D csg, boolean grab)
45765191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
45775196 if (//false) // why??
45785197 !group.selection.isEmpty())
45795198 {
....@@ -4687,10 +5306,15 @@
46875306 //node.add(csg);
46885307 //makeSomething(node);
46895308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
46905310 }
46915311
46925312 void Ungroup(Object3D g)
46935313 {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
46945318 if (g instanceof HiddenObject)
46955319 {
46965320 HiddenObject h = (HiddenObject) g;
....@@ -4707,6 +5331,7 @@
47075331 objEditor.makeSomething(g.get(i), false);
47085332 }
47095333 }
5334
+ Globals.REPLACEONMAKE = keep;
47105335 }
47115336
47125337 void ungroup()
....@@ -4902,21 +5527,6 @@
49025527 }
49035528 */
49045529
4905
- void ImportGFD()
4906
- {
4907
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4908
- browser.show();
4909
- String filename = browser.getFile();
4910
- if (filename != null && filename.length() > 0)
4911
- {
4912
- String fullname = browser.getDirectory() + filename;
4913
-
4914
- //Object3D readobj =
4915
- objEditor.ReadGFD(fullname, objEditor);
4916
- //makeSomething(readobj);
4917
- }
4918
- }
4919
-
49205530 /*
49215531 public void Callback(Object obj)
49225532 {
....@@ -4940,26 +5550,9 @@
49405550 }
49415551 */
49425552
4943
- void ImportVRMLX3D()
4944
- {
4945
- if (GrafreeD.standAlone)
4946
- {
4947
- /**/
4948
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4949
- browser.show();
4950
- String filename = browser.getFile();
4951
- if (filename != null && filename.length() > 0)
4952
- {
4953
- String fullname = browser.getDirectory() + filename;
4954
- LoadVRMLX3D(fullname);
4955
- }
4956
- /**/
4957
- }
4958
- }
4959
-
49605553 String GetFile(String dialogName)
49615554 {
4962
- if (GrafreeD.standAlone)
5555
+ if (Grafreed.standAlone)
49635556 {
49645557 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49655558 browser.show();
....@@ -5027,7 +5620,28 @@
50275620 cButton clearpanelButton;
50285621 cButton unselectButton;
50295622
5623
+ cButton restoreCameraButton;
5624
+
5625
+ cButton saveButton;
50305626 cButton oneStepButton;
5627
+
5628
+ cButton groupButton;
5629
+ cButton ungroupButton;
5630
+ cButton compositeButton;
5631
+ cButton switchButton;
5632
+ cButton loopButton;
5633
+ cButton textureButton;
5634
+
5635
+ cButton gridButton;
5636
+ cButton boxButton;
5637
+ cButton sphereButton;
5638
+ cButton coneButton;
5639
+ cButton torusButton;
5640
+ cButton superButton;
5641
+ cButton kleinButton;
5642
+ cButton particlesButton;
5643
+ cButton overlayButton;
5644
+ cButton lightButton;
50315645
50325646 cButton screenfitButton;
50335647 cButton screenfitpointButton;
....@@ -5040,14 +5654,6 @@
50405654
50415655 cButton setsupportButton;
50425656
5043
- cButton twoButton;
5044
- cButton sixButton;
5045
- cButton threeButton;
5046
- cButton sevenButton;
5047
- cButton fourButton; // full panel
5048
- cButton oneButton; // full XYZ
5049
- //cButton currentLayout;
5050
-
50515657 //
50525658 //Composite
50535659 Object3D // to do !!
....@@ -5057,9 +5663,11 @@
50575663 //JTree jTree;
50585664 private MenuItem lookAtItem;
50595665 private MenuItem lookFromItem;
5060
- private MenuItem switchItem;
5666
+ private MenuItem switchViewItem;
50615667 private MenuItem cutItem;
5062
- private MenuItem duplicateItem;
5668
+ private MenuItem undoItem;
5669
+ private MenuItem redoItem;
5670
+ private JMenuItem duplicateItem;
50635671 private MenuItem cloneItem;
50645672 private MenuItem cloneSupportItem;
50655673 private MenuItem overwriteGeoItem;
....@@ -5072,7 +5680,7 @@
50725680 private MenuItem linkverticesItem;
50735681 private MenuItem relinkverticesItem;
50745682 private MenuItem setMasterItem;
5075
- private MenuItem resetMeshItem;
5683
+ private MenuItem resetAllItem;
50765684 private MenuItem stepAllItem;
50775685 private MenuItem revertMeshItem;
50785686 private MenuItem poseMeshItem;
....@@ -5122,6 +5730,10 @@
51225730 private MenuItem showleavesItem;
51235731 private MenuItem markleavesItem;
51245732 private MenuItem unmarkleavesItem;
5733
+ private MenuItem rewindleavesItem;
5734
+ private MenuItem unrewindleavesItem;
5735
+ private MenuItem randomleavesItem;
5736
+ private MenuItem unrandomleavesItem;
51255737
51265738 private MenuItem flipVItem;
51275739 private MenuItem unflipVItem;
....@@ -5133,15 +5745,17 @@
51335745 private MenuItem panoTexturesItem;
51345746
51355747 private MenuItem resetCentroidItem;
5136
- private MenuItem transformgeometryItem;
5748
+ private MenuItem resetCentroidXZItem;
51375749 private MenuItem resetTransformItem;
5750
+ private MenuItem transformGeometryItem;
5751
+ private MenuItem transformChildrenItem;
51385752 private MenuItem hideItem;
51395753 private MenuItem grabItem;
51405754 private MenuItem backItem;
51415755 private MenuItem frontItem;
51425756 private MenuItem cameraItem;
51435757 private MenuItem compositeItem;
5144
- private MenuItem randomItem;
5758
+ private MenuItem switchItem;
51455759 private MenuItem physicsItem;
51465760 private MenuItem frameselectorItem;
51475761 private MenuItem scriptNodeItem;
....@@ -5203,11 +5817,6 @@
52035817 private MenuItem doubleItem;
52045818 private MenuItem tripleItem;
52055819
5206
- private MenuItem importGFDItem;
5207
- private MenuItem importVRMLX3DItem;
5208
- private MenuItem import3DSItem;
5209
- private MenuItem importOBJItem;
5210
-
52115820 private MenuItem computeAOItem;
52125821 private MenuItem recompileItem;
52135822 private MenuItem editScriptItem;
....@@ -5217,4 +5826,8 @@
52175826 private MenuItem analyzeItem;
52185827 private MenuItem dumpItem;
52195828 //boolean freezemodel = false;
5829
+
5830
+ Menu cameraMenu;
5831
+ MenuItem editCameraItem;
5832
+ MenuItem restoreCameraItem;
52205833 }