Normand Briere
2019-07-19 e79247ef52a0bbb3864d46bb1e2c716005b3ecf3
GroupEditor.java
....@@ -60,6 +60,12 @@
6060 this.copy = this.group = group;
6161 //selectees = this.group.selectees;
6262
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6369 if(ui)
6470 SetupUI(objEditor);
6571 }
....@@ -74,7 +80,13 @@
7480 this.copy = this.group = copy;
7581 //selectees = this.group.selectees;
7682
77
- SetupMenu2(objEditor);
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
89
+ SetupMenu2(this); //objEditor);
7890 SetupUI2(objEditor);
7991 objEditor.SetupUI(true);
8092 SetupViews(objEditor);
....@@ -84,6 +96,10 @@
8496
8597 void CloneSelection(boolean supports)
8698 {
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
87103 // Object3D keep = GrafreeD.clipboard;
88104 //Object3D obj;
89105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +110,19 @@
94110
95111 makeSomething(clone, i==group.selection.size()-1);
96112 }
113
+ Globals.REPLACEONMAKE = keep;
97114 }
98115
99116 void CloneClipboard(boolean supports)
100117 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
118
+ assert(Grafreed.clipboard.parent == null);
119
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
120
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
121
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
122
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106123 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
124
+ makeSomething(CloneObject(Grafreed.clipboard, false));
125
+ Grafreed.clipboard.get(0).parent = keepparent;
109126 }
110127
111128 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +136,7 @@
119136 // obj.support = null;
120137 if (!supports)
121138 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
139
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123140 obj.parent = parent;
124141 // obj.support = support;
125142 // clone.support = support; // aout 2013
....@@ -148,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);
....@@ -192,8 +206,8 @@
192206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
193207 // pasteExpandItem.addActionListener(this);
194208 menu.add("-");
195
- clearItem = menu.add(new MenuItem("Clear"));
196
- clearItem.addActionListener(this);
209
+ deleteItem = menu.add(new MenuItem("Delete"));
210
+ deleteItem.addActionListener(this);
197211
198212 if (Globals.ADVANCED)
199213 {
....@@ -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"));
....@@ -325,7 +433,7 @@
325433 genNormalsMESHItem.addActionListener(this);
326434 if (Globals.ADVANCED)
327435 {
328
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
436
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
329437 genNormalsMINEItem.addActionListener(this);
330438 }
331439 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -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,230 @@
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);
517
- twoButton.setToolTipText("Show center view only");
518
- twoButton.addActionListener(this);
519
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
520689 fourButton.addActionListener(this);
521690 fourButton.setToolTipText("Show left panel only");
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
523
- sixButton.setToolTipText("2-column layout left");
691
+
692
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ twoButton.setToolTipText("Show right view only");
694
+ twoButton.addActionListener(this);
695
+ this.fullscreenLayout = twoButton;
696
+
697
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
+ sixButton.setToolTipText("Show left and right");
524699 sixButton.addActionListener(this);
525
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
526
- threeButton.setToolTipText("2-column layout right");
527
- threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
529
- sevenButton.setToolTipText("3-column layout");
530
- sevenButton.addActionListener(this);
700
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+// threeButton.setToolTipText("2-column layout right");
702
+// threeButton.addActionListener(this);
703
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+// sevenButton.setToolTipText("3-column layout");
705
+// sevenButton.addActionListener(this);
531706 //
532707
533
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
534
- rootButton.setToolTipText("Edit selection in new tab");
708
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ rootButton.setToolTipText("Open selection in new tab");
535710 rootButton.addActionListener(this);
536711
537
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
712
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538713 closeButton.setToolTipText("Close tab");
539714 closeButton.addActionListener(this);
540715 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
541716 //clearButton.addActionListener(this);
542
-
543
- cGridBag commandsPanel = new cGridBag();
717
+
718
+ // INSERT
719
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
720
+ gridButton.setToolTipText("Create grid");
721
+ gridButton.addActionListener(this);
722
+
723
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ boxButton.setToolTipText("Create box");
725
+ boxButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
728
+ sphereButton.setToolTipText("Create sphere");
729
+ sphereButton.addActionListener(this);
730
+
731
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
732
+ coneButton.setToolTipText("Create cone");
733
+ coneButton.addActionListener(this);
734
+
735
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+ torusButton.setToolTipText("Create torus");
737
+ torusButton.addActionListener(this);
738
+
739
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
740
+ superButton.setToolTipText("Create superellipsoid");
741
+ superButton.addActionListener(this);
742
+
743
+ if (Globals.ADVANCED)
744
+ {
745
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ kleinButton.setToolTipText("Create Klein bottle");
747
+ kleinButton.addActionListener(this);
748
+ }
544749
545
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
546
- editButton.setToolTipText("Edit selection");
750
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
751
+ particlesButton.setToolTipText("Create particle system");
752
+ particlesButton.addActionListener(this);
753
+
754
+ oe.toolboxPanel.Return();
755
+
756
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
757
+ groupButton.setToolTipText("Create group");
758
+ groupButton.addActionListener(this);
759
+
760
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
761
+ compositeButton.setToolTipText("Create composite");
762
+ compositeButton.addActionListener(this);
763
+
764
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ switchButton.setToolTipText("Create item switcher");
766
+ switchButton.addActionListener(this);
767
+
768
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ loopButton.setToolTipText("Create loop");
770
+ loopButton.addActionListener(this);
771
+
772
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ textureButton.setToolTipText("Create texture");
774
+ textureButton.addActionListener(this);
775
+
776
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ overlayButton.setToolTipText("Create overlay");
778
+ overlayButton.addActionListener(this);
779
+
780
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
+ lightButton.setToolTipText("Create light");
782
+ lightButton.addActionListener(this);
783
+
784
+ for (int i=6; --i>=0;)
785
+ {
786
+ oe.toolboxPanel.Return();
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ oe.toolboxPanel.add(new cGridBag());
794
+ }
795
+
796
+ // EDIT panel
797
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
798
+ editButton.setToolTipText("Pin selection controls");
547799 editButton.addActionListener(this);
548800
549
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
550
- uneditButton.setToolTipText("Unedit selection");
801
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
802
+ uneditButton.setToolTipText("Remove selection controls");
551803 uneditButton.addActionListener(this);
552804
553
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
554
- allParamsButton.setToolTipText("Edit all params");
805
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
806
+ allParamsButton.setToolTipText("Show all controle");
555807 allParamsButton.addActionListener(this);
556808
557
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
809
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
558810 clearPanelButton.setToolTipText("Clear edit panel");
559811 clearPanelButton.addActionListener(this);
560812
561
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
813
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
562814 unselectButton.setToolTipText("Unselect");
563815 unselectButton.addActionListener(this);
564816
565
- commandsPanel.preferredHeight = 1;
817
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
818
+ flashSelectionButton.setToolTipText("Highlight selection");
819
+ flashSelectionButton.addActionListener(this);
566820
567
- oe.treePanel.add(commandsPanel);
568
- oe.treePanel.Return();
821
+ editCommandsPanel.preferredHeight = 1;
822
+
823
+ SetPinStates(false);
824
+// oe.treePanel.add(commandsPanel);
825
+// oe.treePanel.Return();
569826
570827 // oe.aConstraints.gridx += 1;
571828 // oe.aConstraints.weighty = 0;
....@@ -582,29 +839,17 @@
582839
583840 JScrollPane jSP;
584841 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
585
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
842
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
586843 ResetModel();
587844
588845 oe.treePanel.add(jSPPanel);
589846 oe.treePanel.Return();
590847
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;
606848 oe.treePanel.add(copyOptionsPanel);
607849 oe.treePanel.Return();
850
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
851
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852
+ sliderPane.preferredHeight = 1;
608853
609854 // mainPanel.setDividerLocation(0.5); //1.0);
610855 // mainPanel.setResizeWeight(0.5);
....@@ -627,29 +872,49 @@
627872 dgr.addDragGestureListener(this);
628873 }catch(Exception e) {}
629874 */
630
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
631876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
632877 }
633878
634879 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
635880 {
881
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
882
+ colorCB.setToolTipText("Copy color when dropped");
883
+ colorCB.addItemListener(this);
884
+
885
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
886
+ materialCB.setToolTipText("Copy material when dropped");
887
+ materialCB.addItemListener(this);
888
+
889
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
890
+ textureCB.setToolTipText("Copy texture when dropped");
891
+ textureCB.addItemListener(this);
892
+
893
+ panel.Return();
894
+
636895 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
637896 boxCB.setToolTipText("Display bounding boxes");
638897 boxCB.addItemListener(this);
639898
640899 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
641
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
900
+ zoomBoxCB.setToolTipText("Display only for wheel");
642901 zoomBoxCB.addItemListener(this);
643902
644
- if (Globals.ADVANCED)
903
+ if (true) // Globals.ADVANCED)
645904 {
646
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
647
- supportCB.setToolTipText("Enable rigging");
648
- supportCB.addItemListener(this);
905
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
906
+// supportCB.setToolTipText("Enable rigging");
907
+// supportCB.addItemListener(this);
908
+
909
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
910
+ freezeCB.setToolTipText("Fast moving camera");
911
+ freezeCB.addItemListener(this);
649912
650913 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
651914 // localCB.addItemListener(this);
652915
916
+ panel.Return();
917
+
653918 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
654919 crowdCB.setToolTipText("Used for crowds");
655920 crowdCB.addItemListener(this);
....@@ -666,6 +931,8 @@
666931 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
667932 // speakerMocapCB.addItemListener(this);
668933
934
+ panel.Return();
935
+
669936 if (false)
670937 {
671938 // handled in scripts
....@@ -680,42 +947,85 @@
680947 //constraints.gridy += 1;
681948 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
682949 smoothfocusCB.addItemListener(this);
950
+ panel.Return();
683951 }
684952
685953 //constraints.gridx += 1;
686954 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
687955 // debugCB.addItemListener(this);
688956
957
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
958
+ trackCB.setToolTipText("Enable tracking target");
959
+ trackCB.addItemListener(this);
960
+
689961 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
962
+ oeilCB.setToolTipText("Move camera when tracking");
690963 oeilCB.addItemListener(this);
691964
965
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
966
+ shadowCB.setToolTipText("When live compute shadows");
967
+ shadowCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
971
+ toggleTextureCB.setToolTipText("Load textures");
972
+ toggleTextureCB.addItemListener(this);
973
+
974
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
975
+ toggleSwitchCB.setToolTipText("Choose a single item");
976
+ toggleSwitchCB.addItemListener(this);
977
+
978
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
979
+ autokeepCB.setToolTipText("On structure change");
980
+ autokeepCB.addItemListener(this);
981
+
982
+ panel.Return();
983
+ if (Globals.ADVANCED)
984
+ {
692985 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
693986 lookAtCB.setToolTipText("Look-at target");
694987 lookAtCB.addItemListener(this);
988
+ }
695989
696990 }
697991
698992 cGridBag fill = new cGridBag();
699
-
700993 fill.preferredHeight = 200;
994
+ cGridBag fill2 = new cGridBag();
995
+ fill2.preferredHeight = 200;
996
+ cGridBag fill3 = new cGridBag();
997
+ fill3.preferredHeight = 200;
701998
702999 panel.add(fill);
1000
+ panel.add(fill2);
1001
+ panel.add(fill3);
7031002
7041003 }
7051004
7061005 void EditObject(Object3D obj)
7071006 {
7081007 cRadio radioButton = new cRadio(obj.name);
1008
+
1009
+ // June 2019. Patch to avoid bug with transparency.
1010
+ radioButton.hadMaterial = obj.material != null;
1011
+ if (!radioButton.hadMaterial)
1012
+ {
1013
+ obj.material = new cMaterial();
1014
+ }
1015
+
7091016 radioButton.SetObject(obj);
710
- radioButton.layout = sevenButton;
1017
+ radioButton.layout = sixButton; // sevenButton;
7111018 radioButton.SetCamera(cameraView.renderCamera, false);
7121019 radioButton.addActionListener(this);
7131020 radioPanel.add(radioButton);
7141021 buttonGroup.add(radioButton);
7151022 radioButton.doClick();
7161023 }
1024
+
7171025 void SetupViews(ObjEditor oe)
7181026 {
1027
+ theFrame = this;
1028
+
7191029 oe.SetupViews();
7201030
7211031 System.out.println("SetupViews");
....@@ -724,23 +1034,28 @@
7241034 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7251035 }
7261036
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;
1037
+ cToggleButton liveCB;
1038
+ cCheckBox supportCB;
1039
+ cCheckBox localCB;
1040
+ cCheckBox crowdCB;
1041
+ cCheckBox smoothCB;
1042
+ cToggleButton fastCB;
1043
+ cCheckBox slowCB;
1044
+ cCheckBox boxCB;
1045
+ cCheckBox zoomBoxCB;
1046
+ cCheckBox freezeCB;
1047
+ //cToggleButton trackCB;
1048
+ cCheckBox trackCB;
1049
+ cCheckBox smoothfocusCB;
7381050 // JCheckBox speakerMocapCB;
739
- JCheckBox speakerCameraCB;
740
- JCheckBox speakerFocusCB;
741
- JCheckBox debugCB;
742
- JCheckBox oeilCB;
743
- JCheckBox lookAtCB;
1051
+ cCheckBox speakerCameraCB;
1052
+ cCheckBox speakerFocusCB;
1053
+ cCheckBox debugCB;
1054
+
1055
+ cCheckBox oeilCB;
1056
+ cCheckBox shadowCB;
1057
+ cCheckBox autokeepCB;
1058
+ cCheckBox lookAtCB;
7441059
7451060 // static int COLOR = 1;
7461061 // static int MATERIAL = 2;
....@@ -748,9 +1063,9 @@
7481063
7491064 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7501065
751
- JCheckBox colorCB;
752
- JCheckBox materialCB;
753
- JCheckBox textureCB;
1066
+ cCheckBox colorCB;
1067
+ cCheckBox materialCB;
1068
+ cCheckBox textureCB;
7541069
7551070 public void itemStateChanged(ItemEvent e)
7561071 {
....@@ -778,6 +1093,7 @@
7781093 } else if(e.getSource() == liveCB)
7791094 {
7801095 cameraView.ToggleLive();
1096
+ refreshContents(false);
7811097 }
7821098 else if(e.getSource() == supportCB)
7831099 {
....@@ -842,6 +1158,18 @@
8421158 {
8431159 cameraView.ToggleOeil();
8441160 }
1161
+ else if(e.getSource() == shadowCB)
1162
+ {
1163
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1164
+ }
1165
+ else if(e.getSource() == freezeCB)
1166
+ {
1167
+ Globals.FREEZEONMOVE ^= true;
1168
+ }
1169
+ else if(e.getSource() == autokeepCB)
1170
+ {
1171
+ Globals.REPLACEONMAKE ^= true;
1172
+ }
8451173 else if(e.getSource() == lookAtCB)
8461174 {
8471175 cameraView.ToggleLookAt();
....@@ -858,7 +1186,8 @@
8581186
8591187 /**/
8601188 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
861
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1190
+ TreePath path = objEditor.jTree.getSelectionPath();
8621191 if ((path == null) || (path.getPathCount() <= 1)) {
8631192 // We can't move the root node or an empty selection
8641193 return;
....@@ -921,8 +1250,6 @@
9211250 }
9221251 }
9231252
924
- String string = (String) object;
925
-
9261253 System.out.println("Transfer = " + object + "; drop : " + target);
9271254 // if( object instanceof java.io.File[])
9281255 // {
....@@ -930,7 +1257,11 @@
9301257 // objEditor.DropFile((java.io.File[]) object, true);
9311258 // return;
9321259 // }
933
- if (string.charAt(0) == '/')
1260
+
1261
+ String string = object.toString();
1262
+
1263
+ // File path for Mac and Windows
1264
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9341265 {
9351266 // file(s)
9361267 String[] names = string.split("\n");
....@@ -957,7 +1288,7 @@
9571288
9581289 flashIt = false;
9591290 CameraPane pane = (CameraPane) target;
960
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1291
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9611292 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9621293
9631294 if (group.selection.size() == 1)
....@@ -973,23 +1304,33 @@
9731304
9741305 assert target == objEditor.jTree;
9751306 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1307
+ Object3D destinationLeaf;
9761308 try {
977
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1309
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9781310 } catch (Exception e) {
9791311 System.out.println("destinationPath : " + destinationPath);
9801312 return;
9811313 }
9821314
983
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1315
+ for (int i=group.selection.size(); --i>=0;)
9841316 {
1317
+ Object3D child = (Object3D)group.selection.elementAt(i);
1318
+
1319
+ // Cannot move into itself
1320
+ if (child == destinationLeaf)
1321
+ return;
1322
+ }
1323
+
1324
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1325
+// {
9851326 loadClipboard(true);
9861327 objEditor.jTree.setSelectionPath(destinationPath);
9871328 pasteInto(false, false);
988
- } else {
989
- loadClipboard(false);
990
- objEditor.jTree.setSelectionPath(destinationPath);
991
- pasteInto(false, false); // true); // ???
992
- }
1329
+// } else {
1330
+// loadClipboard(false);
1331
+// objEditor.jTree.setSelectionPath(destinationPath);
1332
+// pasteInto(false, false); // true); // ???
1333
+// }
9931334 }
9941335 public void dropActionChanged(DropTargetDragEvent dtde)
9951336 // Called if the user has modified the current drop gesture
....@@ -1094,22 +1435,30 @@
10941435 {
10951436 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10961437 //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);
1438
+// gridItem = menu.add(new MenuItem("Grid"));
1439
+// gridItem.addActionListener(this);
1440
+// rectoidItem = menu.add(new MenuItem("Box"));
1441
+// rectoidItem.addActionListener(this);
1442
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1443
+// ellipsoidItem.addActionListener(this);
1444
+// coneItem = menu.add(new MenuItem("Cone"));
1445
+// coneItem.addActionListener(this);
1446
+// torusItem = menu.add(new MenuItem("Torus"));
1447
+// torusItem.addActionListener(this);
1448
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1449
+// superItem.addActionListener(this);
1450
+
1451
+ cameraItem = menu.add(new MenuItem("Camera"));
1452
+ cameraItem.addActionListener(this);
1453
+
1454
+ if (!Globals.ADVANCED)
1455
+ {
11091456 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11101457 kleinItem.addActionListener(this);
1111
- particleItem = menu.add(new MenuItem("Particle system"));
1112
- particleItem.addActionListener(this);
1458
+ }
1459
+
1460
+// particleItem = menu.add(new MenuItem("Particle system"));
1461
+// particleItem.addActionListener(this);
11131462 if (Globals.ADVANCED)
11141463 {
11151464 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1135,15 +1484,15 @@
11351484 }
11361485 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11371486 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);
1487
+// overlayItem = menu.add(new MenuItem("Overlay"));
1488
+// overlayItem.addActionListener(this);
1489
+// lightItem = menu.add(new MenuItem("Light"));
1490
+// lightItem.addActionListener(this);
11421491 menu.add("-");
11431492 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11441493 //superLoopItem.addActionListener(this);
1145
- loopItem = menu.add(new MenuItem("Loop"));
1146
- loopItem.addActionListener(this);
1494
+// loopItem = menu.add(new MenuItem("Loop"));
1495
+// loopItem.addActionListener(this);
11471496 doubleItem = menu.add(new MenuItem("Fork"));
11481497 doubleItem.addActionListener(this);
11491498 if (Globals.ADVANCED)
....@@ -1159,18 +1508,23 @@
11591508 animationItem.addItemListener(this);
11601509 animationItem.setState(Globals.ANIMATION);
11611510
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
1513
+
11621514 menu.add("-");
11631515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11641516 parseverticesItem.addActionListener(this);
11651517 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11661518 textureFieldItem.addActionListener(this);
1167
- alignItem = menu.add(new MenuItem("Align Object"));
1519
+ alignItem = menu.add(new MenuItem("Align Objects"));
11681520 alignItem.addActionListener(this);
11691521 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11701522 reduceMorphItem.addActionListener(this);
11711523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11721524 reduce34MorphItem.addActionListener(this);
1173
-
1525
+ menu.add("-");
1526
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1527
+ memoryItem.addActionListener(this);
11741528 menu.add(computeAOItem = new MenuItem("Compute AO"));
11751529 computeAOItem.addActionListener(this);
11761530
....@@ -1179,11 +1533,9 @@
11791533 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11801534 mirrorItem.addActionListener(this);
11811535 menu.add("-");
1182
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1183
- memoryItem.addActionListener(this);
11841536 menu.add(analyzeItem = new MenuItem("Analyze"));
11851537 analyzeItem.addActionListener(this);
1186
- menu.add(dumpItem = new MenuItem("Dump"));
1538
+ menu.add(dumpItem = new MenuItem("Print"));
11871539 dumpItem.addActionListener(this);
11881540 // menu.add(pathItem = new MenuItem("From-to path"));
11891541 // pathItem.addActionListener(this);
....@@ -1324,9 +1676,34 @@
13241676 shadow.material = new cMaterial(obj.material);
13251677 shadow.material.diffuse = 0.0001f;
13261678 shadow.material.specular = 0.0001f;
1679
+ //shadow.projectedVertices[1].x = 300;
13271680
13281681 makeSomething(shadow);
13291682 }
1683
+
1684
+ private void ClearUnpinned()
1685
+ {
1686
+ //for (Object3D obj : listUI)
1687
+ for (int i=listUI.size(); --i>=0;)
1688
+ {
1689
+ Object3D obj = listUI.elementAt(i);
1690
+ if (!obj.pinned)
1691
+ {
1692
+ obj.CloseUI();
1693
+ listUI.remove(i);
1694
+ }
1695
+ }
1696
+ }
1697
+
1698
+ private void EditElement(Object3D elem, boolean newWindow)
1699
+ {
1700
+ // if (!(elem instanceof Composite))
1701
+ // newWindow = false;
1702
+ listUI.add(elem);
1703
+ elem.openEditWindow(this, newWindow); //, false);
1704
+ System.out.println("edit : " + elem);
1705
+ elem.editWindow.refreshContents(true); // ? new
1706
+ }
13301707
13311708 /**
13321709 * applyExample
....@@ -1530,9 +1907,9 @@
15301907
15311908 void Overwrite(int mask)
15321909 {
1533
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1910
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15341911 {
1535
- Object3D content = GrafreeD.clipboard.get(0);
1912
+ Object3D content = Grafreed.clipboard.get(0);
15361913
15371914 if (content instanceof cGroup && ((cGroup)content).transientlink )
15381915 content = ((cGroup)content).get(0);
....@@ -1571,7 +1948,7 @@
15711948 {
15721949 ScreenFit();
15731950 } else
1574
- if (source == switchItem)
1951
+ if (source == switchViewItem)
15751952 {
15761953 cVector v1 = new cVector();
15771954 cVector v2 = new cVector();
....@@ -1580,11 +1957,11 @@
15801957 objEditor.cameraView.renderCamera.setAim(v2, v1);
15811958 objEditor.cameraView.repaint();
15821959 } else
1583
- if (source == rectoidItem)
1960
+ if (source == rectoidItem || source == boxButton)
15841961 {
15851962 makeSomething(new Box());
15861963 } else
1587
- if (source == particleItem)
1964
+ if (source == particleItem || source == particlesButton)
15881965 {
15891966 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15901967 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1663,27 +2040,27 @@
16632040
16642041 makeSomething(obj);
16652042 } else
1666
- if (source == gridItem)
2043
+ if (source == gridItem || source == gridButton)
16672044 {
16682045 makeSomething(new Grid());
16692046 } else
1670
- if (source == ellipsoidItem)
2047
+ if (source == ellipsoidItem || source == sphereButton)
16712048 {
16722049 makeSomething(new Sphere());
16732050 } else
1674
- if (source == coneItem)
2051
+ if (source == coneItem || source == coneButton)
16752052 {
16762053 makeSomething(new Cone());
16772054 } else
1678
- if (source == torusItem)
2055
+ if (source == torusItem || source == torusButton)
16792056 {
16802057 makeSomething(new Torus());
16812058 } else
1682
- if (source == superItem)
2059
+ if (source == superItem || source == superButton)
16832060 {
16842061 makeSomething(new Superellipsoid());
16852062 } else
1686
- if (source == kleinItem)
2063
+ if (source == kleinItem || source == kleinButton)
16872064 {
16882065 makeSomething(new Klein());
16892066 } else
....@@ -1703,7 +2080,7 @@
17032080 {
17042081 makeSomething(new BezierSurface());
17052082 } else
1706
- if (source == overlayItem)
2083
+ if (source == overlayItem || source == overlayButton)
17072084 {
17082085 /*
17092086 Object3D obj = new BezierSurface(5,8);
....@@ -1751,7 +2128,7 @@
17512128 s.setup();
17522129 makeSomething(s);
17532130 } else
1754
- if (source == lightItem)
2131
+ if (source == lightItem || source == lightButton)
17552132 {
17562133 makeSomething(new Light());
17572134 } else
....@@ -1801,30 +2178,30 @@
18012178
18022179 group(g);
18032180 } else
1804
- if (source == loopItem)
2181
+ if (source == loopItem || source == loopButton)
18052182 {
18062183 Composite csg = new GroupLeaf();
18072184 csg.count = 5;
18082185 group(csg);
1809
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
18102187 csg.addChild(child);
18112188 child.addChild(csg);
18122189 } else
18132190 if (source == doubleItem)
18142191 {
1815
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
18162193 csg.count = 5;
18172194 group(csg);
1818
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
18192196 csg.addChild(child);
18202197 child.addChild(csg);
1821
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
18222199 csg.addChild(child);
18232200 child.addChild(csg);
18242201 } else
18252202 if (source == tripleItem)
18262203 {
1827
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
18282205 csg.count = 4;
18292206 group(csg);
18302207 Composite child = new cGroup();
....@@ -1836,23 +2213,6 @@
18362213 child = new cGroup();
18372214 csg.addChild(child);
18382215 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");
18562216 } else
18572217 if (source == computeAOItem)
18582218 {
....@@ -1872,7 +2232,7 @@
18722232 if (source == invariantsItem)
18732233 {
18742234 System.out.println("Invariants:");
1875
- GrafreeD.grafreeD.universe.invariants();
2235
+ Grafreed.grafreeD.universe.invariants();
18762236 } else
18772237 if (source == memoryItem)
18782238 {
....@@ -1891,6 +2251,46 @@
18912251 {
18922252 DumpObject();
18932253 } else
2254
+ if (source == minButton)
2255
+ {
2256
+ Minimize();
2257
+ } else
2258
+ if (source == maxButton)
2259
+ {
2260
+ Maximize();
2261
+ } else
2262
+ if (source == fullButton)
2263
+ {
2264
+ ToggleFullScreen();
2265
+ } else
2266
+ if (source == undoButton)
2267
+ {
2268
+ // Go to previous version
2269
+ //if (!Undo())
2270
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2271
+ Undo();
2272
+ } else
2273
+ if (source == restoreButton)
2274
+ {
2275
+ // Restore current version
2276
+ Restore();
2277
+ } else
2278
+ if (source == replaceButton)
2279
+ {
2280
+ // Overwrite current version
2281
+ Replace();
2282
+ } else
2283
+ if (source == redoButton)
2284
+ {
2285
+ // Go to next version
2286
+ Redo();
2287
+ } else
2288
+ if (source == saveButton)
2289
+ {
2290
+ // Save a new version
2291
+ if (!Save(true))
2292
+ java.awt.Toolkit.getDefaultToolkit().beep();
2293
+ } else
18942294 if (source == oneStepButton)
18952295 {
18962296 Globals.ONESTEP = true;
....@@ -1898,17 +2298,14 @@
18982298 } else
18992299 if (source == screenfitButton)
19002300 {
1901
- //Reload(lastConverter, lastFilename, true);
19022301 ScreenFit();
19032302 } else
19042303 if (source == screenfitpointButton)
19052304 {
1906
- //Reload(lastConverter, lastFilename, true);
19072305 ScreenFitPoint();
19082306 } else
19092307 if (source == snapobjectButton)
19102308 {
1911
- //Reload(lastConverter, lastFilename, true);
19122309 SnapObject();
19132310 } else
19142311 // if (event.getSource() == recompileButton)
....@@ -1945,12 +2342,20 @@
19452342 {
19462343 loadClipboard(true);
19472344 } else
2345
+ if (source == undoItem)
2346
+ {
2347
+ Undo();
2348
+ } else
2349
+ if (source == redoItem)
2350
+ {
2351
+ Redo();
2352
+ } else
19482353 if (source == duplicateItem)
19492354 {
1950
- Object3D keep = GrafreeD.clipboard;
2355
+ Object3D keep = Grafreed.clipboard;
19512356 loadClipboard(false);
19522357 paste(false);
1953
- GrafreeD.clipboard = keep;
2358
+ Grafreed.clipboard = keep;
19542359 } else
19552360 if (source == cloneItem)
19562361 {
....@@ -2170,9 +2575,9 @@
21702575 // group.selection.get(0).setMasterThis(content); // should be identity
21712576 // refreshContents();
21722577 // }
2173
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2578
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21742579 {
2175
- Object3D content = GrafreeD.clipboard.get(0);
2580
+ Object3D content = Grafreed.clipboard.get(0);
21762581
21772582 if (content instanceof cGroup && ((cGroup)content).transientlink )
21782583 content = ((cGroup)content).get(0);
....@@ -2222,9 +2627,9 @@
22222627 } else
22232628 if (source == setMasterItem)
22242629 {
2225
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2630
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22262631 {
2227
- Object3D content = GrafreeD.clipboard.get(0);
2632
+ Object3D content = Grafreed.clipboard.get(0);
22282633
22292634 if (content instanceof cGroup && ((cGroup)content).transientlink )
22302635 content = ((cGroup)content).get(0);
....@@ -2237,9 +2642,9 @@
22372642 {
22382643 if (group.selection.size() == 1)
22392644 {
2240
- if (GrafreeD.clipboard.size() == 1)
2645
+ if (Grafreed.clipboard.size() == 1)
22412646 {
2242
- Object3D content = GrafreeD.clipboard.get(0);
2647
+ Object3D content = Grafreed.clipboard.get(0);
22432648
22442649 if (content instanceof cGroup && ((cGroup)content).transientlink )
22452650 content = ((cGroup)content).get(0);
....@@ -2256,7 +2661,7 @@
22562661 {
22572662 RevertMeshes();
22582663 } else
2259
- if (source == resetMeshItem)
2664
+ if (source == resetAllItem)
22602665 {
22612666 ResetAll();
22622667 } else
....@@ -2264,7 +2669,7 @@
22642669 {
22652670 StepAll();
22662671 } else
2267
- if (source == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
22682673 {
22692674 //int indices[] = jList.getSelectedIndices();
22702675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2276,9 +2681,9 @@
22762681 {
22772682 ClearSelection(true);
22782683 } else
2279
- if (source == grabItem)
2684
+ if (source == grabItem || source == groupButton)
22802685 {
2281
- group(new cGroup(), true);
2686
+ group(new cGroup(), false); // true);
22822687 } else
22832688 if (source == hideItem)
22842689 {
....@@ -2296,11 +2701,11 @@
22962701 {
22972702 makeSomething(new Camera());
22982703 } else
2299
- if (source == compositeItem)
2704
+ if (source == compositeItem || source == compositeButton)
23002705 {
23012706 group(new Composite());
23022707 } else
2303
- if (source == randomItem)
2708
+ if (source == switchItem || source == switchButton)
23042709 {
23052710 RandomNode random = new RandomNode();
23062711 group(random);
....@@ -2402,7 +2807,7 @@
24022807 {
24032808 group(new cLinker());
24042809 } else
2405
- if (source == textureItem)
2810
+ if (source == textureItem || source == textureButton)
24062811 {
24072812 group(new TextureNode());
24082813 } else
....@@ -2422,17 +2827,30 @@
24222827 {
24232828 CastShadow(2);
24242829 } else
2425
- if (source == ungroupItem)
2830
+ if (source == ungroupItem || source == ungroupButton)
24262831 {
2427
- //ungroup();
2832
+ boolean hasRoot = false;
2833
+
24282834 for (int i=0; i<group.selection.size(); i++)
24292835 {
2430
- Ungroup(group.selection.get(i));
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
24312841 }
24322842
2433
- ClearSelection(false);
2434
-
2435
- refreshContents();
2843
+ if (!hasRoot)
2844
+ {
2845
+ for (int i=0; i<group.selection.size(); i++)
2846
+ {
2847
+ Ungroup(group.selection.get(i));
2848
+ }
2849
+
2850
+ ClearSelection(false);
2851
+
2852
+ refreshContents();
2853
+ }
24362854 } else
24372855 if (source == genUVItem)
24382856 {
....@@ -2444,7 +2862,7 @@
24442862 } else
24452863 if (source == genNormalsMESHItem)
24462864 {
2447
- GenNormals(true); // TODO
2865
+ GenNormalsMESH();
24482866 } else
24492867 if (source == genNormalsORGANItem)
24502868 {
....@@ -2509,6 +2927,22 @@
25092927 if (source == unmarkleavesItem)
25102928 {
25112929 MarkLeaves(false);
2930
+ } else
2931
+ if (source == rewindleavesItem)
2932
+ {
2933
+ RewindLeaves(true);
2934
+ } else
2935
+ if (source == unrewindleavesItem)
2936
+ {
2937
+ RewindLeaves(false);
2938
+ } else
2939
+ if (source == randomleavesItem)
2940
+ {
2941
+ RandomLeaves(true);
2942
+ } else
2943
+ if (source == unrandomleavesItem)
2944
+ {
2945
+ RandomLeaves(false);
25122946 } else
25132947 if (source == flipVItem)
25142948 {
....@@ -2594,9 +3028,13 @@
25943028 {
25953029 SmoothMesh();
25963030 } else
2597
- if (source == transformgeometryItem)
3031
+ if (source == transformGeometryItem)
25983032 {
25993033 TransformGeometry();
3034
+ } else
3035
+ if (source == transformChildrenItem)
3036
+ {
3037
+ TransformChildren();
26003038 } else
26013039 if (source == resetTransformItem)
26023040 {
....@@ -2604,7 +3042,11 @@
26043042 } else
26053043 if (source == resetCentroidItem)
26063044 {
2607
- ResetCentroid();
3045
+ ResetCentroid(true);
3046
+ } else
3047
+ if (source == resetCentroidXZItem)
3048
+ {
3049
+ ResetCentroid(false);
26083050 } else
26093051 if (source == resetParentItem)
26103052 {
....@@ -2736,6 +3178,10 @@
27363178 if (source == twoButton)
27373179 {
27383180 radio.layout = twoButton;
3181
+
3182
+ if (CameraPane.FULLSCREEN)
3183
+ fullscreenLayout = radio.layout;
3184
+
27393185 // bug
27403186 //gridPanel.setDividerLocation(1.0);
27413187 //bigPanel.setDividerLocation(0.0);
....@@ -2768,10 +3214,31 @@
27683214 bigThree.ClearUI();
27693215 bigThree.add(centralPanel);
27703216 bigThree.FlushUI();
3217
+
3218
+ cameraView.requestFocusInWindow();
3219
+
3220
+// refreshContents(true);
3221
+//
3222
+// try
3223
+// {
3224
+// java.awt.Robot bot = new java.awt.Robot();
3225
+// int mask = InputEvent.BUTTON1_MASK;
3226
+// bot.mouseMove(100, 100);
3227
+// bot.mousePress(mask);
3228
+// bot.mouseRelease(mask);
3229
+// }
3230
+// catch (Exception e)
3231
+// {
3232
+//
3233
+// }
3234
+
27713235 } else
27723236 if (source == threeButton)
27733237 {
27743238 radio.layout = threeButton;
3239
+
3240
+ if (CameraPane.FULLSCREEN)
3241
+ fullscreenLayout = radio.layout;
27753242
27763243 // bigThree.remove(scenePanel);
27773244 // bigThree.remove(centralPanel);
....@@ -2804,10 +3271,15 @@
28043271 bigThree.add(centralPanel);
28053272 bigThree.add(XYZPanel);
28063273 bigThree.FlushUI();
3274
+
3275
+ cameraView.requestFocusInWindow();
28073276 } else
28083277 if (source == fourButton)
28093278 {
28103279 radio.layout = fourButton;
3280
+
3281
+ if (CameraPane.FULLSCREEN)
3282
+ fullscreenLayout = radio.layout;
28113283
28123284 // bigThree.remove(scenePanel);
28133285 // bigThree.remove(centralPanel);
....@@ -2839,10 +3311,15 @@
28393311 bigThree.ClearUI();
28403312 bigThree.add(scenePanel);
28413313 bigThree.FlushUI();
3314
+
3315
+ cameraView.requestFocusInWindow();
28423316 } else
28433317 if (source == sixButton)
28443318 {
28453319 radio.layout = sixButton;
3320
+
3321
+ if (CameraPane.FULLSCREEN)
3322
+ fullscreenLayout = radio.layout;
28463323
28473324 // bigThree.remove(scenePanel);
28483325 // bigThree.remove(centralPanel);
....@@ -2875,10 +3352,15 @@
28753352 bigThree.add(scenePanel);
28763353 bigThree.add(centralPanel);
28773354 bigThree.FlushUI();
3355
+
3356
+ cameraView.requestFocusInWindow();
28783357 } else
28793358 if (source == sevenButton)
28803359 {
28813360 radio.layout = sevenButton;
3361
+
3362
+ if (CameraPane.FULLSCREEN)
3363
+ fullscreenLayout = radio.layout;
28823364
28833365 // bigThree.remove(scenePanel);
28843366 // bigThree.remove(centralPanel);
....@@ -2912,6 +3394,8 @@
29123394 bigThree.add(centralPanel);
29133395 bigThree.add(XYZPanel);
29143396 bigThree.FlushUI();
3397
+
3398
+ cameraView.requestFocusInWindow();
29153399 } else
29163400 if (source == rootButton)
29173401 {
....@@ -2923,6 +3407,7 @@
29233407 EditObject(obj);
29243408 }
29253409
3410
+ cameraView.requestFocusInWindow();
29263411 refreshContents(true);
29273412 } else
29283413 if (source == closeButton)
....@@ -2932,22 +3417,37 @@
29323417 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29333418 {
29343419 ab = (cRadio)e.nextElement();
2935
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3420
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29363421 {
3422
+ // Patch to avoid bug with transparency.
3423
+ if (!ab.hadMaterial)
3424
+ {
3425
+ ab.object.material = null;
3426
+ }
3427
+
29373428 buttonGroup.remove(ab);
29383429 radioPanel.remove(ab);
29393430
2940
- ab.GetObject().editWindow = null;
3431
+ //ab.GetObject().editWindow = null;
3432
+ ab.GetObject().manipWindow = null;
29413433 // ab.GetObject().objectUI = null; // ?????????
29423434
29433435 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29443436 break;
29453437 }
29463438 }
3439
+
3440
+ cameraView.requestFocusInWindow();
29473441 refreshContents(true);
29483442 } else
29493443 if (source == editItem || source == editButton)
29503444 {
3445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3446
+ {
3447
+ Object3D child = (Object3D)e.nextElement();
3448
+ child.pinned = true;
3449
+ }
3450
+
29513451 EditSelection(false);
29523452 } else
29533453 if (source == uneditButton)
....@@ -2957,10 +3457,11 @@
29573457 Object3D child = (Object3D)e.nextElement();
29583458 if(child.editWindow != null)
29593459 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3460
+ child.pinned = false;
29603461 child.CloseUI();
29613462 listUI.remove(child);
29623463
2963
- child.editWindow = null; // ???????????
3464
+ //child.editWindow = null; // ???????????
29643465 }
29653466 objEditor.ctrlPanel.FlushUI();
29663467 //objEditor.jTree.clearSelection();
....@@ -2973,6 +3474,7 @@
29733474 //copy.ClearUI();
29743475 for (Object3D obj : listUI)
29753476 {
3477
+ obj.pinned = false;
29763478 obj.CloseUI();
29773479 }
29783480 listUI.clear();
....@@ -2982,7 +3484,7 @@
29823484 {
29833485 assert(copy == group);
29843486
2985
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3487
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29863488
29873489 for (Object3D obj : listUI)
29883490 {
....@@ -3031,6 +3533,9 @@
30313533 }
30323534
30333535 copy = group;
3536
+
3537
+ SetUndoStates();
3538
+
30343539 //Globals.theRenderer.object = group;
30353540 if(!useclient)
30363541 {
....@@ -3046,20 +3551,46 @@
30463551 frontView.object = group;
30473552 sideView.object = group;
30483553 }
3049
- group.editWindow = this;
3554
+
3555
+// fix "+" issue
3556
+ //group.editWindow = this;
3557
+ group.manipWindow = this;
3558
+
30503559 /*
30513560 currentLayout = radio.layout;
30523561 if (currentLayout == null)
30533562 currentLayout = sevenButton;
30543563 */
30553564 radio.layout.doClick();
3565
+
3566
+ ClearUnpinned();
3567
+ //Grafreed.Assert(group != null);
3568
+ //Grafreed.Assert(group.selection != null);
3569
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3570
+ if (group.selection == null || group.selection.size() == 1)
3571
+ EditSelection(false);
30563572 keepparent = group.parent;
30573573 // PARENT = NULL or not???
30583574 //group.parent = null; // ROOT
30593575 //group.attributes = -1;
30603576 ResetModel();
3577
+
3578
+ cameraView.requestFocusInWindow();
30613579 refreshContents(true);
3062
- }
3580
+ } else if (event.getSource() == editCameraItem)
3581
+ {
3582
+ cameraView.ProtectCamera();
3583
+ cameraView.repaint();
3584
+ return;
3585
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3586
+ {
3587
+ cameraView.RevertCamera();
3588
+ cameraView.repaint();
3589
+ return;
3590
+ // } else if (event.getSource() == textureButton)
3591
+ // {
3592
+ // return; // true;
3593
+ }
30633594 else
30643595 {
30653596 //return super.action(event, arg);
....@@ -3068,7 +3599,6 @@
30683599 }
30693600
30703601 boolean useclient = false;
3071
- cRadio radio;
30723602
30733603 void ToggleRoot()
30743604 {
....@@ -3120,6 +3650,28 @@
31203650 refreshContents();
31213651 }
31223652
3653
+ void TransformChildren()
3654
+ {
3655
+ Object3D obj;
3656
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3657
+ {
3658
+ obj = (Object3D)e.nextElement();
3659
+ obj.KeepTextureMatrices();
3660
+ obj.TransformChildren();
3661
+ obj.RestoreTextureMatrices();
3662
+
3663
+// if (obj.parent == null)
3664
+// {
3665
+// System.out.println("NULL PARENT!");
3666
+// new Exception().printStackTrace();
3667
+// }
3668
+// else
3669
+// TouchTransform(obj);
3670
+// //obj.parent.Touch();
3671
+ }
3672
+
3673
+ refreshContents();
3674
+ }
31233675
31243676 void ResetTransform()
31253677 {
....@@ -3232,7 +3784,7 @@
32323784 refreshContents();
32333785 }
32343786
3235
- void ResetCentroid()
3787
+ void ResetCentroid(boolean full)
32363788 {
32373789 Object3D obj;
32383790 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3247,12 +3799,16 @@
32473799 LA.matIdentity(Object3D.mat);
32483800 obj.getBounds(minima, maxima, false);
32493801 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3250
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3802
+ if (full)
3803
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32513804 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32523805 obj.TransformMesh(Object3D.mat);
3806
+
32533807 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3254
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3808
+ if (full)
3809
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32553810 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3811
+
32563812 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32573813 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32583814 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3281,7 +3837,8 @@
32813837
32823838 int size = obj.MemorySize();
32833839
3284
- System.err.println((size/1024) + " KB is the size of " + obj);
3840
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3841
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32853842 }
32863843 }
32873844 catch (Exception e)
....@@ -3318,9 +3875,9 @@
33183875 obj = (Object3D)e.nextElement();
33193876
33203877 System.out.println("Object is: " + obj);
3321
- GrafreeD.AnalyzeObject(obj);
3878
+ Grafreed.AnalyzeObject(obj);
33223879 System.out.println("Boundary rep: " + obj.bRep);
3323
- GrafreeD.AnalyzeObject(obj.bRep);
3880
+ Grafreed.AnalyzeObject(obj.bRep);
33243881
33253882 // System.err.println((size/1024) + " KB is the size of " + obj);
33263883 }
....@@ -3362,6 +3919,13 @@
33623919 void GenNormals(boolean crease)
33633920 {
33643921 group.GenNormalsS(crease);
3922
+
3923
+ refreshContents();
3924
+ }
3925
+
3926
+ void GenNormalsMESH()
3927
+ {
3928
+ group.GenNormalsMeshS();
33653929
33663930 refreshContents();
33673931 }
....@@ -3534,8 +4098,8 @@
35344098
35354099 void ParseVertices()
35364100 {
3537
- boolean epsequal = GrafreeD.epsequal;
3538
- GrafreeD.epsequal = true;
4101
+ boolean epsequal = Grafreed.epsequal;
4102
+ Grafreed.epsequal = true;
35394103
35404104 for (int i=0; i<group.selection.size(); i++)
35414105 {
....@@ -3560,7 +4124,7 @@
35604124 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35614125 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35624126
3563
- g.add(GrafreeD.clipboard);
4127
+ g.add(Grafreed.clipboard);
35644128
35654129 buffer.add(g);
35664130 }
....@@ -3575,7 +4139,7 @@
35754139 makeSomething(buffer, i==group.selection.size()-1);
35764140 }
35774141
3578
- GrafreeD.epsequal = epsequal;
4142
+ Grafreed.epsequal = epsequal;
35794143
35804144 refreshContents();
35814145 }
....@@ -3593,7 +4157,16 @@
35934157 String pigment = Object3D.GetPigment(tex);
35944158 //String bump = Object3D.GetBump(tex);
35954159
3596
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4160
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4161
+
4162
+ try
4163
+ {
4164
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4165
+ }
4166
+ catch (Exception e)
4167
+ {
4168
+ System.err.println("FAIL: " + node);
4169
+ }
35974170
35984171 double s = v.s;
35994172
....@@ -3725,7 +4298,7 @@
37254298 return;
37264299
37274300 Object3D poses = group.selection.get(0);
3728
- Object3D ref = GrafreeD.clipboard.get(0);
4301
+ Object3D ref = Grafreed.clipboard.get(0);
37294302
37304303 Object3D newgroup = new Object3D("Po:" + poses.name);
37314304
....@@ -3919,9 +4492,9 @@
39194492
39204493 void ClipMesh()
39214494 {
3922
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4495
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39234496 {
3924
- Object3D content = GrafreeD.clipboard.get(0);
4497
+ Object3D content = Grafreed.clipboard.get(0);
39254498
39264499 if (content instanceof cGroup && ((cGroup)content).transientlink )
39274500 content = ((cGroup)content).get(0);
....@@ -3930,7 +4503,7 @@
39304503 // {
39314504 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39324505 // }
3933
- group.selection.ClipMesh(GrafreeD.clipboard);
4506
+ group.selection.ClipMesh(Grafreed.clipboard);
39344507 }
39354508 // group.selection.ClipMesh(GrafreeD.clipboard);
39364509 System.out.println("DONE.");
....@@ -3977,6 +4550,18 @@
39774550 void MarkLeaves(boolean hide)
39784551 {
39794552 group.selection.MarkLeaves(hide);
4553
+ refreshContents();
4554
+ }
4555
+
4556
+ void RewindLeaves(boolean hide)
4557
+ {
4558
+ group.selection.RewindLeaves(hide);
4559
+ refreshContents();
4560
+ }
4561
+
4562
+ void RandomLeaves(boolean hide)
4563
+ {
4564
+ group.selection.RandomLeaves(hide);
39804565 refreshContents();
39814566 }
39824567
....@@ -4051,28 +4636,25 @@
40514636 // }
40524637 // }
40534638
4054
- static boolean allparams = true;
4055
-
4056
- static Vector<Object3D> listUI = new Vector<Object3D>();
4057
-
40584639 void EditSelection(boolean newWindow)
40594640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
40604647 // aConstraints.gridy = 0;
40614648 for (int i=0; i<group.selection.size(); i++)
40624649 {
40634650 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40644651 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4065
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4652
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40664653
40674654 Object3D elem = (Object3D)group.selection.elementAt(i);
4068
- if(elem != group)
4655
+ if(elem != group || !newWindow)
40694656 {
4070
- // if (!(elem instanceof Composite))
4071
- // newWindow = false;
4072
- listUI.add(elem);
4073
- elem.openEditWindow(this, newWindow); //, false);
4074
- System.out.println("edit : " + elem);
4075
- elem.editWindow.refreshContents(true); // ? new
4657
+ EditElement(elem, newWindow); // ? new
40764658 }
40774659 }
40784660 }
....@@ -4147,7 +4729,8 @@
41474729 //new Exception().printStackTrace();
41484730
41494731 freezemodel = true;
4150
-
4732
+ ClearUnpinned();
4733
+
41514734 /**/
41524735 //switch (event.id)
41534736 {
....@@ -4155,7 +4738,6 @@
41554738 //case 702: // Event.LIST_DESELECT
41564739 group.deselectAll();
41574740 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4158
- objEditor.ClearInfo(); // .GetMaterial());
41594741 if (tps != null)
41604742 {
41614743 for (int i=0; i < tps.length; i++)
....@@ -4164,10 +4746,8 @@
41644746
41654747 //if (child.parent != null)
41664748 //child.parent.addSelectee(child);
4749
+ objEditor.SetMaterial(child);
41674750 group.addSelectee(child);
4168
- objEditor.SetMaterial(child); // .GetMaterial());
4169
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4170
- System.err.println("info : " + child.GetPath());
41714751 }
41724752 }
41734753 // else
....@@ -4177,20 +4757,28 @@
41774757 // System.err.println("info : " + group.GetPath());
41784758 // }
41794759
4180
- objEditor.SetText(); // jan 2014
4181
-
4182
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4760
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41834761 CameraPane.flash = true;
41844762
4185
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4763
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41864764 // a camera
41874765 {
4188
- CameraPane.camerachangeframe = 0; // don't refuse it
4189
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4766
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4767
+ {
4768
+ CameraPane.camerachangeframe = 0; // don't refuse it
4769
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4770
+ }
41904771 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41914772 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41924773 }
41934774
4775
+ if (tps != null && tps.length == 1)
4776
+ {
4777
+ EditSelection(false);
4778
+ }
4779
+
4780
+ SetPinStates(tps != null && tps.length > 0);
4781
+
41944782 refreshContents();
41954783 //return true;
41964784 }
....@@ -4199,6 +4787,35 @@
41994787
42004788 freezemodel = false;
42014789 }
4790
+
4791
+ void SetPinStates(boolean enabled)
4792
+ {
4793
+ editButton.setEnabled(enabled);
4794
+ uneditButton.setEnabled(enabled);
4795
+ unselectButton.setEnabled(enabled);
4796
+ flashSelectionButton.setEnabled(enabled);
4797
+ }
4798
+
4799
+ void refreshContents(boolean cp)
4800
+ {
4801
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4802
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4803
+ {
4804
+ objEditor.ClearInfo(); // .GetMaterial());
4805
+
4806
+ for (int i=0; i < group.selection.Size(); i++)
4807
+ {
4808
+ Object3D child = (Object3D) group.selection.get(i);
4809
+
4810
+ objEditor.AddInfo(child, this, true);
4811
+ System.err.println("info : " + child.GetPath());
4812
+ }
4813
+
4814
+ objEditor.SetText(); // jan 2014
4815
+ }
4816
+
4817
+ super.refreshContents(cp);
4818
+ }
42024819
42034820 void linkSomething(Object3D thing)
42044821 {
....@@ -4270,16 +4887,19 @@
42704887 {
42714888 if (group.selection.isEmpty())
42724889 return;
4273
- GrafreeD.clipboardIsTempGroup = false;
4890
+
4891
+ Grafreed.clipboardIsTempGroup = false;
42744892 Composite tGroup = null;
42754893 if (group.selection.size() > 0) // 1)
42764894 {
42774895 tGroup = new cGroup();
4278
- GrafreeD.clipboardIsTempGroup = true;
4896
+ Grafreed.clipboardIsTempGroup = true;
42794897 }
42804898
42814899 if (cut)
42824900 {
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
42834903 //int indices[] = jList.getSelectedIndices();
42844904 //for (int i = indices.length - 1; i >= 0; i--)
42854905 //jList.remove(indices[i]);
....@@ -4315,16 +4935,16 @@
43154935 //System.out.println("cut " + child);
43164936 //System.out.println("parent = " + child.parent);
43174937 // tmp.addChild(child);
4318
- if (GrafreeD.clipboardIsTempGroup)
4938
+ if (Grafreed.clipboardIsTempGroup)
43194939 tGroup.add/*Child*/(tmp);
43204940 else
4321
- GrafreeD.clipboard = tmp;
4941
+ Grafreed.clipboard = tmp;
43224942 }
43234943 else
4324
- if (GrafreeD.clipboardIsTempGroup)
4944
+ if (Grafreed.clipboardIsTempGroup)
43254945 tGroup.add/*Child*/(child);
43264946 else
4327
- GrafreeD.clipboard = child;
4947
+ Grafreed.clipboard = child;
43284948 }
43294949
43304950 //ResetModel();
....@@ -4356,21 +4976,23 @@
43564976 //System.out.println("cut " + elem);
43574977 //System.out.println("parent = " + elem.parent);
43584978 // tmp.addChild(elem);
4359
- if (GrafreeD.clipboardIsTempGroup)
4979
+ if (Grafreed.clipboardIsTempGroup)
43604980 tGroup.add/*Child*/(tmp);
43614981 else
4362
- GrafreeD.clipboard = tmp;
4982
+ Grafreed.clipboard = tmp;
43634983 }
43644984 else
4365
- if (GrafreeD.clipboardIsTempGroup)
4985
+ if (Grafreed.clipboardIsTempGroup)
43664986 tGroup.add/*Child*/(child);
43674987 else
4368
- GrafreeD.clipboard = child;
4988
+ Grafreed.clipboard = child;
43694989 }
43704990
43714991 }
4372
- if (GrafreeD.clipboardIsTempGroup)
4373
- GrafreeD.clipboard = tGroup;
4992
+
4993
+ if (Grafreed.clipboardIsTempGroup)
4994
+ Grafreed.clipboard = tGroup;
4995
+
43744996 if (cut)
43754997 {
43764998 ResetModel();
....@@ -4380,11 +5002,15 @@
43805002
43815003 void paste(boolean expand)
43825004 {
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
43835009 // if (GrafreeD.clipboard == null)
43845010 // return;
43855011 boolean first = true;
43865012
4387
- if (GrafreeD.clipboardIsTempGroup)
5013
+ if (Grafreed.clipboardIsTempGroup)
43885014 {
43895015 Composite temp;
43905016
....@@ -4395,7 +5021,7 @@
43955021 temp = (Composite)Applet3D.clipboard.deepCopy();
43965022 */
43975023 Object3D elem;
4398
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5024
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43995025 {
44005026 Object3D child = (Object3D)e.nextElement();
44015027
....@@ -4429,16 +5055,17 @@
44295055 //Object3D cb = Applet3D.clipboard;
44305056 //temp.addChild(cb);
44315057 //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());
5058
+ assert(Grafreed.clipboard.parent == null);
5059
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5060
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5061
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5062
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44375063 else
4438
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4439
- GrafreeD.clipboard.get(0).parent = keepparent;
5064
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5065
+ Grafreed.clipboard.get(0).parent = keepparent;
44405066 }
44415067
5068
+ Globals.REPLACEONMAKE = keep;
44425069 ResetModel();
44435070 refreshContents();
44445071 }
....@@ -4485,9 +5112,9 @@
44855112 {
44865113 boolean first = true;
44875114
4488
- if (GrafreeD.clipboardIsTempGroup)
5115
+ if (Grafreed.clipboardIsTempGroup)
44895116 {
4490
- Composite temp = (Composite)GrafreeD.clipboard;
5117
+ Composite temp = (Composite)Grafreed.clipboard;
44915118 Object3D copy;
44925119 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44935120 {
....@@ -4497,7 +5124,7 @@
44975124 }
44985125 } else
44995126 {
4500
- linkSomething(GrafreeD.clipboard); //.get(0));
5127
+ linkSomething(Grafreed.clipboard); //.get(0));
45015128 }
45025129 }
45035130 }
....@@ -4574,6 +5201,10 @@
45745201
45755202 void group(Object3D csg, boolean grab)
45765203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
45775208 if (//false) // why??
45785209 !group.selection.isEmpty())
45795210 {
....@@ -4687,10 +5318,15 @@
46875318 //node.add(csg);
46885319 //makeSomething(node);
46895320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
46905322 }
46915323
46925324 void Ungroup(Object3D g)
46935325 {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
46945330 if (g instanceof HiddenObject)
46955331 {
46965332 HiddenObject h = (HiddenObject) g;
....@@ -4707,6 +5343,7 @@
47075343 objEditor.makeSomething(g.get(i), false);
47085344 }
47095345 }
5346
+ Globals.REPLACEONMAKE = keep;
47105347 }
47115348
47125349 void ungroup()
....@@ -4902,21 +5539,6 @@
49025539 }
49035540 */
49045541
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
-
49205542 /*
49215543 public void Callback(Object obj)
49225544 {
....@@ -4940,26 +5562,9 @@
49405562 }
49415563 */
49425564
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
-
49605565 String GetFile(String dialogName)
49615566 {
4962
- if (GrafreeD.standAlone)
5567
+ if (Grafreed.standAlone)
49635568 {
49645569 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49655570 browser.show();
....@@ -5027,7 +5632,28 @@
50275632 cButton clearpanelButton;
50285633 cButton unselectButton;
50295634
5635
+ cButton restoreCameraButton;
5636
+
5637
+ cButton saveButton;
50305638 cButton oneStepButton;
5639
+
5640
+ cButton groupButton;
5641
+ cButton ungroupButton;
5642
+ cButton compositeButton;
5643
+ cButton switchButton;
5644
+ cButton loopButton;
5645
+ cButton textureButton;
5646
+
5647
+ cButton gridButton;
5648
+ cButton boxButton;
5649
+ cButton sphereButton;
5650
+ cButton coneButton;
5651
+ cButton torusButton;
5652
+ cButton superButton;
5653
+ cButton kleinButton;
5654
+ cButton particlesButton;
5655
+ cButton overlayButton;
5656
+ cButton lightButton;
50315657
50325658 cButton screenfitButton;
50335659 cButton screenfitpointButton;
....@@ -5040,14 +5666,6 @@
50405666
50415667 cButton setsupportButton;
50425668
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
-
50515669 //
50525670 //Composite
50535671 Object3D // to do !!
....@@ -5057,9 +5675,11 @@
50575675 //JTree jTree;
50585676 private MenuItem lookAtItem;
50595677 private MenuItem lookFromItem;
5060
- private MenuItem switchItem;
5678
+ private MenuItem switchViewItem;
50615679 private MenuItem cutItem;
5062
- private MenuItem duplicateItem;
5680
+ private MenuItem undoItem;
5681
+ private MenuItem redoItem;
5682
+ private JMenuItem duplicateItem;
50635683 private MenuItem cloneItem;
50645684 private MenuItem cloneSupportItem;
50655685 private MenuItem overwriteGeoItem;
....@@ -5072,7 +5692,7 @@
50725692 private MenuItem linkverticesItem;
50735693 private MenuItem relinkverticesItem;
50745694 private MenuItem setMasterItem;
5075
- private MenuItem resetMeshItem;
5695
+ private MenuItem resetAllItem;
50765696 private MenuItem stepAllItem;
50775697 private MenuItem revertMeshItem;
50785698 private MenuItem poseMeshItem;
....@@ -5087,7 +5707,7 @@
50875707 private MenuItem pasteLinkItem;
50885708 private MenuItem pasteCloneItem;
50895709 private MenuItem pasteExpandItem;
5090
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
50915711 private MenuItem clearAllItem;
50925712 private MenuItem genUVItem;
50935713 private MenuItem genNormalsMESHItem;
....@@ -5122,6 +5742,10 @@
51225742 private MenuItem showleavesItem;
51235743 private MenuItem markleavesItem;
51245744 private MenuItem unmarkleavesItem;
5745
+ private MenuItem rewindleavesItem;
5746
+ private MenuItem unrewindleavesItem;
5747
+ private MenuItem randomleavesItem;
5748
+ private MenuItem unrandomleavesItem;
51255749
51265750 private MenuItem flipVItem;
51275751 private MenuItem unflipVItem;
....@@ -5133,15 +5757,17 @@
51335757 private MenuItem panoTexturesItem;
51345758
51355759 private MenuItem resetCentroidItem;
5136
- private MenuItem transformgeometryItem;
5760
+ private MenuItem resetCentroidXZItem;
51375761 private MenuItem resetTransformItem;
5762
+ private MenuItem transformGeometryItem;
5763
+ private MenuItem transformChildrenItem;
51385764 private MenuItem hideItem;
51395765 private MenuItem grabItem;
51405766 private MenuItem backItem;
51415767 private MenuItem frontItem;
51425768 private MenuItem cameraItem;
51435769 private MenuItem compositeItem;
5144
- private MenuItem randomItem;
5770
+ private MenuItem switchItem;
51455771 private MenuItem physicsItem;
51465772 private MenuItem frameselectorItem;
51475773 private MenuItem scriptNodeItem;
....@@ -5203,11 +5829,6 @@
52035829 private MenuItem doubleItem;
52045830 private MenuItem tripleItem;
52055831
5206
- private MenuItem importGFDItem;
5207
- private MenuItem importVRMLX3DItem;
5208
- private MenuItem import3DSItem;
5209
- private MenuItem importOBJItem;
5210
-
52115832 private MenuItem computeAOItem;
52125833 private MenuItem recompileItem;
52135834 private MenuItem editScriptItem;
....@@ -5217,4 +5838,8 @@
52175838 private MenuItem analyzeItem;
52185839 private MenuItem dumpItem;
52195840 //boolean freezemodel = false;
5841
+
5842
+ Menu cameraMenu;
5843
+ MenuItem editCameraItem;
5844
+ MenuItem restoreCameraItem;
52205845 }