Normand Briere
2019-07-17 a5580a47d246c1272b10adba68070f6e13da5e41
GroupEditor.java
....@@ -74,7 +74,7 @@
7474 this.copy = this.group = copy;
7575 //selectees = this.group.selectees;
7676
77
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7878 SetupUI2(objEditor);
7979 objEditor.SetupUI(true);
8080 SetupViews(objEditor);
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.REPLACEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.REPLACEONMAKE;
90
+ Globals.REPLACEONMAKE = false;
8791 // Object3D keep = GrafreeD.clipboard;
8892 //Object3D obj;
8993 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +98,19 @@
9498
9599 makeSomething(clone, i==group.selection.size()-1);
96100 }
101
+ Globals.REPLACEONMAKE = keep;
97102 }
98103
99104 void CloneClipboard(boolean supports)
100105 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
106
+ assert(Grafreed.clipboard.parent == null);
107
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
108
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
109
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
110
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106111 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
112
+ makeSomething(CloneObject(Grafreed.clipboard, false));
113
+ Grafreed.clipboard.get(0).parent = keepparent;
109114 }
110115
111116 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +124,7 @@
119124 // obj.support = null;
120125 if (!supports)
121126 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
127
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123128 obj.parent = parent;
124129 // obj.support = support;
125130 // clone.support = support; // aout 2013
....@@ -148,40 +153,37 @@
148153
149154 //JTextField nameField;
150155
151
- void SetupMenu2(ObjEditor oe)
156
+ void SetupMenu2(GroupEditor oe)
152157 {
153
- if (Globals.ADVANCED)
154
- {
155
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
156
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
157
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
158
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
159
- oe.cameraMenu.add("-");
160
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
161
- openWindowItem.addActionListener(this);
162
- editLeafItem.addActionListener(this);
163
- lookAtItem.addActionListener(this);
164
- //lookFromItem.addActinoListener(this);
165
- //switchItem.addActionListener(this);
166
- }
167
-
158
+ oe.jTree = new cTree();
159
+
168160 Menu menu;
169161 oe.menuBar.add(menu = new Menu("Edit"));
170162 //editItem = menu.add(new MenuItem("Edit"));
171163 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
164
+
165
+// undoItem = menu.add(new MenuItem("Undo"));
166
+// undoItem.addActionListener(this);
167
+// redoItem = menu.add(new MenuItem("Redo"));
168
+// redoItem.addActionListener(this);
169
+// menu.add("-");
170
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173171 duplicateItem.addActionListener(this);
172
+ cloneItem = menu.add(new MenuItem("Clone"));
173
+ cloneItem.addActionListener(this);
174
+ if (Globals.ADVANCED)
175
+ {
176
+ cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
177
+ cloneSupportItem.addActionListener(this);
178
+ }
179
+ menu.add("-");
174180 cutItem = menu.add(new MenuItem("Cut"));
175181 cutItem.addActionListener(this);
176182 copyItem = menu.add(new MenuItem("Copy"));
177183 copyItem.addActionListener(this);
178184 pasteItem = menu.add(new MenuItem("Paste"));
179185 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);
186
+
185187 menu.add("-");
186188 pasteIntoItem = menu.add(new MenuItem("Paste into"));
187189 pasteIntoItem.addActionListener(this);
....@@ -201,14 +203,97 @@
201203 clearAllItem = menu.add(new MenuItem("Clear All"));
202204 clearAllItem.addActionListener(this);
203205 }
206
+
207
+ menuBar.add(cameraMenu = new Menu("View"));
208
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
209
+ //zBufferItem.addActionListener(this);
210
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
211
+ //normalLensItem.addActionListener(this);
212
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
213
+ restoreCameraItem.addActionListener(this);
214
+
215
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
216
+// toggleFullScreenItem.addItemListener(this);
217
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
218
+// cameraMenu.add("-");
219
+//
220
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
221
+// toggleTextureItem.addItemListener(this);
222
+// toggleTextureItem.setState(CameraPane.textureon);
223
+//
224
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
225
+// toggleSwitchItem.addItemListener(this);
226
+// toggleSwitchItem.setState(CameraPane.SWITCH);
227
+
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
229
+ toggleHandleItem.addItemListener(this);
230
+ toggleHandleItem.setState(CameraPane.HANDLES);
231
+
232
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
233
+ togglePaintItem.addItemListener(this);
234
+ togglePaintItem.setState(CameraPane.PAINTMODE);
235
+
236
+ if (Globals.ADVANCED)
237
+ {
238
+ cameraMenu.add("-");
239
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
240
+ toggleLiveItem.addItemListener(this);
241
+ toggleLiveItem.setState(Globals.isLIVE());
204242
243
+ cameraMenu.add(stepItem = new MenuItem("Step"));
244
+ stepItem.addActionListener(this);
245
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
246
+ // toggleDLItem.addItemListener(this);
247
+ // toggleDLItem.setState(false);
248
+
249
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
250
+ toggleRenderItem.addItemListener(this);
251
+ toggleRenderItem.setState(!CameraPane.frozen);
252
+
253
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
254
+ toggleDebugItem.addItemListener(this);
255
+ toggleDebugItem.setState(Globals.DEBUG);
256
+
257
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
258
+ toggleFrustumItem.addItemListener(this);
259
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
260
+
261
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
262
+ toggleFootContactItem.addItemListener(this);
263
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
264
+
265
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
266
+ toggleTimelineItem.addItemListener(this);
267
+ }
268
+
269
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
270
+// toggleRootItem.addItemListener(this);
271
+// toggleRootItem.setState(false);
272
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
273
+// animationItem.addItemListener(this);
274
+// animationItem.setState(CameraPane.ANIMATION);
275
+ cameraMenu.add("-");
276
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
277
+ editCameraItem.addActionListener(this);
278
+
279
+ if (Globals.ADVANCED)
280
+ {
281
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
282
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
283
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
284
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
285
+ oe.cameraMenu.add("-");
286
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
287
+ openWindowItem.addActionListener(this);
288
+ editLeafItem.addActionListener(this);
289
+ lookAtItem.addActionListener(this);
290
+ //lookFromItem.addActinoListener(this);
291
+ //switchViewItem.addActionListener(this);
292
+ }
293
+
205294 oe.menuBar.add(menu = new Menu("Setting"));
206295 if (Globals.ADVANCED)
207296 {
208
- resetMeshItem = menu.add(new MenuItem("Reset All"));
209
- resetMeshItem.addActionListener(this);
210
- stepAllItem = menu.add(new MenuItem("Step All"));
211
- stepAllItem.addActionListener(this);
212297 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
213298 revertMeshItem.addActionListener(this);
214299 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -248,21 +333,29 @@
248333 }
249334
250335 oe.menuBar.add(menu = new Menu("Group"));
251
- grabItem = menu.add(new MenuItem("Grab"));
252
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
253338 backItem = menu.add(new MenuItem("Back"));
254339 backItem.addActionListener(this);
255340 frontItem = menu.add(new MenuItem("Front"));
256341 frontItem.addActionListener(this);
257
- compositeItem = menu.add(new MenuItem("Composite"));
258
- compositeItem.addActionListener(this);
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
344
+
345
+ if (Globals.ADVANCED)
346
+ {
259347 hideItem = menu.add(new MenuItem("Hidden Group"));
260348 hideItem.addActionListener(this);
349
+ }
261350 ungroupItem = menu.add(new MenuItem("Ungroup"));
262351 ungroupItem.addActionListener(this);
263
- menu.add("-");
264
- randomItem = menu.add(new MenuItem("Switch node"));
265
- randomItem.addActionListener(this);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
266359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
267360 switchGeoItem.addActionListener(this);
268361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -270,49 +363,52 @@
270363 morphItem = menu.add(new MenuItem("Morph Group"));
271364 morphItem.addActionListener(this);
272365
273
- if (Globals.ADVANCED)
274
- {
366
+ menu.add("-");
275367 physicsItem = menu.add(new MenuItem("Physics"));
276368 physicsItem.addActionListener(this);
277369 frameselectorItem = menu.add(new MenuItem("Frame Selector"));
278370 frameselectorItem.addActionListener(this);
279371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
280372 scriptNodeItem.addActionListener(this);
281
- cameraItem = menu.add(new MenuItem("Camera"));
282
- cameraItem.addActionListener(this);
283373 }
284374
285375 oe.menuBar.add(menu = new Menu("Object"));
286
- textureItem = menu.add(new MenuItem("Texture"));
287
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
288378 billboardItem = menu.add(new MenuItem("Billboard"));
289379 billboardItem.addActionListener(this);
290380 csgItem = menu.add(new MenuItem("CSG"));
291381 csgItem.addActionListener(this);
292
- shadowXItem = menu.add(new MenuItem("Shadow X"));
382
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
293383 shadowXItem.addActionListener(this);
294
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
384
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
295385 shadowYItem.addActionListener(this);
296
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
386
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
297387 shadowZItem.addActionListener(this);
298
- if (Globals.ADVANCED)
299
- {
300
- linkerItem = menu.add(new MenuItem("Linker"));
301
- linkerItem.addActionListener(this);
302388 attributeItem = menu.add(new MenuItem("Attribute"));
303389 attributeItem.addActionListener(this);
390
+
391
+ if (Globals.ADVANCED)
392
+ {
393
+ menu.add("-");
394
+ linkerItem = menu.add(new MenuItem("Linker"));
395
+ linkerItem.addActionListener(this);
304396 templateItem = menu.add(new MenuItem("Template"));
305397 templateItem.addActionListener(this);
306398 pointflowItem = menu.add(new MenuItem("Point Flow"));
307399 pointflowItem.addActionListener(this);
308
- menu.add("-");
309400 }
401
+ menu.add("-");
310402 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
311403 resetTransformItem.addActionListener(this);
312404 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
313405 resetCentroidItem.addActionListener(this);
314
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
315
- transformgeometryItem.addActionListener(this);
406
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
407
+ resetCentroidXZItem.addActionListener(this);
408
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
409
+ transformGeometryItem.addActionListener(this);
410
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
411
+ transformChildrenItem.addActionListener(this);
316412
317413 oe.menuBar.add(menu = new Menu("Geometry"));
318414 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -361,6 +457,10 @@
361457 oe.menuBar.add(menu = new Menu("Attributes"));
362458 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
363459 clearMaterialsItem.addActionListener(this);
460
+ resetAllItem = menu.add(new MenuItem("Reset All"));
461
+ resetAllItem.addActionListener(this);
462
+ stepAllItem = menu.add(new MenuItem("Step All"));
463
+ stepAllItem.addActionListener(this);
364464 menu.add("-");
365465 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
366466 liveleavesItem.addActionListener(this);
....@@ -381,6 +481,14 @@
381481 markleavesItem.addActionListener(this);
382482 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
383483 unmarkleavesItem.addActionListener(this);
484
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
485
+ rewindleavesItem.addActionListener(this);
486
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
487
+ unrewindleavesItem.addActionListener(this);
488
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
489
+ randomleavesItem.addActionListener(this);
490
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
491
+ unrandomleavesItem.addActionListener(this);
384492 menu.add("-");
385493 flipVItem = menu.add(new MenuItem("Flip V"));
386494 flipVItem.addActionListener(this);
....@@ -415,38 +523,42 @@
415523 sortbysizeItem.addActionListener(this);
416524 sortbynameItem = menu.add(new MenuItem("Sort by name"));
417525 sortbynameItem.addActionListener(this);
526
+ menu.add("-");
527
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
528
+ shareGeometriesItem.addActionListener(this);
529
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
530
+ mergeGeometriesItem.addActionListener(this);
418531 if (Globals.ADVANCED)
419532 {
420
- menu.add("-");
533
+ // Pretty much the same as duplicate and clone.
421534 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
422535 extractGeometriesItem.addActionListener(this);
423536 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
424537 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);
429538 }
430539
431540 oe.menuBar.add(menu = new Menu("Insert"));
432541 buildCreateMenu(menu);
433542
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
-
444543 oe.menuBar.add(menu = new Menu("Tools"));
445544 buildToolsMenu(menu);
446545 }
447546
547
+
448548 void SetupUI2(ObjEditor oe)
449549 {
550
+ // June 2019
551
+ if (oe == null)
552
+ {
553
+ //super.SetupUI2(this);
554
+ //return;
555
+ }
556
+
557
+ if (copy != group)
558
+ {
559
+ //super.SetupUI2(this);
560
+ }
561
+
450562 //new Exception().printStackTrace();
451563
452564 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -475,97 +587,229 @@
475587 oe.radioPanel.add(dummyButton);
476588 oe.buttonGroup.add(dummyButton);
477589 */
590
+ cGridBag copyOptionsPanel = new cGridBag();
591
+
592
+ copyOptionsPanel.preferredHeight = 1;
593
+
478594 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
479595
480
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
481
- liveCB.setToolTipText("Enabled animation");
596
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ //minButton.setToolTipText("Minimize window");
598
+ //minButton.addActionListener(this);
599
+
600
+ if (Globals.ADVANCED)
601
+ {
602
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
+ maxButton.setToolTipText("Maximize window");
604
+ maxButton.addActionListener(this);
605
+ }
606
+
607
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ fullButton.setToolTipText("Full-screen window");
609
+ fullButton.addActionListener(this);
610
+
611
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ screenfitButton.setToolTipText("Screen fit");
613
+ screenfitButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ restoreCameraButton.setToolTipText("Restore viewpoint");
617
+ restoreCameraButton.addActionListener(this);
618
+
619
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ saveButton.setToolTipText("New version");
621
+ saveButton.addActionListener(this);
622
+
623
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ undoButton.setToolTipText("Previous version");
625
+ undoButton.addActionListener(this);
626
+ undoButton.setEnabled(false);
627
+
628
+ cGridBag updown = new cGridBag().setVertical(true);
629
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreButton.setToolTipText("Restore current");
631
+ restoreButton.addActionListener(this);
632
+ restoreButton.setEnabled(false);
633
+
634
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ replaceButton.setToolTipText("Replace current");
636
+ replaceButton.addActionListener(this);
637
+ replaceButton.setEnabled(false);
638
+
639
+ copyOptionsPanel.add(updown);
640
+
641
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ redoButton.setToolTipText("Next version");
643
+ redoButton.addActionListener(this);
644
+ redoButton.setEnabled(false);
645
+
646
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
647
+ liveCB.setToolTipText("Enable animation");
482648 liveCB.addItemListener(this);
483649
484
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
650
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
485651 oneStepButton.setToolTipText("Animate one step forward");
486652 oneStepButton.addActionListener(this);
487653
488
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
654
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
489655 fastCB.setToolTipText("Fast mode");
490656 fastCB.addItemListener(this);
491657
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);
658
+ //oe.toolboxPanel.Return();
659
+
660
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
661
+// trackCB.setToolTipText("Enable tracking");
662
+// trackCB.addItemListener(this);
499663
500664 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
501665 // screenfitpointButton.addActionListener(this);
502666
503667 if (Globals.ADVANCED)
504668 {
505
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
669
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
506670 snapobjectButton.addActionListener(this);
507671 snapobjectButton.setToolTipText("Snap Object");
508672 }
509673
510
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
511
- flashSelectionButton.setToolTipText("Show selection");
512
- flashSelectionButton.addActionListener(this);
674
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
513675
514
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
515
-
516
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
517677 twoButton.setToolTipText("Show center view only");
518678 twoButton.addActionListener(this);
519
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
679
+ this.fullscreenLayout = twoButton;
680
+
681
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
520682 fourButton.addActionListener(this);
521683 fourButton.setToolTipText("Show left panel only");
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
684
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
523685 sixButton.setToolTipText("2-column layout left");
524686 sixButton.addActionListener(this);
525
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
687
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526688 threeButton.setToolTipText("2-column layout right");
527689 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
529691 sevenButton.setToolTipText("3-column layout");
530692 sevenButton.addActionListener(this);
531693 //
532694
533
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
695
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
534696 rootButton.setToolTipText("Edit selection in new tab");
535697 rootButton.addActionListener(this);
536698
537
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538700 closeButton.setToolTipText("Close tab");
539701 closeButton.addActionListener(this);
540702 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
541703 //clearButton.addActionListener(this);
542
-
543
- cGridBag commandsPanel = new cGridBag();
704
+
705
+ // INSERT
706
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707
+ gridButton.setToolTipText("Create grid");
708
+ gridButton.addActionListener(this);
709
+
710
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ boxButton.setToolTipText("Create box");
712
+ boxButton.addActionListener(this);
713
+
714
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ sphereButton.setToolTipText("Create sphere");
716
+ sphereButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ coneButton.setToolTipText("Create cone");
720
+ coneButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ torusButton.setToolTipText("Create torus");
724
+ torusButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ superButton.setToolTipText("Create superellipsoid");
728
+ superButton.addActionListener(this);
729
+
730
+ if (Globals.ADVANCED)
731
+ {
732
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ kleinButton.setToolTipText("Create Klein bottle");
734
+ kleinButton.addActionListener(this);
735
+ }
544736
545
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
546
- editButton.setToolTipText("Edit selection");
737
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ particlesButton.setToolTipText("Create particle system");
739
+ particlesButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.Return();
742
+
743
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ groupButton.setToolTipText("Create group");
745
+ groupButton.addActionListener(this);
746
+
747
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ compositeButton.setToolTipText("Create composite");
749
+ compositeButton.addActionListener(this);
750
+
751
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
+ switchButton.setToolTipText("Create item switcher");
753
+ switchButton.addActionListener(this);
754
+
755
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ loopButton.setToolTipText("Create loop");
757
+ loopButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ textureButton.setToolTipText("Create texture");
761
+ textureButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ overlayButton.setToolTipText("Create overlay");
765
+ overlayButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ lightButton.setToolTipText("Create light");
769
+ lightButton.addActionListener(this);
770
+
771
+ for (int i=6; --i>=0;)
772
+ {
773
+ oe.toolboxPanel.Return();
774
+ oe.toolboxPanel.add(new cGridBag());
775
+ oe.toolboxPanel.add(new cGridBag());
776
+ oe.toolboxPanel.add(new cGridBag());
777
+ oe.toolboxPanel.add(new cGridBag());
778
+ oe.toolboxPanel.add(new cGridBag());
779
+ oe.toolboxPanel.add(new cGridBag());
780
+ oe.toolboxPanel.add(new cGridBag());
781
+ }
782
+
783
+ // EDIT panel
784
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ editButton.setToolTipText("Pin selection controls");
547786 editButton.addActionListener(this);
548787
549
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
550
- uneditButton.setToolTipText("Unedit selection");
788
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
789
+ uneditButton.setToolTipText("Remove selection controls");
551790 uneditButton.addActionListener(this);
552791
553
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
554
- allParamsButton.setToolTipText("Edit all params");
792
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
793
+ allParamsButton.setToolTipText("Show all controle");
555794 allParamsButton.addActionListener(this);
556795
557
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
796
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
558797 clearPanelButton.setToolTipText("Clear edit panel");
559798 clearPanelButton.addActionListener(this);
560799
561
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
800
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
562801 unselectButton.setToolTipText("Unselect");
563802 unselectButton.addActionListener(this);
564803
565
- commandsPanel.preferredHeight = 1;
804
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ flashSelectionButton.setToolTipText("Highlight selection");
806
+ flashSelectionButton.addActionListener(this);
566807
567
- oe.treePanel.add(commandsPanel);
568
- oe.treePanel.Return();
808
+ editCommandsPanel.preferredHeight = 1;
809
+
810
+ SetPinStates(false);
811
+// oe.treePanel.add(commandsPanel);
812
+// oe.treePanel.Return();
569813
570814 // oe.aConstraints.gridx += 1;
571815 // oe.aConstraints.weighty = 0;
....@@ -582,29 +826,17 @@
582826
583827 JScrollPane jSP;
584828 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
585
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
829
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
586830 ResetModel();
587831
588832 oe.treePanel.add(jSPPanel);
589833 oe.treePanel.Return();
590834
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;
606835 oe.treePanel.add(copyOptionsPanel);
607836 oe.treePanel.Return();
837
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
+ versionField = (cNumberSlider)sliderPane.getComponent(1);
839
+ sliderPane.preferredHeight = 1;
608840
609841 // mainPanel.setDividerLocation(0.5); //1.0);
610842 // mainPanel.setResizeWeight(0.5);
....@@ -633,23 +865,43 @@
633865
634866 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
635867 {
868
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
869
+ colorCB.setToolTipText("Copy color when dropped");
870
+ colorCB.addItemListener(this);
871
+
872
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
873
+ materialCB.setToolTipText("Copy material when dropped");
874
+ materialCB.addItemListener(this);
875
+
876
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
877
+ textureCB.setToolTipText("Copy texture when dropped");
878
+ textureCB.addItemListener(this);
879
+
880
+ panel.Return();
881
+
636882 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
637883 boxCB.setToolTipText("Display bounding boxes");
638884 boxCB.addItemListener(this);
639885
640886 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
641
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
887
+ zoomBoxCB.setToolTipText("Display only for wheel");
642888 zoomBoxCB.addItemListener(this);
643889
644
- if (Globals.ADVANCED)
890
+ if (true) // Globals.ADVANCED)
645891 {
646
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
647
- supportCB.setToolTipText("Enable rigging");
648
- supportCB.addItemListener(this);
892
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
893
+// supportCB.setToolTipText("Enable rigging");
894
+// supportCB.addItemListener(this);
895
+
896
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
897
+ freezeCB.setToolTipText("Fast moving camera");
898
+ freezeCB.addItemListener(this);
649899
650900 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
651901 // localCB.addItemListener(this);
652902
903
+ panel.Return();
904
+
653905 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
654906 crowdCB.setToolTipText("Used for crowds");
655907 crowdCB.addItemListener(this);
....@@ -666,6 +918,8 @@
666918 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
667919 // speakerMocapCB.addItemListener(this);
668920
921
+ panel.Return();
922
+
669923 if (false)
670924 {
671925 // handled in scripts
....@@ -680,32 +934,72 @@
680934 //constraints.gridy += 1;
681935 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
682936 smoothfocusCB.addItemListener(this);
937
+ panel.Return();
683938 }
684939
685940 //constraints.gridx += 1;
686941 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
687942 // debugCB.addItemListener(this);
688943
944
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
945
+ trackCB.setToolTipText("Enable tracking target");
946
+ trackCB.addItemListener(this);
947
+
689948 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
949
+ oeilCB.setToolTipText("Move camera when tracking");
690950 oeilCB.addItemListener(this);
691951
952
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
953
+ shadowCB.setToolTipText("When live compute shadows");
954
+ shadowCB.addItemListener(this);
955
+
956
+ panel.Return();
957
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
958
+ toggleTextureCB.setToolTipText("Load textures");
959
+ toggleTextureCB.addItemListener(this);
960
+
961
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
962
+ toggleSwitchCB.setToolTipText("Choose a single item");
963
+ toggleSwitchCB.addItemListener(this);
964
+
965
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
966
+ autokeepCB.setToolTipText("On structure change");
967
+ autokeepCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ if (Globals.ADVANCED)
971
+ {
692972 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
693973 lookAtCB.setToolTipText("Look-at target");
694974 lookAtCB.addItemListener(this);
975
+ }
695976
696977 }
697978
698979 cGridBag fill = new cGridBag();
699
-
700980 fill.preferredHeight = 200;
981
+ cGridBag fill2 = new cGridBag();
982
+ fill2.preferredHeight = 200;
983
+ cGridBag fill3 = new cGridBag();
984
+ fill3.preferredHeight = 200;
701985
702986 panel.add(fill);
987
+ panel.add(fill2);
988
+ panel.add(fill3);
703989
704990 }
705991
706992 void EditObject(Object3D obj)
707993 {
708994 cRadio radioButton = new cRadio(obj.name);
995
+
996
+ // June 2019. Patch to avoid bug with transparency.
997
+ radioButton.hadMaterial = obj.material != null;
998
+ if (!radioButton.hadMaterial)
999
+ {
1000
+ obj.material = new cMaterial();
1001
+ }
1002
+
7091003 radioButton.SetObject(obj);
7101004 radioButton.layout = sevenButton;
7111005 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -714,8 +1008,11 @@
7141008 buttonGroup.add(radioButton);
7151009 radioButton.doClick();
7161010 }
1011
+
7171012 void SetupViews(ObjEditor oe)
7181013 {
1014
+ theFrame = this;
1015
+
7191016 oe.SetupViews();
7201017
7211018 System.out.println("SetupViews");
....@@ -724,23 +1021,28 @@
7241021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7251022 }
7261023
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;
1024
+ cToggleButton liveCB;
1025
+ cCheckBox supportCB;
1026
+ cCheckBox localCB;
1027
+ cCheckBox crowdCB;
1028
+ cCheckBox smoothCB;
1029
+ cToggleButton fastCB;
1030
+ cCheckBox slowCB;
1031
+ cCheckBox boxCB;
1032
+ cCheckBox zoomBoxCB;
1033
+ cCheckBox freezeCB;
1034
+ //cToggleButton trackCB;
1035
+ cCheckBox trackCB;
1036
+ cCheckBox smoothfocusCB;
7381037 // JCheckBox speakerMocapCB;
739
- JCheckBox speakerCameraCB;
740
- JCheckBox speakerFocusCB;
741
- JCheckBox debugCB;
742
- JCheckBox oeilCB;
743
- JCheckBox lookAtCB;
1038
+ cCheckBox speakerCameraCB;
1039
+ cCheckBox speakerFocusCB;
1040
+ cCheckBox debugCB;
1041
+
1042
+ cCheckBox oeilCB;
1043
+ cCheckBox shadowCB;
1044
+ cCheckBox autokeepCB;
1045
+ cCheckBox lookAtCB;
7441046
7451047 // static int COLOR = 1;
7461048 // static int MATERIAL = 2;
....@@ -748,9 +1050,9 @@
7481050
7491051 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7501052
751
- JCheckBox colorCB;
752
- JCheckBox materialCB;
753
- JCheckBox textureCB;
1053
+ cCheckBox colorCB;
1054
+ cCheckBox materialCB;
1055
+ cCheckBox textureCB;
7541056
7551057 public void itemStateChanged(ItemEvent e)
7561058 {
....@@ -778,6 +1080,7 @@
7781080 } else if(e.getSource() == liveCB)
7791081 {
7801082 cameraView.ToggleLive();
1083
+ refreshContents(false);
7811084 }
7821085 else if(e.getSource() == supportCB)
7831086 {
....@@ -842,6 +1145,18 @@
8421145 {
8431146 cameraView.ToggleOeil();
8441147 }
1148
+ else if(e.getSource() == shadowCB)
1149
+ {
1150
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1151
+ }
1152
+ else if(e.getSource() == freezeCB)
1153
+ {
1154
+ Globals.FREEZEONMOVE ^= true;
1155
+ }
1156
+ else if(e.getSource() == autokeepCB)
1157
+ {
1158
+ Globals.REPLACEONMAKE ^= true;
1159
+ }
8451160 else if(e.getSource() == lookAtCB)
8461161 {
8471162 cameraView.ToggleLookAt();
....@@ -858,7 +1173,8 @@
8581173
8591174 /**/
8601175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
861
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
8621178 if ((path == null) || (path.getPathCount() <= 1)) {
8631179 // We can't move the root node or an empty selection
8641180 return;
....@@ -921,8 +1237,6 @@
9211237 }
9221238 }
9231239
924
- String string = (String) object;
925
-
9261240 System.out.println("Transfer = " + object + "; drop : " + target);
9271241 // if( object instanceof java.io.File[])
9281242 // {
....@@ -930,7 +1244,11 @@
9301244 // objEditor.DropFile((java.io.File[]) object, true);
9311245 // return;
9321246 // }
933
- if (string.charAt(0) == '/')
1247
+
1248
+ String string = object.toString();
1249
+
1250
+ // File path for Mac and Windows
1251
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9341252 {
9351253 // file(s)
9361254 String[] names = string.split("\n");
....@@ -957,7 +1275,7 @@
9571275
9581276 flashIt = false;
9591277 CameraPane pane = (CameraPane) target;
960
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1278
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9611279 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9621280
9631281 if (group.selection.size() == 1)
....@@ -973,23 +1291,33 @@
9731291
9741292 assert target == objEditor.jTree;
9751293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
9761295 try {
977
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9781297 } catch (Exception e) {
9791298 System.out.println("destinationPath : " + destinationPath);
9801299 return;
9811300 }
9821301
983
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
9841303 {
1304
+ Object3D child = (Object3D)group.selection.elementAt(i);
1305
+
1306
+ // Cannot move into itself
1307
+ if (child == destinationLeaf)
1308
+ return;
1309
+ }
1310
+
1311
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1312
+// {
9851313 loadClipboard(true);
9861314 objEditor.jTree.setSelectionPath(destinationPath);
9871315 pasteInto(false, false);
988
- } else {
989
- loadClipboard(false);
990
- objEditor.jTree.setSelectionPath(destinationPath);
991
- pasteInto(false, false); // true); // ???
992
- }
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
9931321 }
9941322 public void dropActionChanged(DropTargetDragEvent dtde)
9951323 // Called if the user has modified the current drop gesture
....@@ -1094,22 +1422,30 @@
10941422 {
10951423 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10961424 //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);
1425
+// gridItem = menu.add(new MenuItem("Grid"));
1426
+// gridItem.addActionListener(this);
1427
+// rectoidItem = menu.add(new MenuItem("Box"));
1428
+// rectoidItem.addActionListener(this);
1429
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1430
+// ellipsoidItem.addActionListener(this);
1431
+// coneItem = menu.add(new MenuItem("Cone"));
1432
+// coneItem.addActionListener(this);
1433
+// torusItem = menu.add(new MenuItem("Torus"));
1434
+// torusItem.addActionListener(this);
1435
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1436
+// superItem.addActionListener(this);
1437
+
1438
+ cameraItem = menu.add(new MenuItem("Camera"));
1439
+ cameraItem.addActionListener(this);
1440
+
1441
+ if (!Globals.ADVANCED)
1442
+ {
11091443 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11101444 kleinItem.addActionListener(this);
1111
- particleItem = menu.add(new MenuItem("Particle system"));
1112
- particleItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
11131449 if (Globals.ADVANCED)
11141450 {
11151451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1135,15 +1471,15 @@
11351471 }
11361472 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11371473 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);
1474
+// overlayItem = menu.add(new MenuItem("Overlay"));
1475
+// overlayItem.addActionListener(this);
1476
+// lightItem = menu.add(new MenuItem("Light"));
1477
+// lightItem.addActionListener(this);
11421478 menu.add("-");
11431479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11441480 //superLoopItem.addActionListener(this);
1145
- loopItem = menu.add(new MenuItem("Loop"));
1146
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
11471483 doubleItem = menu.add(new MenuItem("Fork"));
11481484 doubleItem.addActionListener(this);
11491485 if (Globals.ADVANCED)
....@@ -1159,18 +1495,23 @@
11591495 animationItem.addItemListener(this);
11601496 animationItem.setState(Globals.ANIMATION);
11611497
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
1500
+
11621501 menu.add("-");
11631502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11641503 parseverticesItem.addActionListener(this);
11651504 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11661505 textureFieldItem.addActionListener(this);
1167
- alignItem = menu.add(new MenuItem("Align Object"));
1506
+ alignItem = menu.add(new MenuItem("Align Objects"));
11681507 alignItem.addActionListener(this);
11691508 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11701509 reduceMorphItem.addActionListener(this);
11711510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11721511 reduce34MorphItem.addActionListener(this);
1173
-
1512
+ menu.add("-");
1513
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1514
+ memoryItem.addActionListener(this);
11741515 menu.add(computeAOItem = new MenuItem("Compute AO"));
11751516 computeAOItem.addActionListener(this);
11761517
....@@ -1179,11 +1520,9 @@
11791520 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11801521 mirrorItem.addActionListener(this);
11811522 menu.add("-");
1182
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1183
- memoryItem.addActionListener(this);
11841523 menu.add(analyzeItem = new MenuItem("Analyze"));
11851524 analyzeItem.addActionListener(this);
1186
- menu.add(dumpItem = new MenuItem("Dump"));
1525
+ menu.add(dumpItem = new MenuItem("Print"));
11871526 dumpItem.addActionListener(this);
11881527 // menu.add(pathItem = new MenuItem("From-to path"));
11891528 // pathItem.addActionListener(this);
....@@ -1324,9 +1663,24 @@
13241663 shadow.material = new cMaterial(obj.material);
13251664 shadow.material.diffuse = 0.0001f;
13261665 shadow.material.specular = 0.0001f;
1666
+ //shadow.projectedVertices[1].x = 300;
13271667
13281668 makeSomething(shadow);
13291669 }
1670
+
1671
+ private void ClearUnpinned()
1672
+ {
1673
+ //for (Object3D obj : listUI)
1674
+ for (int i=listUI.size(); --i>=0;)
1675
+ {
1676
+ Object3D obj = listUI.elementAt(i);
1677
+ if (!obj.pinned)
1678
+ {
1679
+ obj.CloseUI();
1680
+ listUI.remove(i);
1681
+ }
1682
+ }
1683
+ }
13301684
13311685 /**
13321686 * applyExample
....@@ -1530,9 +1884,9 @@
15301884
15311885 void Overwrite(int mask)
15321886 {
1533
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1887
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15341888 {
1535
- Object3D content = GrafreeD.clipboard.get(0);
1889
+ Object3D content = Grafreed.clipboard.get(0);
15361890
15371891 if (content instanceof cGroup && ((cGroup)content).transientlink )
15381892 content = ((cGroup)content).get(0);
....@@ -1571,7 +1925,7 @@
15711925 {
15721926 ScreenFit();
15731927 } else
1574
- if (source == switchItem)
1928
+ if (source == switchViewItem)
15751929 {
15761930 cVector v1 = new cVector();
15771931 cVector v2 = new cVector();
....@@ -1580,11 +1934,11 @@
15801934 objEditor.cameraView.renderCamera.setAim(v2, v1);
15811935 objEditor.cameraView.repaint();
15821936 } else
1583
- if (source == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
15841938 {
15851939 makeSomething(new Box());
15861940 } else
1587
- if (source == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
15881942 {
15891943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15901944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1663,27 +2017,27 @@
16632017
16642018 makeSomething(obj);
16652019 } else
1666
- if (source == gridItem)
2020
+ if (source == gridItem || source == gridButton)
16672021 {
16682022 makeSomething(new Grid());
16692023 } else
1670
- if (source == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
16712025 {
16722026 makeSomething(new Sphere());
16732027 } else
1674
- if (source == coneItem)
2028
+ if (source == coneItem || source == coneButton)
16752029 {
16762030 makeSomething(new Cone());
16772031 } else
1678
- if (source == torusItem)
2032
+ if (source == torusItem || source == torusButton)
16792033 {
16802034 makeSomething(new Torus());
16812035 } else
1682
- if (source == superItem)
2036
+ if (source == superItem || source == superButton)
16832037 {
16842038 makeSomething(new Superellipsoid());
16852039 } else
1686
- if (source == kleinItem)
2040
+ if (source == kleinItem || source == kleinButton)
16872041 {
16882042 makeSomething(new Klein());
16892043 } else
....@@ -1703,7 +2057,7 @@
17032057 {
17042058 makeSomething(new BezierSurface());
17052059 } else
1706
- if (source == overlayItem)
2060
+ if (source == overlayItem || source == overlayButton)
17072061 {
17082062 /*
17092063 Object3D obj = new BezierSurface(5,8);
....@@ -1751,7 +2105,7 @@
17512105 s.setup();
17522106 makeSomething(s);
17532107 } else
1754
- if (source == lightItem)
2108
+ if (source == lightItem || source == lightButton)
17552109 {
17562110 makeSomething(new Light());
17572111 } else
....@@ -1801,30 +2155,30 @@
18012155
18022156 group(g);
18032157 } else
1804
- if (source == loopItem)
2158
+ if (source == loopItem || source == loopButton)
18052159 {
18062160 Composite csg = new GroupLeaf();
18072161 csg.count = 5;
18082162 group(csg);
1809
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
18102164 csg.addChild(child);
18112165 child.addChild(csg);
18122166 } else
18132167 if (source == doubleItem)
18142168 {
1815
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
18162170 csg.count = 5;
18172171 group(csg);
1818
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
18192173 csg.addChild(child);
18202174 child.addChild(csg);
1821
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
18222176 csg.addChild(child);
18232177 child.addChild(csg);
18242178 } else
18252179 if (source == tripleItem)
18262180 {
1827
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
18282182 csg.count = 4;
18292183 group(csg);
18302184 Composite child = new cGroup();
....@@ -1836,23 +2190,6 @@
18362190 child = new cGroup();
18372191 csg.addChild(child);
18382192 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");
18562193 } else
18572194 if (source == computeAOItem)
18582195 {
....@@ -1872,7 +2209,7 @@
18722209 if (source == invariantsItem)
18732210 {
18742211 System.out.println("Invariants:");
1875
- GrafreeD.grafreeD.universe.invariants();
2212
+ Grafreed.grafreeD.universe.invariants();
18762213 } else
18772214 if (source == memoryItem)
18782215 {
....@@ -1891,6 +2228,46 @@
18912228 {
18922229 DumpObject();
18932230 } else
2231
+ if (source == minButton)
2232
+ {
2233
+ Minimize();
2234
+ } else
2235
+ if (source == maxButton)
2236
+ {
2237
+ Maximize();
2238
+ } else
2239
+ if (source == fullButton)
2240
+ {
2241
+ ToggleFullScreen();
2242
+ } else
2243
+ if (source == undoButton)
2244
+ {
2245
+ // Go to previous version
2246
+ //if (!Undo())
2247
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2248
+ Undo();
2249
+ } else
2250
+ if (source == restoreButton)
2251
+ {
2252
+ // Restore current version
2253
+ Restore();
2254
+ } else
2255
+ if (source == replaceButton)
2256
+ {
2257
+ // Overwrite current version
2258
+ Replace();
2259
+ } else
2260
+ if (source == redoButton)
2261
+ {
2262
+ // Go to next version
2263
+ Redo();
2264
+ } else
2265
+ if (source == saveButton)
2266
+ {
2267
+ // Save a new version
2268
+ if (!Save(true))
2269
+ java.awt.Toolkit.getDefaultToolkit().beep();
2270
+ } else
18942271 if (source == oneStepButton)
18952272 {
18962273 Globals.ONESTEP = true;
....@@ -1898,17 +2275,14 @@
18982275 } else
18992276 if (source == screenfitButton)
19002277 {
1901
- //Reload(lastConverter, lastFilename, true);
19022278 ScreenFit();
19032279 } else
19042280 if (source == screenfitpointButton)
19052281 {
1906
- //Reload(lastConverter, lastFilename, true);
19072282 ScreenFitPoint();
19082283 } else
19092284 if (source == snapobjectButton)
19102285 {
1911
- //Reload(lastConverter, lastFilename, true);
19122286 SnapObject();
19132287 } else
19142288 // if (event.getSource() == recompileButton)
....@@ -1945,12 +2319,20 @@
19452319 {
19462320 loadClipboard(true);
19472321 } else
2322
+ if (source == undoItem)
2323
+ {
2324
+ Undo();
2325
+ } else
2326
+ if (source == redoItem)
2327
+ {
2328
+ Redo();
2329
+ } else
19482330 if (source == duplicateItem)
19492331 {
1950
- Object3D keep = GrafreeD.clipboard;
2332
+ Object3D keep = Grafreed.clipboard;
19512333 loadClipboard(false);
19522334 paste(false);
1953
- GrafreeD.clipboard = keep;
2335
+ Grafreed.clipboard = keep;
19542336 } else
19552337 if (source == cloneItem)
19562338 {
....@@ -2170,9 +2552,9 @@
21702552 // group.selection.get(0).setMasterThis(content); // should be identity
21712553 // refreshContents();
21722554 // }
2173
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2555
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21742556 {
2175
- Object3D content = GrafreeD.clipboard.get(0);
2557
+ Object3D content = Grafreed.clipboard.get(0);
21762558
21772559 if (content instanceof cGroup && ((cGroup)content).transientlink )
21782560 content = ((cGroup)content).get(0);
....@@ -2222,9 +2604,9 @@
22222604 } else
22232605 if (source == setMasterItem)
22242606 {
2225
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2607
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22262608 {
2227
- Object3D content = GrafreeD.clipboard.get(0);
2609
+ Object3D content = Grafreed.clipboard.get(0);
22282610
22292611 if (content instanceof cGroup && ((cGroup)content).transientlink )
22302612 content = ((cGroup)content).get(0);
....@@ -2237,9 +2619,9 @@
22372619 {
22382620 if (group.selection.size() == 1)
22392621 {
2240
- if (GrafreeD.clipboard.size() == 1)
2622
+ if (Grafreed.clipboard.size() == 1)
22412623 {
2242
- Object3D content = GrafreeD.clipboard.get(0);
2624
+ Object3D content = Grafreed.clipboard.get(0);
22432625
22442626 if (content instanceof cGroup && ((cGroup)content).transientlink )
22452627 content = ((cGroup)content).get(0);
....@@ -2256,7 +2638,7 @@
22562638 {
22572639 RevertMeshes();
22582640 } else
2259
- if (source == resetMeshItem)
2641
+ if (source == resetAllItem)
22602642 {
22612643 ResetAll();
22622644 } else
....@@ -2276,9 +2658,9 @@
22762658 {
22772659 ClearSelection(true);
22782660 } else
2279
- if (source == grabItem)
2661
+ if (source == grabItem || source == groupButton)
22802662 {
2281
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
22822664 } else
22832665 if (source == hideItem)
22842666 {
....@@ -2296,11 +2678,11 @@
22962678 {
22972679 makeSomething(new Camera());
22982680 } else
2299
- if (source == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
23002682 {
23012683 group(new Composite());
23022684 } else
2303
- if (source == randomItem)
2685
+ if (source == switchItem || source == switchButton)
23042686 {
23052687 RandomNode random = new RandomNode();
23062688 group(random);
....@@ -2402,7 +2784,7 @@
24022784 {
24032785 group(new cLinker());
24042786 } else
2405
- if (source == textureItem)
2787
+ if (source == textureItem || source == textureButton)
24062788 {
24072789 group(new TextureNode());
24082790 } else
....@@ -2422,17 +2804,30 @@
24222804 {
24232805 CastShadow(2);
24242806 } else
2425
- if (source == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
24262808 {
2427
- //ungroup();
2809
+ boolean hasRoot = false;
2810
+
24282811 for (int i=0; i<group.selection.size(); i++)
24292812 {
2430
- Ungroup(group.selection.get(i));
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
24312818 }
24322819
2433
- ClearSelection(false);
2434
-
2435
- refreshContents();
2820
+ if (!hasRoot)
2821
+ {
2822
+ for (int i=0; i<group.selection.size(); i++)
2823
+ {
2824
+ Ungroup(group.selection.get(i));
2825
+ }
2826
+
2827
+ ClearSelection(false);
2828
+
2829
+ refreshContents();
2830
+ }
24362831 } else
24372832 if (source == genUVItem)
24382833 {
....@@ -2444,7 +2839,7 @@
24442839 } else
24452840 if (source == genNormalsMESHItem)
24462841 {
2447
- GenNormals(true); // TODO
2842
+ GenNormalsMESH();
24482843 } else
24492844 if (source == genNormalsORGANItem)
24502845 {
....@@ -2509,6 +2904,22 @@
25092904 if (source == unmarkleavesItem)
25102905 {
25112906 MarkLeaves(false);
2907
+ } else
2908
+ if (source == rewindleavesItem)
2909
+ {
2910
+ RewindLeaves(true);
2911
+ } else
2912
+ if (source == unrewindleavesItem)
2913
+ {
2914
+ RewindLeaves(false);
2915
+ } else
2916
+ if (source == randomleavesItem)
2917
+ {
2918
+ RandomLeaves(true);
2919
+ } else
2920
+ if (source == unrandomleavesItem)
2921
+ {
2922
+ RandomLeaves(false);
25122923 } else
25132924 if (source == flipVItem)
25142925 {
....@@ -2594,9 +3005,13 @@
25943005 {
25953006 SmoothMesh();
25963007 } else
2597
- if (source == transformgeometryItem)
3008
+ if (source == transformGeometryItem)
25983009 {
25993010 TransformGeometry();
3011
+ } else
3012
+ if (source == transformChildrenItem)
3013
+ {
3014
+ TransformChildren();
26003015 } else
26013016 if (source == resetTransformItem)
26023017 {
....@@ -2604,7 +3019,11 @@
26043019 } else
26053020 if (source == resetCentroidItem)
26063021 {
2607
- ResetCentroid();
3022
+ ResetCentroid(true);
3023
+ } else
3024
+ if (source == resetCentroidXZItem)
3025
+ {
3026
+ ResetCentroid(false);
26083027 } else
26093028 if (source == resetParentItem)
26103029 {
....@@ -2736,6 +3155,10 @@
27363155 if (source == twoButton)
27373156 {
27383157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
27393162 // bug
27403163 //gridPanel.setDividerLocation(1.0);
27413164 //bigPanel.setDividerLocation(0.0);
....@@ -2768,10 +3191,31 @@
27683191 bigThree.ClearUI();
27693192 bigThree.add(centralPanel);
27703193 bigThree.FlushUI();
3194
+
3195
+ cameraView.requestFocusInWindow();
3196
+
3197
+// refreshContents(true);
3198
+//
3199
+// try
3200
+// {
3201
+// java.awt.Robot bot = new java.awt.Robot();
3202
+// int mask = InputEvent.BUTTON1_MASK;
3203
+// bot.mouseMove(100, 100);
3204
+// bot.mousePress(mask);
3205
+// bot.mouseRelease(mask);
3206
+// }
3207
+// catch (Exception e)
3208
+// {
3209
+//
3210
+// }
3211
+
27713212 } else
27723213 if (source == threeButton)
27733214 {
27743215 radio.layout = threeButton;
3216
+
3217
+ if (CameraPane.FULLSCREEN)
3218
+ fullscreenLayout = radio.layout;
27753219
27763220 // bigThree.remove(scenePanel);
27773221 // bigThree.remove(centralPanel);
....@@ -2804,10 +3248,15 @@
28043248 bigThree.add(centralPanel);
28053249 bigThree.add(XYZPanel);
28063250 bigThree.FlushUI();
3251
+
3252
+ cameraView.requestFocusInWindow();
28073253 } else
28083254 if (source == fourButton)
28093255 {
28103256 radio.layout = fourButton;
3257
+
3258
+ if (CameraPane.FULLSCREEN)
3259
+ fullscreenLayout = radio.layout;
28113260
28123261 // bigThree.remove(scenePanel);
28133262 // bigThree.remove(centralPanel);
....@@ -2839,10 +3288,15 @@
28393288 bigThree.ClearUI();
28403289 bigThree.add(scenePanel);
28413290 bigThree.FlushUI();
3291
+
3292
+ cameraView.requestFocusInWindow();
28423293 } else
28433294 if (source == sixButton)
28443295 {
28453296 radio.layout = sixButton;
3297
+
3298
+ if (CameraPane.FULLSCREEN)
3299
+ fullscreenLayout = radio.layout;
28463300
28473301 // bigThree.remove(scenePanel);
28483302 // bigThree.remove(centralPanel);
....@@ -2875,10 +3329,15 @@
28753329 bigThree.add(scenePanel);
28763330 bigThree.add(centralPanel);
28773331 bigThree.FlushUI();
3332
+
3333
+ cameraView.requestFocusInWindow();
28783334 } else
28793335 if (source == sevenButton)
28803336 {
28813337 radio.layout = sevenButton;
3338
+
3339
+ if (CameraPane.FULLSCREEN)
3340
+ fullscreenLayout = radio.layout;
28823341
28833342 // bigThree.remove(scenePanel);
28843343 // bigThree.remove(centralPanel);
....@@ -2912,6 +3371,8 @@
29123371 bigThree.add(centralPanel);
29133372 bigThree.add(XYZPanel);
29143373 bigThree.FlushUI();
3374
+
3375
+ cameraView.requestFocusInWindow();
29153376 } else
29163377 if (source == rootButton)
29173378 {
....@@ -2923,6 +3384,7 @@
29233384 EditObject(obj);
29243385 }
29253386
3387
+ cameraView.requestFocusInWindow();
29263388 refreshContents(true);
29273389 } else
29283390 if (source == closeButton)
....@@ -2932,22 +3394,37 @@
29323394 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29333395 {
29343396 ab = (cRadio)e.nextElement();
2935
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3397
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29363398 {
3399
+ // Patch to avoid bug with transparency.
3400
+ if (!ab.hadMaterial)
3401
+ {
3402
+ ab.object.material = null;
3403
+ }
3404
+
29373405 buttonGroup.remove(ab);
29383406 radioPanel.remove(ab);
29393407
2940
- ab.GetObject().editWindow = null;
3408
+ //ab.GetObject().editWindow = null;
3409
+ ab.GetObject().manipWindow = null;
29413410 // ab.GetObject().objectUI = null; // ?????????
29423411
29433412 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29443413 break;
29453414 }
29463415 }
3416
+
3417
+ cameraView.requestFocusInWindow();
29473418 refreshContents(true);
29483419 } else
29493420 if (source == editItem || source == editButton)
29503421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
29513428 EditSelection(false);
29523429 } else
29533430 if (source == uneditButton)
....@@ -2957,10 +3434,11 @@
29573434 Object3D child = (Object3D)e.nextElement();
29583435 if(child.editWindow != null)
29593436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
29603438 child.CloseUI();
29613439 listUI.remove(child);
29623440
2963
- child.editWindow = null; // ???????????
3441
+ //child.editWindow = null; // ???????????
29643442 }
29653443 objEditor.ctrlPanel.FlushUI();
29663444 //objEditor.jTree.clearSelection();
....@@ -2973,6 +3451,7 @@
29733451 //copy.ClearUI();
29743452 for (Object3D obj : listUI)
29753453 {
3454
+ obj.pinned = false;
29763455 obj.CloseUI();
29773456 }
29783457 listUI.clear();
....@@ -2982,7 +3461,7 @@
29823461 {
29833462 assert(copy == group);
29843463
2985
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29863465
29873466 for (Object3D obj : listUI)
29883467 {
....@@ -3031,6 +3510,9 @@
30313510 }
30323511
30333512 copy = group;
3513
+
3514
+ SetUndoStates();
3515
+
30343516 //Globals.theRenderer.object = group;
30353517 if(!useclient)
30363518 {
....@@ -3046,20 +3528,44 @@
30463528 frontView.object = group;
30473529 sideView.object = group;
30483530 }
3049
- group.editWindow = this;
3531
+
3532
+// fix "+" issue
3533
+ //group.editWindow = this;
3534
+ group.manipWindow = this;
3535
+
30503536 /*
30513537 currentLayout = radio.layout;
30523538 if (currentLayout == null)
30533539 currentLayout = sevenButton;
30543540 */
30553541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
30563547 keepparent = group.parent;
30573548 // PARENT = NULL or not???
30583549 //group.parent = null; // ROOT
30593550 //group.attributes = -1;
30603551 ResetModel();
3552
+
3553
+ cameraView.requestFocusInWindow();
30613554 refreshContents(true);
3062
- }
3555
+ } else if (event.getSource() == editCameraItem)
3556
+ {
3557
+ cameraView.ProtectCamera();
3558
+ cameraView.repaint();
3559
+ return;
3560
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3561
+ {
3562
+ cameraView.RevertCamera();
3563
+ cameraView.repaint();
3564
+ return;
3565
+ // } else if (event.getSource() == textureButton)
3566
+ // {
3567
+ // return; // true;
3568
+ }
30633569 else
30643570 {
30653571 //return super.action(event, arg);
....@@ -3068,7 +3574,6 @@
30683574 }
30693575
30703576 boolean useclient = false;
3071
- cRadio radio;
30723577
30733578 void ToggleRoot()
30743579 {
....@@ -3120,6 +3625,28 @@
31203625 refreshContents();
31213626 }
31223627
3628
+ void TransformChildren()
3629
+ {
3630
+ Object3D obj;
3631
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3632
+ {
3633
+ obj = (Object3D)e.nextElement();
3634
+ obj.KeepTextureMatrices();
3635
+ obj.TransformChildren();
3636
+ obj.RestoreTextureMatrices();
3637
+
3638
+// if (obj.parent == null)
3639
+// {
3640
+// System.out.println("NULL PARENT!");
3641
+// new Exception().printStackTrace();
3642
+// }
3643
+// else
3644
+// TouchTransform(obj);
3645
+// //obj.parent.Touch();
3646
+ }
3647
+
3648
+ refreshContents();
3649
+ }
31233650
31243651 void ResetTransform()
31253652 {
....@@ -3232,7 +3759,7 @@
32323759 refreshContents();
32333760 }
32343761
3235
- void ResetCentroid()
3762
+ void ResetCentroid(boolean full)
32363763 {
32373764 Object3D obj;
32383765 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3247,12 +3774,16 @@
32473774 LA.matIdentity(Object3D.mat);
32483775 obj.getBounds(minima, maxima, false);
32493776 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3250
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3777
+ if (full)
3778
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32513779 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32523780 obj.TransformMesh(Object3D.mat);
3781
+
32533782 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3254
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3783
+ if (full)
3784
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32553785 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3786
+
32563787 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32573788 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32583789 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3281,7 +3812,8 @@
32813812
32823813 int size = obj.MemorySize();
32833814
3284
- System.err.println((size/1024) + " KB is the size of " + obj);
3815
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3816
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32853817 }
32863818 }
32873819 catch (Exception e)
....@@ -3318,9 +3850,9 @@
33183850 obj = (Object3D)e.nextElement();
33193851
33203852 System.out.println("Object is: " + obj);
3321
- GrafreeD.AnalyzeObject(obj);
3853
+ Grafreed.AnalyzeObject(obj);
33223854 System.out.println("Boundary rep: " + obj.bRep);
3323
- GrafreeD.AnalyzeObject(obj.bRep);
3855
+ Grafreed.AnalyzeObject(obj.bRep);
33243856
33253857 // System.err.println((size/1024) + " KB is the size of " + obj);
33263858 }
....@@ -3362,6 +3894,13 @@
33623894 void GenNormals(boolean crease)
33633895 {
33643896 group.GenNormalsS(crease);
3897
+
3898
+ refreshContents();
3899
+ }
3900
+
3901
+ void GenNormalsMESH()
3902
+ {
3903
+ group.GenNormalsMeshS();
33653904
33663905 refreshContents();
33673906 }
....@@ -3534,8 +4073,8 @@
35344073
35354074 void ParseVertices()
35364075 {
3537
- boolean epsequal = GrafreeD.epsequal;
3538
- GrafreeD.epsequal = true;
4076
+ boolean epsequal = Grafreed.epsequal;
4077
+ Grafreed.epsequal = true;
35394078
35404079 for (int i=0; i<group.selection.size(); i++)
35414080 {
....@@ -3560,7 +4099,7 @@
35604099 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35614100 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35624101
3563
- g.add(GrafreeD.clipboard);
4102
+ g.add(Grafreed.clipboard);
35644103
35654104 buffer.add(g);
35664105 }
....@@ -3575,7 +4114,7 @@
35754114 makeSomething(buffer, i==group.selection.size()-1);
35764115 }
35774116
3578
- GrafreeD.epsequal = epsequal;
4117
+ Grafreed.epsequal = epsequal;
35794118
35804119 refreshContents();
35814120 }
....@@ -3593,7 +4132,16 @@
35934132 String pigment = Object3D.GetPigment(tex);
35944133 //String bump = Object3D.GetBump(tex);
35954134
3596
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4135
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4136
+
4137
+ try
4138
+ {
4139
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4140
+ }
4141
+ catch (Exception e)
4142
+ {
4143
+ System.err.println("FAIL: " + node);
4144
+ }
35974145
35984146 double s = v.s;
35994147
....@@ -3725,7 +4273,7 @@
37254273 return;
37264274
37274275 Object3D poses = group.selection.get(0);
3728
- Object3D ref = GrafreeD.clipboard.get(0);
4276
+ Object3D ref = Grafreed.clipboard.get(0);
37294277
37304278 Object3D newgroup = new Object3D("Po:" + poses.name);
37314279
....@@ -3919,9 +4467,9 @@
39194467
39204468 void ClipMesh()
39214469 {
3922
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4470
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39234471 {
3924
- Object3D content = GrafreeD.clipboard.get(0);
4472
+ Object3D content = Grafreed.clipboard.get(0);
39254473
39264474 if (content instanceof cGroup && ((cGroup)content).transientlink )
39274475 content = ((cGroup)content).get(0);
....@@ -3930,7 +4478,7 @@
39304478 // {
39314479 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39324480 // }
3933
- group.selection.ClipMesh(GrafreeD.clipboard);
4481
+ group.selection.ClipMesh(Grafreed.clipboard);
39344482 }
39354483 // group.selection.ClipMesh(GrafreeD.clipboard);
39364484 System.out.println("DONE.");
....@@ -3977,6 +4525,18 @@
39774525 void MarkLeaves(boolean hide)
39784526 {
39794527 group.selection.MarkLeaves(hide);
4528
+ refreshContents();
4529
+ }
4530
+
4531
+ void RewindLeaves(boolean hide)
4532
+ {
4533
+ group.selection.RewindLeaves(hide);
4534
+ refreshContents();
4535
+ }
4536
+
4537
+ void RandomLeaves(boolean hide)
4538
+ {
4539
+ group.selection.RandomLeaves(hide);
39804540 refreshContents();
39814541 }
39824542
....@@ -4051,10 +4611,6 @@
40514611 // }
40524612 // }
40534613
4054
- static boolean allparams = true;
4055
-
4056
- static Vector<Object3D> listUI = new Vector<Object3D>();
4057
-
40584614 void EditSelection(boolean newWindow)
40594615 {
40604616 // aConstraints.gridy = 0;
....@@ -4062,10 +4618,10 @@
40624618 {
40634619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40644620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4065
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40664622
40674623 Object3D elem = (Object3D)group.selection.elementAt(i);
4068
- if(elem != group)
4624
+ if(elem != group || !newWindow)
40694625 {
40704626 // if (!(elem instanceof Composite))
40714627 // newWindow = false;
....@@ -4147,7 +4703,8 @@
41474703 //new Exception().printStackTrace();
41484704
41494705 freezemodel = true;
4150
-
4706
+ ClearUnpinned();
4707
+
41514708 /**/
41524709 //switch (event.id)
41534710 {
....@@ -4155,7 +4712,6 @@
41554712 //case 702: // Event.LIST_DESELECT
41564713 group.deselectAll();
41574714 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4158
- objEditor.ClearInfo(); // .GetMaterial());
41594715 if (tps != null)
41604716 {
41614717 for (int i=0; i < tps.length; i++)
....@@ -4164,10 +4720,8 @@
41644720
41654721 //if (child.parent != null)
41664722 //child.parent.addSelectee(child);
4723
+ objEditor.SetMaterial(child);
41674724 group.addSelectee(child);
4168
- objEditor.SetMaterial(child); // .GetMaterial());
4169
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4170
- System.err.println("info : " + child.GetPath());
41714725 }
41724726 }
41734727 // else
....@@ -4177,20 +4731,28 @@
41774731 // System.err.println("info : " + group.GetPath());
41784732 // }
41794733
4180
- objEditor.SetText(); // jan 2014
4181
-
4182
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4734
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41834735 CameraPane.flash = true;
41844736
4185
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4737
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41864738 // a camera
41874739 {
4188
- CameraPane.camerachangeframe = 0; // don't refuse it
4189
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4740
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4741
+ {
4742
+ CameraPane.camerachangeframe = 0; // don't refuse it
4743
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4744
+ }
41904745 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41914746 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41924747 }
41934748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
41944756 refreshContents();
41954757 //return true;
41964758 }
....@@ -4199,6 +4761,35 @@
41994761
42004762 freezemodel = false;
42014763 }
4764
+
4765
+ void SetPinStates(boolean enabled)
4766
+ {
4767
+ editButton.setEnabled(enabled);
4768
+ uneditButton.setEnabled(enabled);
4769
+ unselectButton.setEnabled(enabled);
4770
+ flashSelectionButton.setEnabled(enabled);
4771
+ }
4772
+
4773
+ void refreshContents(boolean cp)
4774
+ {
4775
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4776
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4777
+ {
4778
+ objEditor.ClearInfo(); // .GetMaterial());
4779
+
4780
+ for (int i=0; i < group.selection.Size(); i++)
4781
+ {
4782
+ Object3D child = (Object3D) group.selection.get(i);
4783
+
4784
+ objEditor.AddInfo(child, this, true);
4785
+ System.err.println("info : " + child.GetPath());
4786
+ }
4787
+
4788
+ objEditor.SetText(); // jan 2014
4789
+ }
4790
+
4791
+ super.refreshContents(cp);
4792
+ }
42024793
42034794 void linkSomething(Object3D thing)
42044795 {
....@@ -4270,16 +4861,19 @@
42704861 {
42714862 if (group.selection.isEmpty())
42724863 return;
4273
- GrafreeD.clipboardIsTempGroup = false;
4864
+
4865
+ Grafreed.clipboardIsTempGroup = false;
42744866 Composite tGroup = null;
42754867 if (group.selection.size() > 0) // 1)
42764868 {
42774869 tGroup = new cGroup();
4278
- GrafreeD.clipboardIsTempGroup = true;
4870
+ Grafreed.clipboardIsTempGroup = true;
42794871 }
42804872
42814873 if (cut)
42824874 {
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
42834877 //int indices[] = jList.getSelectedIndices();
42844878 //for (int i = indices.length - 1; i >= 0; i--)
42854879 //jList.remove(indices[i]);
....@@ -4315,16 +4909,16 @@
43154909 //System.out.println("cut " + child);
43164910 //System.out.println("parent = " + child.parent);
43174911 // tmp.addChild(child);
4318
- if (GrafreeD.clipboardIsTempGroup)
4912
+ if (Grafreed.clipboardIsTempGroup)
43194913 tGroup.add/*Child*/(tmp);
43204914 else
4321
- GrafreeD.clipboard = tmp;
4915
+ Grafreed.clipboard = tmp;
43224916 }
43234917 else
4324
- if (GrafreeD.clipboardIsTempGroup)
4918
+ if (Grafreed.clipboardIsTempGroup)
43254919 tGroup.add/*Child*/(child);
43264920 else
4327
- GrafreeD.clipboard = child;
4921
+ Grafreed.clipboard = child;
43284922 }
43294923
43304924 //ResetModel();
....@@ -4356,21 +4950,23 @@
43564950 //System.out.println("cut " + elem);
43574951 //System.out.println("parent = " + elem.parent);
43584952 // tmp.addChild(elem);
4359
- if (GrafreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
43604954 tGroup.add/*Child*/(tmp);
43614955 else
4362
- GrafreeD.clipboard = tmp;
4956
+ Grafreed.clipboard = tmp;
43634957 }
43644958 else
4365
- if (GrafreeD.clipboardIsTempGroup)
4959
+ if (Grafreed.clipboardIsTempGroup)
43664960 tGroup.add/*Child*/(child);
43674961 else
4368
- GrafreeD.clipboard = child;
4962
+ Grafreed.clipboard = child;
43694963 }
43704964
43714965 }
4372
- if (GrafreeD.clipboardIsTempGroup)
4373
- GrafreeD.clipboard = tGroup;
4966
+
4967
+ if (Grafreed.clipboardIsTempGroup)
4968
+ Grafreed.clipboard = tGroup;
4969
+
43744970 if (cut)
43754971 {
43764972 ResetModel();
....@@ -4380,11 +4976,15 @@
43804976
43814977 void paste(boolean expand)
43824978 {
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
43834983 // if (GrafreeD.clipboard == null)
43844984 // return;
43854985 boolean first = true;
43864986
4387
- if (GrafreeD.clipboardIsTempGroup)
4987
+ if (Grafreed.clipboardIsTempGroup)
43884988 {
43894989 Composite temp;
43904990
....@@ -4395,7 +4995,7 @@
43954995 temp = (Composite)Applet3D.clipboard.deepCopy();
43964996 */
43974997 Object3D elem;
4398
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4998
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43994999 {
44005000 Object3D child = (Object3D)e.nextElement();
44015001
....@@ -4429,16 +5029,17 @@
44295029 //Object3D cb = Applet3D.clipboard;
44305030 //temp.addChild(cb);
44315031 //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());
5032
+ assert(Grafreed.clipboard.parent == null);
5033
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5034
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5035
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5036
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44375037 else
4438
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4439
- GrafreeD.clipboard.get(0).parent = keepparent;
5038
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5039
+ Grafreed.clipboard.get(0).parent = keepparent;
44405040 }
44415041
5042
+ Globals.REPLACEONMAKE = keep;
44425043 ResetModel();
44435044 refreshContents();
44445045 }
....@@ -4485,9 +5086,9 @@
44855086 {
44865087 boolean first = true;
44875088
4488
- if (GrafreeD.clipboardIsTempGroup)
5089
+ if (Grafreed.clipboardIsTempGroup)
44895090 {
4490
- Composite temp = (Composite)GrafreeD.clipboard;
5091
+ Composite temp = (Composite)Grafreed.clipboard;
44915092 Object3D copy;
44925093 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44935094 {
....@@ -4497,7 +5098,7 @@
44975098 }
44985099 } else
44995100 {
4500
- linkSomething(GrafreeD.clipboard); //.get(0));
5101
+ linkSomething(Grafreed.clipboard); //.get(0));
45015102 }
45025103 }
45035104 }
....@@ -4574,6 +5175,10 @@
45745175
45755176 void group(Object3D csg, boolean grab)
45765177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
45775182 if (//false) // why??
45785183 !group.selection.isEmpty())
45795184 {
....@@ -4687,10 +5292,15 @@
46875292 //node.add(csg);
46885293 //makeSomething(node);
46895294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
46905296 }
46915297
46925298 void Ungroup(Object3D g)
46935299 {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
46945304 if (g instanceof HiddenObject)
46955305 {
46965306 HiddenObject h = (HiddenObject) g;
....@@ -4707,6 +5317,7 @@
47075317 objEditor.makeSomething(g.get(i), false);
47085318 }
47095319 }
5320
+ Globals.REPLACEONMAKE = keep;
47105321 }
47115322
47125323 void ungroup()
....@@ -4902,21 +5513,6 @@
49025513 }
49035514 */
49045515
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
-
49205516 /*
49215517 public void Callback(Object obj)
49225518 {
....@@ -4940,26 +5536,9 @@
49405536 }
49415537 */
49425538
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
-
49605539 String GetFile(String dialogName)
49615540 {
4962
- if (GrafreeD.standAlone)
5541
+ if (Grafreed.standAlone)
49635542 {
49645543 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49655544 browser.show();
....@@ -5027,7 +5606,28 @@
50275606 cButton clearpanelButton;
50285607 cButton unselectButton;
50295608
5609
+ cButton restoreCameraButton;
5610
+
5611
+ cButton saveButton;
50305612 cButton oneStepButton;
5613
+
5614
+ cButton groupButton;
5615
+ cButton ungroupButton;
5616
+ cButton compositeButton;
5617
+ cButton switchButton;
5618
+ cButton loopButton;
5619
+ cButton textureButton;
5620
+
5621
+ cButton gridButton;
5622
+ cButton boxButton;
5623
+ cButton sphereButton;
5624
+ cButton coneButton;
5625
+ cButton torusButton;
5626
+ cButton superButton;
5627
+ cButton kleinButton;
5628
+ cButton particlesButton;
5629
+ cButton overlayButton;
5630
+ cButton lightButton;
50315631
50325632 cButton screenfitButton;
50335633 cButton screenfitpointButton;
....@@ -5040,14 +5640,6 @@
50405640
50415641 cButton setsupportButton;
50425642
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
-
50515643 //
50525644 //Composite
50535645 Object3D // to do !!
....@@ -5057,9 +5649,11 @@
50575649 //JTree jTree;
50585650 private MenuItem lookAtItem;
50595651 private MenuItem lookFromItem;
5060
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
50615653 private MenuItem cutItem;
5062
- private MenuItem duplicateItem;
5654
+ private MenuItem undoItem;
5655
+ private MenuItem redoItem;
5656
+ private JMenuItem duplicateItem;
50635657 private MenuItem cloneItem;
50645658 private MenuItem cloneSupportItem;
50655659 private MenuItem overwriteGeoItem;
....@@ -5072,7 +5666,7 @@
50725666 private MenuItem linkverticesItem;
50735667 private MenuItem relinkverticesItem;
50745668 private MenuItem setMasterItem;
5075
- private MenuItem resetMeshItem;
5669
+ private MenuItem resetAllItem;
50765670 private MenuItem stepAllItem;
50775671 private MenuItem revertMeshItem;
50785672 private MenuItem poseMeshItem;
....@@ -5122,6 +5716,10 @@
51225716 private MenuItem showleavesItem;
51235717 private MenuItem markleavesItem;
51245718 private MenuItem unmarkleavesItem;
5719
+ private MenuItem rewindleavesItem;
5720
+ private MenuItem unrewindleavesItem;
5721
+ private MenuItem randomleavesItem;
5722
+ private MenuItem unrandomleavesItem;
51255723
51265724 private MenuItem flipVItem;
51275725 private MenuItem unflipVItem;
....@@ -5133,15 +5731,17 @@
51335731 private MenuItem panoTexturesItem;
51345732
51355733 private MenuItem resetCentroidItem;
5136
- private MenuItem transformgeometryItem;
5734
+ private MenuItem resetCentroidXZItem;
51375735 private MenuItem resetTransformItem;
5736
+ private MenuItem transformGeometryItem;
5737
+ private MenuItem transformChildrenItem;
51385738 private MenuItem hideItem;
51395739 private MenuItem grabItem;
51405740 private MenuItem backItem;
51415741 private MenuItem frontItem;
51425742 private MenuItem cameraItem;
51435743 private MenuItem compositeItem;
5144
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
51455745 private MenuItem physicsItem;
51465746 private MenuItem frameselectorItem;
51475747 private MenuItem scriptNodeItem;
....@@ -5203,11 +5803,6 @@
52035803 private MenuItem doubleItem;
52045804 private MenuItem tripleItem;
52055805
5206
- private MenuItem importGFDItem;
5207
- private MenuItem importVRMLX3DItem;
5208
- private MenuItem import3DSItem;
5209
- private MenuItem importOBJItem;
5210
-
52115806 private MenuItem computeAOItem;
52125807 private MenuItem recompileItem;
52135808 private MenuItem editScriptItem;
....@@ -5217,4 +5812,8 @@
52175812 private MenuItem analyzeItem;
52185813 private MenuItem dumpItem;
52195814 //boolean freezemodel = false;
5815
+
5816
+ Menu cameraMenu;
5817
+ MenuItem editCameraItem;
5818
+ MenuItem restoreCameraItem;
52205819 }