Normand Briere
2019-07-17 a5580a47d246c1272b10adba68070f6e13da5e41
GroupEditor.java
....@@ -12,6 +12,7 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
1718 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
....@@ -73,7 +74,7 @@
7374 this.copy = this.group = copy;
7475 //selectees = this.group.selectees;
7576
76
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7778 SetupUI2(objEditor);
7879 objEditor.SetupUI(true);
7980 SetupViews(objEditor);
....@@ -83,6 +84,10 @@
8384
8485 void CloneSelection(boolean supports)
8586 {
87
+ if (Globals.REPLACEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.REPLACEONMAKE;
90
+ Globals.REPLACEONMAKE = false;
8691 // Object3D keep = GrafreeD.clipboard;
8792 //Object3D obj;
8893 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +98,19 @@
9398
9499 makeSomething(clone, i==group.selection.size()-1);
95100 }
101
+ Globals.REPLACEONMAKE = keep;
96102 }
97103
98104 void CloneClipboard(boolean supports)
99105 {
100
- assert(GrafreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
102
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
104
- 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));
105111 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
112
+ makeSomething(CloneObject(Grafreed.clipboard, false));
113
+ Grafreed.clipboard.get(0).parent = keepparent;
108114 }
109115
110116 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +124,7 @@
118124 // obj.support = null;
119125 if (!supports)
120126 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
127
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122128 obj.parent = parent;
123129 // obj.support = support;
124130 // clone.support = support; // aout 2013
....@@ -147,30 +153,29 @@
147153
148154 //JTextField nameField;
149155
150
- void SetupMenu2(ObjEditor oe)
156
+ void SetupMenu2(GroupEditor oe)
151157 {
152
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
155
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
156
- oe.cameraMenu.add("-");
157
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
158
- openWindowItem.addActionListener(this);
159
- editLeafItem.addActionListener(this);
160
- lookAtItem.addActionListener(this);
161
- //lookFromItem.addActinoListener(this);
162
- //switchItem.addActionListener(this);
158
+ oe.jTree = new cTree();
159
+
163160 Menu menu;
164161 oe.menuBar.add(menu = new Menu("Edit"));
165162 //editItem = menu.add(new MenuItem("Edit"));
166163 //editItem.addActionListener(this);
167
- 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"));
168171 duplicateItem.addActionListener(this);
169
- menu.add("-");
170172 cloneItem = menu.add(new MenuItem("Clone"));
171173 cloneItem.addActionListener(this);
174
+ if (Globals.ADVANCED)
175
+ {
172176 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173177 cloneSupportItem.addActionListener(this);
178
+ }
174179 menu.add("-");
175180 cutItem = menu.add(new MenuItem("Cut"));
176181 cutItem.addActionListener(this);
....@@ -178,27 +183,123 @@
178183 copyItem.addActionListener(this);
179184 pasteItem = menu.add(new MenuItem("Paste"));
180185 pasteItem.addActionListener(this);
186
+
187
+ menu.add("-");
188
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
189
+ pasteIntoItem.addActionListener(this);
181190 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182191 pasteLinkItem.addActionListener(this);
183192 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184193 pasteCloneItem.addActionListener(this);
185194 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186195 // pasteExpandItem.addActionListener(this);
196
+ menu.add("-");
187197 clearItem = menu.add(new MenuItem("Clear"));
188198 clearItem.addActionListener(this);
199
+
200
+ if (Globals.ADVANCED)
201
+ {
202
+ // Deletes the cameras...
189203 clearAllItem = menu.add(new MenuItem("Clear All"));
190204 clearAllItem.addActionListener(this);
205
+ }
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());
191242
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
+
192294 oe.menuBar.add(menu = new Menu("Setting"));
193
- resetMeshItem = menu.add(new MenuItem("Reset All"));
194
- resetMeshItem.addActionListener(this);
195
- stepAllItem = menu.add(new MenuItem("Step All"));
196
- stepAllItem.addActionListener(this);
295
+ if (Globals.ADVANCED)
296
+ {
197297 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198298 revertMeshItem.addActionListener(this);
199299 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200300 resetreferencesItem.addActionListener(this);
201301 menu.add("-");
302
+ }
202303 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203304 overwriteGeoItem.addActionListener(this);
204305 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,79 +311,104 @@
210311 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211312 overwriteUVItem.addActionListener(this);
212313 menu.add("-");
314
+ if (Globals.ADVANCED)
315
+ {
213316 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214317 generateMeshItem.addActionListener(this);
215318 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216319 poseMeshItem.addActionListener(this);
217320 menu.add("-");
321
+ }
218322 resetsupportItem = menu.add(new MenuItem("Reset support"));
219323 resetsupportItem.addActionListener(this);
220324 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221325 linkverticesItem.addActionListener(this);
222326 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223327 relinkverticesItem.addActionListener(this);
328
+
329
+ if (Globals.ADVANCED)
330
+ {
224331 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225332 setMasterItem.addActionListener(this);
333
+ }
226334
227335 oe.menuBar.add(menu = new Menu("Group"));
228
- grabItem = menu.add(new MenuItem("Grab"));
229
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
230338 backItem = menu.add(new MenuItem("Back"));
231339 backItem.addActionListener(this);
232340 frontItem = menu.add(new MenuItem("Front"));
233341 frontItem.addActionListener(this);
234
- compositeItem = menu.add(new MenuItem("Composite"));
235
- compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
344
+
345
+ if (Globals.ADVANCED)
346
+ {
347
+ hideItem = menu.add(new MenuItem("Hidden Group"));
237348 hideItem.addActionListener(this);
349
+ }
238350 ungroupItem = menu.add(new MenuItem("Ungroup"));
239351 ungroupItem.addActionListener(this);
240
- menu.add("-");
241
- randomItem = menu.add(new MenuItem("Random"));
242
- randomItem.addActionListener(this);
243
- physicsItem = menu.add(new MenuItem("Physics"));
244
- physicsItem.addActionListener(this);
245
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
246
- frameselectorItem.addActionListener(this);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
247359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248360 switchGeoItem.addActionListener(this);
249361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250362 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
363
+ morphItem = menu.add(new MenuItem("Morph Group"));
252364 morphItem.addActionListener(this);
365
+
366
+ menu.add("-");
367
+ physicsItem = menu.add(new MenuItem("Physics"));
368
+ physicsItem.addActionListener(this);
369
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
370
+ frameselectorItem.addActionListener(this);
253371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254372 scriptNodeItem.addActionListener(this);
255
- cameraItem = menu.add(new MenuItem("Camera"));
256
- cameraItem.addActionListener(this);
373
+ }
257374
258375 oe.menuBar.add(menu = new Menu("Object"));
259
- textureItem = menu.add(new MenuItem("Texture"));
260
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
261378 billboardItem = menu.add(new MenuItem("Billboard"));
262379 billboardItem.addActionListener(this);
263380 csgItem = menu.add(new MenuItem("CSG"));
264381 csgItem.addActionListener(this);
265
- shadowXItem = menu.add(new MenuItem("Shadow X"));
382
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
266383 shadowXItem.addActionListener(this);
267
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
384
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
268385 shadowYItem.addActionListener(this);
269
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
386
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
270387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
391
+ if (Globals.ADVANCED)
392
+ {
393
+ menu.add("-");
271394 linkerItem = menu.add(new MenuItem("Linker"));
272395 linkerItem.addActionListener(this);
273396 templateItem = menu.add(new MenuItem("Template"));
274397 templateItem.addActionListener(this);
275
- attributeItem = menu.add(new MenuItem("Attribute"));
276
- attributeItem.addActionListener(this);
277398 pointflowItem = menu.add(new MenuItem("Point Flow"));
278399 pointflowItem.addActionListener(this);
400
+ }
279401 menu.add("-");
280402 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281403 resetTransformItem.addActionListener(this);
282404 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283405 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- 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);
286412
287413 oe.menuBar.add(menu = new Menu("Geometry"));
288414 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +419,11 @@
293419 genNormalsCADItem.addActionListener(this);
294420 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295421 genNormalsMESHItem.addActionListener(this);
422
+ if (Globals.ADVANCED)
423
+ {
296424 genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
297425 genNormalsMINEItem.addActionListener(this);
426
+ }
298427 stripifyItem = menu.add(new MenuItem("Stripify"));
299428 stripifyItem.addActionListener(this);
300429 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +445,34 @@
316445 reduce34MeshItem.addActionListener(this);
317446 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318447 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321448 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322449 clipMeshItem.addActionListener(this);
450
+
451
+ if (Globals.ADVANCED)
452
+ {
453
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
454
+ smoothMeshItem.addActionListener(this);
455
+ }
323456
324457 oe.menuBar.add(menu = new Menu("Attributes"));
325458 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326459 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);
327464 menu.add("-");
328465 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329466 liveleavesItem.addActionListener(this);
330467 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331468 unliveleavesItem.addActionListener(this);
469
+ if (Globals.ADVANCED)
470
+ {
332471 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333472 supportleavesItem.addActionListener(this);
334473 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335474 unsupportleavesItem.addActionListener(this);
475
+ }
336476 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337477 hideleavesItem.addActionListener(this);
338478 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -341,6 +481,14 @@
341481 markleavesItem.addActionListener(this);
342482 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
343483 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);
344492 menu.add("-");
345493 flipVItem = menu.add(new MenuItem("Flip V"));
346494 flipVItem.addActionListener(this);
....@@ -376,35 +524,41 @@
376524 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377525 sortbynameItem.addActionListener(this);
378526 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);
531
+ if (Globals.ADVANCED)
532
+ {
533
+ // Pretty much the same as duplicate and clone.
379534 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380535 extractGeometriesItem.addActionListener(this);
381536 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382537 cloneGeometriesItem.addActionListener(this);
383
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
- shareGeometriesItem.addActionListener(this);
385
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
- mergeGeometriesItem.addActionListener(this);
538
+ }
387539
388540 oe.menuBar.add(menu = new Menu("Insert"));
389541 buildCreateMenu(menu);
390542
391
-
392
- oe.menuBar.add(menu = new Menu("Include"));
393
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
- importGFDItem.addActionListener(this);
395
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
- importVRMLX3DItem.addActionListener(this);
397
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
398
- importOBJItem.addActionListener(this);
399
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
- import3DSItem.addActionListener(this);
401
-
402543 oe.menuBar.add(menu = new Menu("Tools"));
403544 buildToolsMenu(menu);
404545 }
405546
547
+
406548 void SetupUI2(ObjEditor oe)
407549 {
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
+
408562 //new Exception().printStackTrace();
409563
410564 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -433,110 +587,230 @@
433587 oe.radioPanel.add(dummyButton);
434588 oe.buttonGroup.add(dummyButton);
435589 */
436
- aConstraints.gridy += 1;
590
+ cGridBag copyOptionsPanel = new cGridBag();
591
+
592
+ copyOptionsPanel.preferredHeight = 1;
437593
438594 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
439595
440
- oe.aConstraints.gridwidth = 1;
441
- oe.aConstraints.gridx = 0;
596
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ //minButton.setToolTipText("Minimize window");
598
+ //minButton.addActionListener(this);
442599
443
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
444
- liveCB.setToolTipText("Enabled animation");
445
- liveCB.addItemListener(this);
446
-
447
- oe.aConstraints.gridx += 1;
448
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
449
- trackCB.setToolTipText("Enable tracking");
450
- trackCB.addItemListener(this);
451
-
452
- oe.aConstraints.gridx += 1;
453
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
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);
454612 screenfitButton.setToolTipText("Screen fit");
455613 screenfitButton.addActionListener(this);
456
- oe.aConstraints.gridx += 1;
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");
648
+ liveCB.addItemListener(this);
649
+
650
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
651
+ oneStepButton.setToolTipText("Animate one step forward");
652
+ oneStepButton.addActionListener(this);
653
+
654
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
655
+ fastCB.setToolTipText("Fast mode");
656
+ fastCB.addItemListener(this);
657
+
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);
663
+
457664 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
458665 // screenfitpointButton.addActionListener(this);
459
-// oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
461
- snapobjectButton.addActionListener(this);
462
- snapobjectButton.setToolTipText("Snap Object");
463
- oe.aConstraints.gridx += 1;
464666
465
- //aConstraints.gridx = 0;
466
- //aConstraints.gridy += 1;
467
- oe.aConstraints.weighty = 0;
468
- oe.aConstraints.gridwidth = 1;
469
-
470
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
471
- flashSelectionButton.setToolTipText("Show selection");
472
- flashSelectionButton.addActionListener(this);
667
+ if (Globals.ADVANCED)
668
+ {
669
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
+ snapobjectButton.addActionListener(this);
671
+ snapobjectButton.setToolTipText("Snap Object");
672
+ }
673
+
674
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
473675
474
- oe.toolbarPanel.add(new cButton(" ", false));
475
-
476
- oe.aConstraints.gridx += 1;
477
- oe.aConstraints.weighty = 0;
478
- oe.aConstraints.gridwidth = 1;
479
-
480
- //
481
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
482677 twoButton.setToolTipText("Show center view only");
483678 twoButton.addActionListener(this);
484
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
679
+ this.fullscreenLayout = twoButton;
680
+
681
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
485682 fourButton.addActionListener(this);
486683 fourButton.setToolTipText("Show left panel only");
487
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
684
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
488685 sixButton.setToolTipText("2-column layout left");
489686 sixButton.addActionListener(this);
490
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
687
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
491688 threeButton.setToolTipText("2-column layout right");
492689 threeButton.addActionListener(this);
493
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
494691 sevenButton.setToolTipText("3-column layout");
495692 sevenButton.addActionListener(this);
496693 //
497694
498
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
499
- rootButton.setToolTipText("Edit object in new tab");
695
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696
+ rootButton.setToolTipText("Edit selection in new tab");
500697 rootButton.addActionListener(this);
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
698
+
699
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
503700 closeButton.setToolTipText("Close tab");
504701 closeButton.addActionListener(this);
505702 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
506703 //clearButton.addActionListener(this);
507
- oe.aConstraints.gridx += 1;
508
-
509
- oe.aConstraints.gridx = 1; //
510
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
511
- editButton.addActionListener(this);
512
- oe.aConstraints.gridx += 1;
513
- oe.aConstraints.weighty = 0;
514
- oe.aConstraints.gridwidth = 1;
515704
516
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
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
+ }
736
+
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");
786
+ editButton.addActionListener(this);
787
+
788
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
789
+ uneditButton.setToolTipText("Remove selection controls");
517790 uneditButton.addActionListener(this);
518791
519
- oe.aConstraints.gridx += 1;
520
- oe.aConstraints.weighty = 0;
521
- oe.aConstraints.gridwidth = 1;
522
-
523
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
524
- clearPanelButton.addActionListener(this);
525
-
526
- oe.aConstraints.gridx += 1;
527
- oe.aConstraints.weighty = 0;
528
- oe.aConstraints.gridwidth = 1;
529
-
530
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
792
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
793
+ allParamsButton.setToolTipText("Show all controle");
531794 allParamsButton.addActionListener(this);
532795
533
- oe.aConstraints.gridx += 1;
534
- oe.aConstraints.weighty = 0;
535
- oe.aConstraints.gridwidth = 1;
536
-
537
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
796
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ clearPanelButton.setToolTipText("Clear edit panel");
798
+ clearPanelButton.addActionListener(this);
799
+
800
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ unselectButton.setToolTipText("Unselect");
538802 unselectButton.addActionListener(this);
539803
804
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ flashSelectionButton.setToolTipText("Highlight selection");
806
+ flashSelectionButton.addActionListener(this);
807
+
808
+ editCommandsPanel.preferredHeight = 1;
809
+
810
+ SetPinStates(false);
811
+// oe.treePanel.add(commandsPanel);
812
+// oe.treePanel.Return();
813
+
540814 // oe.aConstraints.gridx += 1;
541815 // oe.aConstraints.weighty = 0;
542816 // oe.aConstraints.gridwidth = 1;
....@@ -548,40 +822,25 @@
548822 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
549823 // gcButton.addActionListener(this);
550824
551
- oe.aConstraints.gridx = 0;
552
- oe.aConstraints.gridy += 1;
553
-
554
- //ctrlPanel.add(objList = new List(5, true));
555
- oe.aConstraints.gridwidth = 100;
556
- // oe.aConstraints.gridheight = 100;
557
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
558
- oe.aConstraints.gridheight = 1;
559
- oe.aConstraints.weighty = 0.5;
560
- oe.aConstraints.gridx = 0;
561
- JScrollPane jSP;
825
+ cGridBag jSPPanel = new cGridBag();
826
+
827
+ JScrollPane jSP;
562828 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
563
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
829
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
564830 ResetModel();
565
- oe.aConstraints.weighty = 0.5;
566
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
567
- oe.aConstraints.gridy += 1;
568
- oe.aConstraints.gridwidth = 1;
569
-
570
- oe.aConstraints.weighty = 0;
571
- oe.aConstraints.gridwidth = 2;
572
-
573
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
574
- colorCB.addItemListener(this);
575
- oe.aConstraints.gridx += 2;
576
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
577
- materialCB.addItemListener(this);
578
- oe.aConstraints.gridx += 2;
579
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
580
- textureCB.addItemListener(this);
581
-
582
- oe.aConstraints.gridx = 0;
583
- oe.aConstraints.gridy += 1;
584831
832
+ oe.treePanel.add(jSPPanel);
833
+ oe.treePanel.Return();
834
+
835
+ oe.treePanel.add(copyOptionsPanel);
836
+ oe.treePanel.Return();
837
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
+ versionField = (cNumberSlider)sliderPane.getComponent(1);
839
+ sliderPane.preferredHeight = 1;
840
+
841
+// mainPanel.setDividerLocation(0.5); //1.0);
842
+// mainPanel.setResizeWeight(0.5);
843
+
585844 //jList.addListSelectionListener(this);
586845 oe.jTree.addTreeSelectionListener(this);
587846 //jTree.setRootVisible(false);
....@@ -604,83 +863,143 @@
604863 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
605864 }
606865
607
- void AddOptions(JPanel panel, GridBagConstraints constraints)
866
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
608867 {
609
- constraints.gridx = 0;
610
- constraints.gridy = 0;
611
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), constraints);
612
- fastCB.setToolTipText("Fast mode");
613
- fastCB.addItemListener(this);
614
- constraints.gridy += 1;
615
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), constraints);
616
- supportCB.setToolTipText("Enabled rigging");
617
- supportCB.addItemListener(this);
868
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
869
+ colorCB.setToolTipText("Copy color when dropped");
870
+ colorCB.addItemListener(this);
618871
619
- // constraints.gridy += 1;
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
+
882
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
883
+ boxCB.setToolTipText("Display bounding boxes");
884
+ boxCB.addItemListener(this);
885
+
886
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
887
+ zoomBoxCB.setToolTipText("Display only for wheel");
888
+ zoomBoxCB.addItemListener(this);
889
+
890
+ if (true) // Globals.ADVANCED)
891
+ {
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);
899
+
620900 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
621901 // localCB.addItemListener(this);
622902
623
- constraints.gridy += 1;
624
- panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD), constraints);
903
+ panel.Return();
904
+
905
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
625906 crowdCB.setToolTipText("Used for crowds");
626907 crowdCB.addItemListener(this);
627908
628
- constraints.gridy += 1;
629
- panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), constraints);
909
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
630910 smoothCB.setToolTipText("Snapping delay");
631911 smoothCB.addItemListener(this);
632912
633
- constraints.gridy += 1;
634
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), constraints);
913
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
635914 slowCB.setToolTipText("Smooth interpolation");
636915 slowCB.addItemListener(this);
637
- constraints.gridy += 1;
638
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE), constraints);
639
- boxCB.setToolTipText("Display bounding boxes");
640
- boxCB.addItemListener(this);
641
- constraints.gridy += 1;
642
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE), constraints);
643
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
644
- zoomBoxCB.addItemListener(this);
645
-
916
+
646917 // constraints.gridy += 1;
647918 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
648919 // speakerMocapCB.addItemListener(this);
649920
921
+ panel.Return();
922
+
650923 if (false)
651924 {
652925 // handled in scripts
653
- constraints.gridy += 1;
654
- panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), constraints);
926
+ //constraints.gridy += 1;
927
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
655928 speakerCameraCB.addItemListener(this);
656929
657
- constraints.gridy += 1;
658
- panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), constraints);
930
+ //constraints.gridy += 1;
931
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
659932 speakerFocusCB.addItemListener(this);
660933
661
- constraints.gridy += 1;
662
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), constraints);
934
+ //constraints.gridy += 1;
935
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
663936 smoothfocusCB.addItemListener(this);
937
+ panel.Return();
664938 }
665939
666940 //constraints.gridx += 1;
667941 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
668942 // debugCB.addItemListener(this);
669943
670
- constraints.gridy += 1;
671
- panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL), constraints);
944
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
945
+ trackCB.setToolTipText("Enable tracking target");
946
+ trackCB.addItemListener(this);
947
+
948
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
949
+ oeilCB.setToolTipText("Move camera when tracking");
672950 oeilCB.addItemListener(this);
673951
674
- constraints.gridy += 1;
675
- panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT), constraints);
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
+ {
972
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
676973 lookAtCB.setToolTipText("Look-at target");
677974 lookAtCB.addItemListener(this);
975
+ }
976
+
977
+ }
978
+
979
+ cGridBag fill = new cGridBag();
980
+ fill.preferredHeight = 200;
981
+ cGridBag fill2 = new cGridBag();
982
+ fill2.preferredHeight = 200;
983
+ cGridBag fill3 = new cGridBag();
984
+ fill3.preferredHeight = 200;
985
+
986
+ panel.add(fill);
987
+ panel.add(fill2);
988
+ panel.add(fill3);
678989
679990 }
680991
681992 void EditObject(Object3D obj)
682993 {
683994 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
+
6841003 radioButton.SetObject(obj);
6851004 radioButton.layout = sevenButton;
6861005 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -689,8 +1008,11 @@
6891008 buttonGroup.add(radioButton);
6901009 radioButton.doClick();
6911010 }
1011
+
6921012 void SetupViews(ObjEditor oe)
6931013 {
1014
+ theFrame = this;
1015
+
6941016 oe.SetupViews();
6951017
6961018 System.out.println("SetupViews");
....@@ -699,23 +1021,28 @@
6991021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7001022 }
7011023
702
- JCheckBox liveCB;
703
- JCheckBox supportCB;
704
- JCheckBox localCB;
705
- JCheckBox crowdCB;
706
- JCheckBox smoothCB;
707
- JCheckBox fastCB;
708
- JCheckBox slowCB;
709
- JCheckBox boxCB;
710
- JCheckBox zoomBoxCB;
711
- JCheckBox trackCB;
712
- 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;
7131037 // JCheckBox speakerMocapCB;
714
- JCheckBox speakerCameraCB;
715
- JCheckBox speakerFocusCB;
716
- JCheckBox debugCB;
717
- JCheckBox oeilCB;
718
- JCheckBox lookAtCB;
1038
+ cCheckBox speakerCameraCB;
1039
+ cCheckBox speakerFocusCB;
1040
+ cCheckBox debugCB;
1041
+
1042
+ cCheckBox oeilCB;
1043
+ cCheckBox shadowCB;
1044
+ cCheckBox autokeepCB;
1045
+ cCheckBox lookAtCB;
7191046
7201047 // static int COLOR = 1;
7211048 // static int MATERIAL = 2;
....@@ -723,9 +1050,9 @@
7231050
7241051 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7251052
726
- JCheckBox colorCB;
727
- JCheckBox materialCB;
728
- JCheckBox textureCB;
1053
+ cCheckBox colorCB;
1054
+ cCheckBox materialCB;
1055
+ cCheckBox textureCB;
7291056
7301057 public void itemStateChanged(ItemEvent e)
7311058 {
....@@ -753,6 +1080,7 @@
7531080 } else if(e.getSource() == liveCB)
7541081 {
7551082 cameraView.ToggleLive();
1083
+ refreshContents(false);
7561084 }
7571085 else if(e.getSource() == supportCB)
7581086 {
....@@ -817,6 +1145,18 @@
8171145 {
8181146 cameraView.ToggleOeil();
8191147 }
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
+ }
8201160 else if(e.getSource() == lookAtCB)
8211161 {
8221162 cameraView.ToggleLookAt();
....@@ -833,7 +1173,8 @@
8331173
8341174 /**/
8351175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
836
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
8371178 if ((path == null) || (path.getPathCount() <= 1)) {
8381179 // We can't move the root node or an empty selection
8391180 return;
....@@ -896,8 +1237,6 @@
8961237 }
8971238 }
8981239
899
- String string = (String) object;
900
-
9011240 System.out.println("Transfer = " + object + "; drop : " + target);
9021241 // if( object instanceof java.io.File[])
9031242 // {
....@@ -905,7 +1244,11 @@
9051244 // objEditor.DropFile((java.io.File[]) object, true);
9061245 // return;
9071246 // }
908
- 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) == ':')
9091252 {
9101253 // file(s)
9111254 String[] names = string.split("\n");
....@@ -932,7 +1275,7 @@
9321275
9331276 flashIt = false;
9341277 CameraPane pane = (CameraPane) target;
935
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1278
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9361279 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9371280
9381281 if (group.selection.size() == 1)
....@@ -948,23 +1291,33 @@
9481291
9491292 assert target == objEditor.jTree;
9501293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
9511295 try {
952
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9531297 } catch (Exception e) {
9541298 System.out.println("destinationPath : " + destinationPath);
9551299 return;
9561300 }
9571301
958
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
9591303 {
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
+// {
9601313 loadClipboard(true);
9611314 objEditor.jTree.setSelectionPath(destinationPath);
962
- pasteInto(false);
963
- } else {
964
- loadClipboard(false);
965
- objEditor.jTree.setSelectionPath(destinationPath);
966
- pasteInto(false); // true); // ???
967
- }
1315
+ pasteInto(false, false);
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
9681321 }
9691322 public void dropActionChanged(DropTargetDragEvent dtde)
9701323 // Called if the user has modified the current drop gesture
....@@ -1069,85 +1422,107 @@
10691422 {
10701423 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10711424 //heightFieldItem.addActionListener(this);
1072
- gridItem = menu.add(new MenuItem("Grid"));
1073
- gridItem.addActionListener(this);
1074
- rectoidItem = menu.add(new MenuItem("Box"));
1075
- rectoidItem.addActionListener(this);
1076
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1077
- ellipsoidItem.addActionListener(this);
1078
- coneItem = menu.add(new MenuItem("Cone"));
1079
- coneItem.addActionListener(this);
1080
- torusItem = menu.add(new MenuItem("Torus"));
1081
- torusItem.addActionListener(this);
1082
- superItem = menu.add(new MenuItem("Superellipsoid"));
1083
- 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
+ {
10841443 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10851444 kleinItem.addActionListener(this);
1086
- particleItem = menu.add(new MenuItem("Particle system"));
1087
- particleItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
1449
+ if (Globals.ADVANCED)
1450
+ {
10881451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10891452 ragdollItem.addActionListener(this);
10901453 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10911454 ragdoll2Item.addActionListener(this);
1455
+ }
10921456 menu.add("-");
1093
- meshItem = menu.add(new MenuItem("Mesh"));
1457
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10941458 meshItem.addActionListener(this);
10951459 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10961460 // meshGroupItem.addActionListener(this);
1461
+ if (Globals.ADVANCED)
1462
+ {
10971463 springItem = menu.add(new MenuItem("Spring"));
10981464 springItem.addActionListener(this);
10991465 flagItem = menu.add(new MenuItem("Flag"));
11001466 flagItem.addActionListener(this);
1101
- bezierItem = menu.add(new MenuItem("Patch"));
1102
- bezierItem.addActionListener(this);
1103
- checkerItem = menu.add(new MenuItem("Checker"));
1104
- checkerItem.addActionListener(this);
11051467 blobItem = menu.add(new MenuItem("Blob"));
11061468 blobItem.addActionListener(this);
11071469 latheItem = menu.add(new MenuItem("Lathe"));
11081470 latheItem.addActionListener(this);
1109
- lightItem = menu.add(new MenuItem("Light"));
1110
- lightItem.addActionListener(this);
1471
+ }
1472
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1473
+ bezierItem.addActionListener(this);
1474
+// overlayItem = menu.add(new MenuItem("Overlay"));
1475
+// overlayItem.addActionListener(this);
1476
+// lightItem = menu.add(new MenuItem("Light"));
1477
+// lightItem.addActionListener(this);
11111478 menu.add("-");
11121479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11131480 //superLoopItem.addActionListener(this);
1114
- loopItem = menu.add(new MenuItem("Loop"));
1115
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
11161483 doubleItem = menu.add(new MenuItem("Fork"));
11171484 doubleItem.addActionListener(this);
1485
+ if (Globals.ADVANCED)
1486
+ {
11181487 tripleItem = menu.add(new MenuItem("Trident"));
11191488 tripleItem.addActionListener(this);
1489
+ }
11201490 }
11211491
11221492 void buildToolsMenu(Menu menu)
11231493 {
11241494 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11251495 animationItem.addItemListener(this);
1126
- animationItem.setState(CameraPane.ANIMATION);
1496
+ animationItem.setState(Globals.ANIMATION);
1497
+
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
11271500
11281501 menu.add("-");
11291502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11301503 parseverticesItem.addActionListener(this);
11311504 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11321505 textureFieldItem.addActionListener(this);
1133
- alignItem = menu.add(new MenuItem("Align"));
1506
+ alignItem = menu.add(new MenuItem("Align Objects"));
11341507 alignItem.addActionListener(this);
1135
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1136
- mirrorItem.addActionListener(this);
11371508 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11381509 reduceMorphItem.addActionListener(this);
11391510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11401511 reduce34MorphItem.addActionListener(this);
1141
-
1142
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1143
- computeAOItem.addActionListener(this);
11441512 menu.add("-");
1145
-
11461513 menu.add(memoryItem = new MenuItem("Memory Usage"));
11471514 memoryItem.addActionListener(this);
1515
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1516
+ computeAOItem.addActionListener(this);
1517
+
1518
+ if (Globals.ADVANCED)
1519
+ {
1520
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1521
+ mirrorItem.addActionListener(this);
1522
+ menu.add("-");
11481523 menu.add(analyzeItem = new MenuItem("Analyze"));
11491524 analyzeItem.addActionListener(this);
1150
- menu.add(dumpItem = new MenuItem("Dump"));
1525
+ menu.add(dumpItem = new MenuItem("Print"));
11511526 dumpItem.addActionListener(this);
11521527 // menu.add(pathItem = new MenuItem("From-to path"));
11531528 // pathItem.addActionListener(this);
....@@ -1165,6 +1540,7 @@
11651540 menu.add("-");
11661541 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11671542 editScriptItem.addActionListener(this);
1543
+ }
11681544 }
11691545
11701546 void ScreenFit()
....@@ -1287,9 +1663,24 @@
12871663 shadow.material = new cMaterial(obj.material);
12881664 shadow.material.diffuse = 0.0001f;
12891665 shadow.material.specular = 0.0001f;
1666
+ //shadow.projectedVertices[1].x = 300;
12901667
12911668 makeSomething(shadow);
12921669 }
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
+ }
12931684
12941685 /**
12951686 * applyExample
....@@ -1493,9 +1884,9 @@
14931884
14941885 void Overwrite(int mask)
14951886 {
1496
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1887
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14971888 {
1498
- Object3D content = GrafreeD.clipboard.get(0);
1889
+ Object3D content = Grafreed.clipboard.get(0);
14991890
15001891 if (content instanceof cGroup && ((cGroup)content).transientlink )
15011892 content = ((cGroup)content).get(0);
....@@ -1518,6 +1909,7 @@
15181909 //
15191910 public void actionPerformed(ActionEvent event) // , Object arg)
15201911 {
1912
+ Object source = event.getSource();
15211913 /*
15221914 if (event.getSource() == nameField)
15231915 {
....@@ -1529,11 +1921,11 @@
15291921 }
15301922 else
15311923 */
1532
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1924
+ if (source == lookAtItem || source == lookFromItem)
15331925 {
15341926 ScreenFit();
15351927 } else
1536
- if (event.getSource() == switchItem)
1928
+ if (source == switchViewItem)
15371929 {
15381930 cVector v1 = new cVector();
15391931 cVector v2 = new cVector();
....@@ -1542,11 +1934,11 @@
15421934 objEditor.cameraView.renderCamera.setAim(v2, v1);
15431935 objEditor.cameraView.repaint();
15441936 } else
1545
- if (event.getSource() == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
15461938 {
15471939 makeSomething(new Box());
15481940 } else
1549
- if (event.getSource() == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
15501942 {
15511943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15521944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1567,9 +1959,9 @@
15671959 applyExample(particleGeom, "SMOKE");
15681960 makeSomething(particleGeom);
15691961 } else
1570
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1962
+ if (source == ragdollItem || source == ragdoll2Item)
15711963 {
1572
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1964
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15731965
15741966 ragdoll.toParent = LA.newMatrix();
15751967 ragdoll.fromParent = LA.newMatrix();
....@@ -1587,7 +1979,7 @@
15871979 } else
15881980 /*
15891981 */
1590
- if (event.getSource() == heightFieldItem)
1982
+ if (source == heightFieldItem)
15911983 {
15921984 Object3D obj = new Object3D();
15931985
....@@ -1625,31 +2017,31 @@
16252017
16262018 makeSomething(obj);
16272019 } else
1628
- if (event.getSource() == gridItem)
2020
+ if (source == gridItem || source == gridButton)
16292021 {
16302022 makeSomething(new Grid());
16312023 } else
1632
- if (event.getSource() == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
16332025 {
16342026 makeSomething(new Sphere());
16352027 } else
1636
- if (event.getSource() == coneItem)
2028
+ if (source == coneItem || source == coneButton)
16372029 {
16382030 makeSomething(new Cone());
16392031 } else
1640
- if (event.getSource() == torusItem)
2032
+ if (source == torusItem || source == torusButton)
16412033 {
16422034 makeSomething(new Torus());
16432035 } else
1644
- if (event.getSource() == superItem)
2036
+ if (source == superItem || source == superButton)
16452037 {
16462038 makeSomething(new Superellipsoid());
16472039 } else
1648
- if (event.getSource() == kleinItem)
2040
+ if (source == kleinItem || source == kleinButton)
16492041 {
16502042 makeSomething(new Klein());
16512043 } else
1652
- if (event.getSource() == blobItem)
2044
+ if (source == blobItem)
16532045 {
16542046 Blob blob = new Blob();
16552047 BlobComponent comp = new BlobComponent();
....@@ -1657,15 +2049,15 @@
16572049 //blob.retile();
16582050 makeSomething(blob);
16592051 } else
1660
- if (event.getSource() == latheItem)
2052
+ if (source == latheItem)
16612053 {
16622054 makeSomething(new Lathe());
16632055 } else
1664
- if (event.getSource() == bezierItem)
2056
+ if (source == bezierItem)
16652057 {
16662058 makeSomething(new BezierSurface());
16672059 } else
1668
- if (event.getSource() == checkerItem)
2060
+ if (source == overlayItem || source == overlayButton)
16692061 {
16702062 /*
16712063 Object3D obj = new BezierSurface(5,8);
....@@ -1680,7 +2072,7 @@
16802072 */
16812073 makeSomething(new Checker());
16822074 } else
1683
- if (event.getSource() == meshItem)
2075
+ if (source == meshItem)
16842076 {
16852077 Object3D itemtomake = new Object3D();
16862078 Object3D child;
....@@ -1701,35 +2093,35 @@
17012093 makeSomething(child);
17022094 }
17032095 } else
1704
- if (event.getSource() == springItem)
2096
+ if (source == springItem)
17052097 {
17062098 cSpring s = new cSpring();
17072099 s.setup();
17082100 makeSomething(s);
17092101 } else
1710
- if (event.getSource() == flagItem)
2102
+ if (source == flagItem)
17112103 {
17122104 cSpring s = new cFlag();
17132105 s.setup();
17142106 makeSomething(s);
17152107 } else
1716
- if (event.getSource() == lightItem)
2108
+ if (source == lightItem || source == lightButton)
17172109 {
17182110 makeSomething(new Light());
17192111 } else
1720
- if (event.getSource() == csgItem)
2112
+ if (source == csgItem)
17212113 {
17222114 group(new CSG());
17232115 } else
1724
- if (event.getSource() == templateItem)
2116
+ if (source == templateItem)
17252117 {
17262118 group(new cTemplate());
17272119 } else
1728
- if (event.getSource() == attributeItem)
2120
+ if (source == attributeItem)
17292121 {
17302122 makeSomething(new Attribute());
17312123 } else
1732
- if (event.getSource() == pointflowItem)
2124
+ if (source == pointflowItem)
17332125 {
17342126 makeSomething(new PointFlow());
17352127 } else
....@@ -1741,7 +2133,7 @@
17412133 } else
17422134 */
17432135
1744
- if (event.getSource() == superLoopItem)
2136
+ if (source == superLoopItem)
17452137 {
17462138 Composite g = new cGroup();
17472139 for (int i=0; i<15; i++)
....@@ -1763,30 +2155,30 @@
17632155
17642156 group(g);
17652157 } else
1766
- if (event.getSource() == loopItem)
2158
+ if (source == loopItem || source == loopButton)
17672159 {
17682160 Composite csg = new GroupLeaf();
17692161 csg.count = 5;
17702162 group(csg);
1771
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
17722164 csg.addChild(child);
17732165 child.addChild(csg);
17742166 } else
1775
- if (event.getSource() == doubleItem)
2167
+ if (source == doubleItem)
17762168 {
1777
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
17782170 csg.count = 5;
17792171 group(csg);
1780
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
17812173 csg.addChild(child);
17822174 child.addChild(csg);
1783
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
17842176 csg.addChild(child);
17852177 child.addChild(csg);
17862178 } else
1787
- if (event.getSource() == tripleItem)
2179
+ if (source == tripleItem)
17882180 {
1789
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
17902182 csg.count = 4;
17912183 group(csg);
17922184 Composite child = new cGroup();
....@@ -1799,73 +2191,98 @@
17992191 csg.addChild(child);
18002192 child.addChild(csg);
18012193 } else
1802
-
1803
- if (event.getSource() == importGFDItem)
1804
- {
1805
- ImportGFD();
1806
- } else
1807
- if (event.getSource() == importVRMLX3DItem)
1808
- {
1809
- ImportVRMLX3D();
1810
- } else
1811
- if (event.getSource() == import3DSItem)
1812
- {
1813
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1814
- } else
1815
- if (event.getSource() == importOBJItem)
1816
- {
1817
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1818
- } else
1819
- if (event.getSource() == computeAOItem)
2194
+ if (source == computeAOItem)
18202195 {
18212196 Globals.drawMode = CameraPane.OCCLUSION;
18222197 Globals.theRenderer.repaint();
18232198 } else
1824
- if (event.getSource() == recompileItem)
2199
+ if (source == recompileItem)
18252200 {
18262201 Recompile();
18272202 refreshContents();
18282203 } else
1829
- if (event.getSource() == editScriptItem)
2204
+ if (source == editScriptItem)
18302205 {
18312206 OpenDialog();
18322207 refreshContents();
18332208 } else
1834
- if (event.getSource() == invariantsItem)
2209
+ if (source == invariantsItem)
18352210 {
18362211 System.out.println("Invariants:");
1837
- GrafreeD.grafreeD.universe.invariants();
2212
+ Grafreed.grafreeD.universe.invariants();
18382213 } else
1839
- if (event.getSource() == memoryItem)
2214
+ if (source == memoryItem)
18402215 {
18412216 //System.out.println("Invariants:");
18422217 PrintMemory();
18432218 } else
1844
- if (event.getSource() == pathItem)
2219
+ if (source == pathItem)
18452220 {
18462221 PrintPath();
18472222 } else
1848
- if (event.getSource() == analyzeItem)
2223
+ if (source == analyzeItem)
18492224 {
18502225 AnalyzeObject();
18512226 } else
1852
- if (event.getSource() == dumpItem)
2227
+ if (source == dumpItem)
18532228 {
18542229 DumpObject();
18552230 } else
1856
- if (event.getSource() == screenfitButton)
2231
+ if (source == minButton)
18572232 {
1858
- //Reload(lastConverter, lastFilename, true);
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
2271
+ if (source == oneStepButton)
2272
+ {
2273
+ Globals.ONESTEP = true;
2274
+ cameraView.repaint();
2275
+ } else
2276
+ if (source == screenfitButton)
2277
+ {
18592278 ScreenFit();
18602279 } else
1861
- if (event.getSource() == screenfitpointButton)
2280
+ if (source == screenfitpointButton)
18622281 {
1863
- //Reload(lastConverter, lastFilename, true);
18642282 ScreenFitPoint();
18652283 } else
1866
- if (event.getSource() == snapobjectButton)
2284
+ if (source == snapobjectButton)
18672285 {
1868
- //Reload(lastConverter, lastFilename, true);
18692286 SnapObject();
18702287 } else
18712288 // if (event.getSource() == recompileButton)
....@@ -1874,13 +2291,13 @@
18742291 // Recompile();
18752292 // refreshContents();
18762293 // } else
1877
- if (event.getSource() == gcButton)
2294
+ if (source == gcButton)
18782295 {
18792296 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18802297 System.gc();
18812298 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18822299 } else
1883
- if (event.getSource() == editLeafItem)
2300
+ if (source == editLeafItem)
18842301 {
18852302 Object3D obj;
18862303 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1894,62 +2311,74 @@
18942311 }
18952312 refreshContents(true);
18962313 } else
1897
- if (event.getSource() == openWindowItem)
2314
+ if (source == openWindowItem)
18982315 {
18992316 EditSelection(true);
19002317 } else
1901
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2318
+ if (source == cutItem || source == clearButton)
19022319 {
19032320 loadClipboard(true);
19042321 } else
1905
- if (event.getSource() == duplicateItem)
2322
+ if (source == undoItem)
19062323 {
1907
- Object3D keep = GrafreeD.clipboard;
2324
+ Undo();
2325
+ } else
2326
+ if (source == redoItem)
2327
+ {
2328
+ Redo();
2329
+ } else
2330
+ if (source == duplicateItem)
2331
+ {
2332
+ Object3D keep = Grafreed.clipboard;
19082333 loadClipboard(false);
19092334 paste(false);
1910
- GrafreeD.clipboard = keep;
2335
+ Grafreed.clipboard = keep;
19112336 } else
1912
- if (event.getSource() == cloneItem)
2337
+ if (source == cloneItem)
19132338 {
19142339 CloneSelection(false);
19152340 } else
1916
- if (event.getSource() == cloneSupportItem)
2341
+ if (source == cloneSupportItem)
19172342 {
19182343 CloneSelection(true);
19192344 } else
1920
- if (event.getSource() == copyItem)
2345
+ if (source == copyItem)
19212346 {
19222347 loadClipboard(false);
19232348 } else
1924
- if (event.getSource() == pasteItem)
2349
+ if (source == pasteItem)
19252350 {
19262351 paste(false);
19272352 } else
1928
- if (event.getSource() == pasteLinkItem)
2353
+ if (source == pasteIntoItem)
19292354 {
1930
- pasteInto(false);
2355
+ pasteInto(true, false);
19312356 } else
1932
- if (event.getSource() == pasteCloneItem)
2357
+ if (source == pasteLinkItem)
19332358 {
1934
- pasteInto(true);
2359
+ pasteInto(false, false);
19352360 } else
1936
- if (event.getSource() == pasteExpandItem)
2361
+ if (source == pasteCloneItem)
2362
+ {
2363
+ pasteInto(true, true);
2364
+ } else
2365
+ if (source == pasteExpandItem)
19372366 {
19382367 paste(true);
19392368 } else
1940
- if (event.getSource() == synchronizeItem)
2369
+ if (source == synchronizeItem)
19412370 {
19422371 Overwrite(Object3D.TRANSFORM);
19432372 } else
1944
- if (event.getSource() == overwriteNameItem)
2373
+ if (source == overwriteNameItem)
19452374 {
19462375 Overwrite(Object3D.NAME);
19472376 } else
1948
- if (event.getSource() == overwriteUVItem)
2377
+ if (source == overwriteUVItem)
19492378 {
19502379 Overwrite(Object3D.UV);
19512380 } else
1952
- if (event.getSource() == overwriteMatItem)
2381
+ if (source == overwriteMatItem)
19532382 {
19542383 /* july 2015
19552384 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1969,7 +2398,7 @@
19692398
19702399 Overwrite(dropAttributes);
19712400 }
1972
- if (event.getSource() == overwriteGeoItem)
2401
+ if (source == overwriteGeoItem)
19732402 {
19742403 Overwrite(Object3D.GEOMETRY);
19752404 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1986,7 +2415,7 @@
19862415 // refreshContents();
19872416 // }
19882417 } else
1989
- if (event.getSource() == generateMeshItem)
2418
+ if (source == generateMeshItem)
19902419 {
19912420 //if (group.selection.size() == 1)
19922421 // for (int i=0; i<group.selection.size(); i++)
....@@ -1997,7 +2426,7 @@
19972426 ResetModel();
19982427 refreshContents();
19992428 } else
2000
- if (event.getSource() == extractGeometriesItem)
2429
+ if (source == extractGeometriesItem)
20012430 {
20022431 boolean one = false;
20032432
....@@ -2024,7 +2453,7 @@
20242453 ResetModel();
20252454 refreshContents();
20262455 } else
2027
- if (event.getSource() == cloneGeometriesItem)
2456
+ if (source == cloneGeometriesItem)
20282457 {
20292458 boolean one = false;
20302459
....@@ -2050,7 +2479,7 @@
20502479 ResetModel();
20512480 refreshContents();
20522481 } else
2053
- if (event.getSource() == shareGeometriesItem)
2482
+ if (source == shareGeometriesItem)
20542483 {
20552484 boolean one = false;
20562485
....@@ -2080,7 +2509,7 @@
20802509 refreshContents();
20812510 }
20822511 } else
2083
- if (event.getSource() == mergeGeometriesItem)
2512
+ if (source == mergeGeometriesItem)
20842513 {
20852514 boolean one = false;
20862515
....@@ -2110,7 +2539,7 @@
21102539 ResetModel();
21112540 refreshContents();
21122541 } else
2113
- if (event.getSource() == linkverticesItem)
2542
+ if (source == linkverticesItem)
21142543 {
21152544 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
21162545 // {
....@@ -2123,9 +2552,9 @@
21232552 // group.selection.get(0).setMasterThis(content); // should be identity
21242553 // refreshContents();
21252554 // }
2126
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2555
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21272556 {
2128
- Object3D content = GrafreeD.clipboard.get(0);
2557
+ Object3D content = Grafreed.clipboard.get(0);
21292558
21302559 if (content instanceof cGroup && ((cGroup)content).transientlink )
21312560 content = ((cGroup)content).get(0);
....@@ -2133,38 +2562,38 @@
21332562 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21342563 for (int i=0; i<group.selection.size(); i++)
21352564 {
2136
- boolean random = CameraPane.RANDOM;
2137
- CameraPane.RANDOM = false; // parse all random nodes
2565
+ boolean random = CameraPane.SWITCH;
2566
+ CameraPane.SWITCH = false; // parse all random nodes
21382567 group.selection.get(i).linkVerticesThis(content);
21392568 // group.selection.get(i).setMasterThis(content); // should be identity
2140
- CameraPane.RANDOM = random;
2569
+ CameraPane.SWITCH = random;
21412570 }
21422571 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21432572 refreshContents();
21442573 }
21452574 } else
2146
- if (event.getSource() == resetsupportItem)
2575
+ if (source == resetsupportItem)
21472576 {
21482577 for (int i=0; i<group.selection.size(); i++)
21492578 {
2150
- boolean random = CameraPane.RANDOM;
2151
- CameraPane.RANDOM = false; // parse all random nodes
2579
+ boolean random = CameraPane.SWITCH;
2580
+ CameraPane.SWITCH = false; // parse all random nodes
21522581 group.selection.get(i).linkVerticesThis(null);
2153
- CameraPane.RANDOM = random;
2582
+ CameraPane.SWITCH = random;
21542583 }
21552584
21562585 refreshContents();
21572586 } else
2158
- if (event.getSource() == relinkverticesItem)
2587
+ if (source == relinkverticesItem)
21592588 {
2160
- boolean random = CameraPane.RANDOM;
2161
- CameraPane.RANDOM = false; // parse all random nodes
2589
+ boolean random = CameraPane.SWITCH;
2590
+ CameraPane.SWITCH = false; // parse all random nodes
21622591 group.selection.RelinkToSupport();
2163
- CameraPane.RANDOM = random;
2592
+ CameraPane.SWITCH = random;
21642593
21652594 refreshContents();
21662595 } else
2167
- if (event.getSource() == resetreferencesItem)
2596
+ if (source == resetreferencesItem)
21682597 {
21692598 for (int i=0; i<group.selection.size(); i++)
21702599 {
....@@ -2173,11 +2602,11 @@
21732602
21742603 refreshContents();
21752604 } else
2176
- if (event.getSource() == setMasterItem)
2605
+ if (source == setMasterItem)
21772606 {
2178
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2607
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21792608 {
2180
- Object3D content = GrafreeD.clipboard.get(0);
2609
+ Object3D content = Grafreed.clipboard.get(0);
21812610
21822611 if (content instanceof cGroup && ((cGroup)content).transientlink )
21832612 content = ((cGroup)content).get(0);
....@@ -2186,13 +2615,13 @@
21862615 refreshContents();
21872616 }
21882617 } else
2189
- if (event.getSource() == poseMeshItem)
2618
+ if (source == poseMeshItem)
21902619 {
21912620 if (group.selection.size() == 1)
21922621 {
2193
- if (GrafreeD.clipboard.size() == 1)
2622
+ if (Grafreed.clipboard.size() == 1)
21942623 {
2195
- Object3D content = GrafreeD.clipboard.get(0);
2624
+ Object3D content = Grafreed.clipboard.get(0);
21962625
21972626 if (content instanceof cGroup && ((cGroup)content).transientlink )
21982627 content = ((cGroup)content).get(0);
....@@ -2205,19 +2634,19 @@
22052634 }
22062635
22072636 } else
2208
- if (event.getSource() == revertMeshItem)
2637
+ if (source == revertMeshItem)
22092638 {
22102639 RevertMeshes();
22112640 } else
2212
- if (event.getSource() == resetMeshItem)
2641
+ if (source == resetAllItem)
22132642 {
22142643 ResetAll();
22152644 } else
2216
- if (event.getSource() == stepAllItem)
2645
+ if (source == stepAllItem)
22172646 {
22182647 StepAll();
22192648 } else
2220
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2649
+ if (source == clearItem) // || event.getSource() == clearButton)
22212650 {
22222651 //int indices[] = jList.getSelectedIndices();
22232652 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2225,46 +2654,46 @@
22252654
22262655 ClearSelection(false);
22272656 } else
2228
- if (event.getSource() == clearAllItem)
2657
+ if (source == clearAllItem)
22292658 {
22302659 ClearSelection(true);
22312660 } else
2232
- if (event.getSource() == grabItem)
2661
+ if (source == grabItem || source == groupButton)
22332662 {
2234
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
22352664 } else
2236
- if (event.getSource() == hideItem)
2665
+ if (source == hideItem)
22372666 {
22382667 group(new HiddenObject());
22392668 } else
2240
- if (event.getSource() == frontItem)
2669
+ if (source == frontItem)
22412670 {
22422671 front();
22432672 } else
2244
- if (event.getSource() == backItem)
2673
+ if (source == backItem)
22452674 {
22462675 back();
22472676 } else
2248
- if (event.getSource() == cameraItem)
2677
+ if (source == cameraItem)
22492678 {
22502679 makeSomething(new Camera());
22512680 } else
2252
- if (event.getSource() == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
22532682 {
22542683 group(new Composite());
22552684 } else
2256
- if (event.getSource() == randomItem)
2685
+ if (source == switchItem || source == switchButton)
22572686 {
22582687 RandomNode random = new RandomNode();
22592688 group(random);
22602689 if (random.size() > 0)
2261
- random.name = random.get(0).name + "Rnd";
2690
+ random.name = random.get(0).name + "Switch";
22622691 } else
2263
- if (event.getSource() == physicsItem)
2692
+ if (source == physicsItem)
22642693 {
22652694 group(new PhysicsNode());
22662695 } else
2267
- if (event.getSource() == frameselectorItem)
2696
+ if (source == frameselectorItem)
22682697 {
22692698 for (int i=0; i<group.selection.size(); i++)
22702699 {
....@@ -2276,7 +2705,7 @@
22762705 ResetModel();
22772706 refreshContents();
22782707 } else
2279
- if (event.getSource() == switchGeoItem)
2708
+ if (source == switchGeoItem)
22802709 {
22812710 for (int i=0; i<group.selection.size(); i++)
22822711 {
....@@ -2288,7 +2717,7 @@
22882717 ResetModel();
22892718 refreshContents();
22902719 } else
2291
- if (event.getSource() == switchTransfoItem)
2720
+ if (source == switchTransfoItem)
22922721 {
22932722 for (int i=0; i<group.selection.size(); i++)
22942723 {
....@@ -2300,7 +2729,7 @@
23002729 ResetModel();
23012730 refreshContents();
23022731 } else
2303
- if (event.getSource() == morphItem)
2732
+ if (source == morphItem)
23042733 {
23052734 for (int i=0; i<group.selection.size(); i++)
23062735 {
....@@ -2312,7 +2741,7 @@
23122741 ResetModel();
23132742 refreshContents();
23142743 } else
2315
- if (event.getSource() == scriptNodeItem)
2744
+ if (source == scriptNodeItem)
23162745 {
23172746 boolean atleastone = false;
23182747
....@@ -2351,215 +2780,252 @@
23512780 }
23522781 }
23532782 } else
2354
- if (event.getSource() == linkerItem)
2783
+ if (source == linkerItem)
23552784 {
23562785 group(new cLinker());
23572786 } else
2358
- if (event.getSource() == textureItem)
2787
+ if (source == textureItem || source == textureButton)
23592788 {
23602789 group(new TextureNode());
23612790 } else
2362
- if (event.getSource() == billboardItem)
2791
+ if (source == billboardItem)
23632792 {
23642793 group(new BillboardNode());
23652794 } else
2366
- if (event.getSource() == shadowXItem)
2795
+ if (source == shadowXItem)
23672796 {
23682797 CastShadow(0);
23692798 } else
2370
- if (event.getSource() == shadowYItem)
2799
+ if (source == shadowYItem)
23712800 {
23722801 CastShadow(1);
23732802 } else
2374
- if (event.getSource() == shadowZItem)
2803
+ if (source == shadowZItem)
23752804 {
23762805 CastShadow(2);
23772806 } else
2378
- if (event.getSource() == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
23792808 {
2380
- //ungroup();
2809
+ boolean hasRoot = false;
2810
+
23812811 for (int i=0; i<group.selection.size(); i++)
23822812 {
2383
- Ungroup(group.selection.get(i));
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
23842818 }
23852819
2386
- ClearSelection(false);
2387
-
2388
- 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
+ }
23892831 } else
2390
- if (event.getSource() == genUVItem)
2832
+ if (source == genUVItem)
23912833 {
23922834 GenUV();
23932835 } else
2394
- if (event.getSource() == genNormalsCADItem)
2836
+ if (source == genNormalsCADItem)
23952837 {
23962838 GenNormals(true);
23972839 } else
2398
- if (event.getSource() == genNormalsMESHItem)
2840
+ if (source == genNormalsMESHItem)
23992841 {
2400
- GenNormals(true); // TODO
2842
+ GenNormalsMESH();
24012843 } else
2402
- if (event.getSource() == genNormalsORGANItem)
2844
+ if (source == genNormalsORGANItem)
24032845 {
24042846 GenNormals(false);
24052847 } else
2406
- if (event.getSource() == genNormalsMINEItem)
2848
+ if (source == genNormalsMINEItem)
24072849 {
24082850 GenNormalsMINE();
24092851 } else
2410
- if (event.getSource() == stripifyItem)
2852
+ if (source == stripifyItem)
24112853 {
24122854 Stripify();
24132855 } else
2414
- if (event.getSource() == unstripifyItem)
2856
+ if (source == unstripifyItem)
24152857 {
24162858 Unstripify();
24172859 } else
2418
- if (event.getSource() == trimItem)
2860
+ if (source == trimItem)
24192861 {
24202862 Trim();
24212863 } else
2422
- if (event.getSource() == untrimItem)
2864
+ if (source == untrimItem)
24232865 {
24242866 Untrim();
24252867 } else
2426
- if (event.getSource() == clearColorsItem)
2868
+ if (source == clearColorsItem)
24272869 {
24282870 ClearColors();
24292871 } else
2430
- if (event.getSource() == clearMaterialsItem)
2872
+ if (source == clearMaterialsItem)
24312873 {
24322874 ClearMaterials();
24332875 } else
2434
- if (event.getSource() == liveleavesItem)
2876
+ if (source == liveleavesItem)
24352877 {
24362878 LiveLeaves(true);
24372879 } else
2438
- if (event.getSource() == unliveleavesItem)
2880
+ if (source == unliveleavesItem)
24392881 {
24402882 LiveLeaves(false);
24412883 } else
2442
- if (event.getSource() == supportleavesItem)
2884
+ if (source == supportleavesItem)
24432885 {
24442886 SupportLeaves(true);
24452887 } else
2446
- if (event.getSource() == unsupportleavesItem)
2888
+ if (source == unsupportleavesItem)
24472889 {
24482890 SupportLeaves(false);
24492891 } else
2450
- if (event.getSource() == hideleavesItem)
2892
+ if (source == hideleavesItem)
24512893 {
24522894 HideLeaves(true);
24532895 } else
2454
- if (event.getSource() == showleavesItem)
2896
+ if (source == showleavesItem)
24552897 {
24562898 HideLeaves(false);
24572899 } else
2458
- if (event.getSource() == markleavesItem)
2900
+ if (source == markleavesItem)
24592901 {
24602902 MarkLeaves(true);
24612903 } else
2462
- if (event.getSource() == unmarkleavesItem)
2904
+ if (source == unmarkleavesItem)
24632905 {
24642906 MarkLeaves(false);
24652907 } else
2466
- if (event.getSource() == flipVItem)
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);
2923
+ } else
2924
+ if (source == flipVItem)
24672925 {
24682926 FlipV(true);
24692927 } else
2470
- if (event.getSource() == unflipVItem)
2928
+ if (source == unflipVItem)
24712929 {
24722930 FlipV(false);
24732931 } else
2474
- if (event.getSource() == lowTexturesItem)
2932
+ if (source == lowTexturesItem)
24752933 {
24762934 SetTexRes(0);
24772935 } else
2478
- if (event.getSource() == normalTexturesItem)
2936
+ if (source == normalTexturesItem)
24792937 {
24802938 SetTexRes(1);
24812939 } else
2482
- if (event.getSource() == highTexturesItem)
2940
+ if (source == highTexturesItem)
24832941 {
24842942 SetTexRes(2);
24852943 } else
2486
- if (event.getSource() == veryhighTexturesItem)
2944
+ if (source == veryhighTexturesItem)
24872945 {
24882946 SetTexRes(3);
24892947 } else
2490
- if (event.getSource() == maxTexturesItem)
2948
+ if (source == maxTexturesItem)
24912949 {
24922950 SetTexRes(4);
24932951 } else
2494
- if (event.getSource() == panoTexturesItem)
2952
+ if (source == panoTexturesItem)
24952953 {
24962954 SetTexRes(5);
24972955 } else
2498
- if (event.getSource() == reverseNormalsItem)
2956
+ if (source == reverseNormalsItem)
24992957 {
25002958 ReverseNormals();
25012959 } else
2502
- if (event.getSource() == parseverticesItem)
2960
+ if (source == parseverticesItem)
25032961 {
25042962 ParseVertices();
25052963 } else
2506
- if (event.getSource() == textureFieldItem)
2964
+ if (source == textureFieldItem)
25072965 {
25082966 TextureVertices();
25092967 } else
2510
- if (event.getSource() == alignItem)
2968
+ if (source == alignItem)
25112969 {
25122970 Align();
25132971 } else
2514
- if (event.getSource() == mirrorItem)
2972
+ if (source == mirrorItem)
25152973 {
25162974 MirrorPoses();
25172975 } else
2518
- if (event.getSource() == reduceMorphItem)
2976
+ if (source == reduceMorphItem)
25192977 {
25202978 MeshReduction(false);
25212979 } else
2522
- if (event.getSource() == reduce34MorphItem)
2980
+ if (source == reduce34MorphItem)
25232981 {
25242982 MeshReduction(true);
25252983 } else
2526
- if (event.getSource() == reverseTrianglesItem)
2984
+ if (source == reverseTrianglesItem)
25272985 {
25282986 ReverseTriangles();
25292987 } else
2530
- if (event.getSource() == reduceMeshItem)
2988
+ if (source == reduceMeshItem)
25312989 {
25322990 ReduceMesh(false);
25332991 } else
2534
- if (event.getSource() == reduce34MeshItem)
2992
+ if (source == reduce34MeshItem)
25352993 {
25362994 ReduceMesh(true);
25372995 } else
2538
- if (event.getSource() == increaseMeshItem)
2996
+ if (source == increaseMeshItem)
25392997 {
25402998 IncreaseMesh();
25412999 } else
2542
- if (event.getSource() == clipMeshItem)
3000
+ if (source == clipMeshItem)
25433001 {
25443002 ClipMesh();
25453003 } else
2546
- if (event.getSource() == smoothMeshItem)
3004
+ if (source == smoothMeshItem)
25473005 {
25483006 SmoothMesh();
25493007 } else
2550
- if (event.getSource() == transformgeometryItem)
3008
+ if (source == transformGeometryItem)
25513009 {
25523010 TransformGeometry();
25533011 } else
2554
- if (event.getSource() == resetTransformItem)
3012
+ if (source == transformChildrenItem)
3013
+ {
3014
+ TransformChildren();
3015
+ } else
3016
+ if (source == resetTransformItem)
25553017 {
25563018 ResetTransform();
25573019 } else
2558
- if (event.getSource() == resetCentroidItem)
3020
+ if (source == resetCentroidItem)
25593021 {
2560
- ResetCentroid();
3022
+ ResetCentroid(true);
25613023 } else
2562
- if (event.getSource() == resetParentItem)
3024
+ if (source == resetCentroidXZItem)
3025
+ {
3026
+ ResetCentroid(false);
3027
+ } else
3028
+ if (source == resetParentItem)
25633029 {
25643030 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25653031 {
....@@ -2569,7 +3035,7 @@
25693035
25703036 refreshContents();
25713037 } else
2572
- if (event.getSource() == repairParentItem)
3038
+ if (source == repairParentItem)
25733039 {
25743040 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25753041 {
....@@ -2583,7 +3049,7 @@
25833049
25843050 refreshContents();
25853051 } else
2586
- if (event.getSource() == repairShadowItem)
3052
+ if (source == repairShadowItem)
25873053 {
25883054 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25893055 {
....@@ -2597,7 +3063,7 @@
25973063
25983064 refreshContents();
25993065 } else
2600
- if (event.getSource() == sortbysizeItem)
3066
+ if (source == sortbysizeItem)
26013067 {
26023068 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26033069 {
....@@ -2609,7 +3075,7 @@
26093075 ResetModel();
26103076 refreshContents();
26113077 } else
2612
- if (event.getSource() == sortbynameItem)
3078
+ if (source == sortbynameItem)
26133079 {
26143080 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26153081 {
....@@ -2621,7 +3087,7 @@
26213087 ResetModel();
26223088 refreshContents();
26233089 } else
2624
- if (event.getSource() == attachPigmentItem)
3090
+ if (source == attachPigmentItem)
26253091 {
26263092 String texture = GetFile("Attach pigment");
26273093 Object3D obj;
....@@ -2633,7 +3099,7 @@
26333099
26343100 refreshContents();
26353101 } else
2636
- if (event.getSource() == detachPigmentItem)
3102
+ if (source == detachPigmentItem)
26373103 {
26383104 Object3D obj;
26393105 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2644,7 +3110,7 @@
26443110
26453111 refreshContents();
26463112 } else
2647
- if (event.getSource() == attachBumpItem)
3113
+ if (source == attachBumpItem)
26483114 {
26493115 String texture = GetFile("Attach bump");
26503116 Object3D obj;
....@@ -2656,7 +3122,7 @@
26563122
26573123 refreshContents();
26583124 } else
2659
- if (event.getSource() == detachBumpItem)
3125
+ if (source == detachBumpItem)
26603126 {
26613127 Object3D obj;
26623128 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2667,7 +3133,7 @@
26673133
26683134 refreshContents();
26693135 } else
2670
- if (event.getSource() == pigmentBumpItem)
3136
+ if (source == pigmentBumpItem)
26713137 {
26723138 Object3D obj;
26733139 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2678,158 +3144,237 @@
26783144
26793145 refreshContents();
26803146 } else
2681
- if (event.getSource() == flashSelectionButton)
3147
+ if (source == flashSelectionButton)
26823148 {
26833149 CameraPane.flash = true;
26843150 refreshContents();
26853151 } else
2686
- if (event.getSource() == oneButton)
3152
+ if (source == oneButton)
26873153 {
26883154 } else
2689
- if (event.getSource() == twoButton)
3155
+ if (source == twoButton)
26903156 {
26913157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
26923162 // bug
26933163 //gridPanel.setDividerLocation(1.0);
26943164 //bigPanel.setDividerLocation(0.0);
2695
- bigThree.remove(scenePanel);
2696
- bigThree.remove(centralPanel);
2697
- bigThree.remove(XYZPanel);
2698
- aWindowConstraints.gridx = 0;
2699
- aWindowConstraints.gridy = 0;
2700
- aWindowConstraints.gridwidth = 1;
2701
- // aConstraints.gridheight = 3;
2702
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2703
- aWindowConstraints.weightx = 0;
2704
- aWindowConstraints.weighty = 1;
2705
- //bigThree.add(jtp, aWindowConstraints);
2706
- aWindowConstraints.weightx = 1;
2707
- aWindowConstraints.gridwidth = 3;
2708
- // aConstraints.gridheight = 3;
2709
- aWindowConstraints.gridx = 1;
2710
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2711
- bigThree.add(centralPanel, aWindowConstraints);
2712
- aWindowConstraints.weightx = 0;
2713
- aWindowConstraints.gridx = 4;
2714
- aWindowConstraints.gridwidth = 1;
2715
- // aConstraints.gridheight = 3;
2716
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2717
- //bigThree.add(XYZPanel, aWindowConstraints);
2718
- bigThree.revalidate();
3165
+// bigThree.remove(scenePanel);
3166
+// bigThree.remove(centralPanel);
3167
+// bigThree.remove(XYZPanel);
3168
+// aWindowConstraints.gridx = 0;
3169
+// aWindowConstraints.gridy = 0;
3170
+// aWindowConstraints.gridwidth = 1;
3171
+// // aConstraints.gridheight = 3;
3172
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3173
+// aWindowConstraints.weightx = 0;
3174
+// aWindowConstraints.weighty = 1;
3175
+// //bigThree.add(jtp, aWindowConstraints);
3176
+// aWindowConstraints.weightx = 1;
3177
+// aWindowConstraints.gridwidth = 3;
3178
+// // aConstraints.gridheight = 3;
3179
+// aWindowConstraints.gridx = 1;
3180
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3181
+// bigThree.add(centralPanel, aWindowConstraints);
3182
+// aWindowConstraints.weightx = 0;
3183
+// aWindowConstraints.gridx = 4;
3184
+// aWindowConstraints.gridwidth = 1;
3185
+// // aConstraints.gridheight = 3;
3186
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3187
+// //bigThree.add(XYZPanel, aWindowConstraints);
3188
+// scenePanel.setVisible(false);
3189
+// centralPanel.setVisible(true);
3190
+// XYZPanel.setVisible(false);
3191
+ bigThree.ClearUI();
3192
+ bigThree.add(centralPanel);
3193
+ 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
+
27193212 } else
2720
- if (event.getSource() == threeButton)
3213
+ if (source == threeButton)
27213214 {
27223215 radio.layout = threeButton;
2723
- bigThree.remove(scenePanel);
2724
- bigThree.remove(centralPanel);
2725
- bigThree.remove(XYZPanel);
2726
- aWindowConstraints.gridx = 0;
2727
- aWindowConstraints.gridy = 0;
2728
- aWindowConstraints.gridwidth = 1;
2729
- // aConstraints.gridheight = 3;
2730
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2731
- aWindowConstraints.weightx = 0;
2732
- aWindowConstraints.weighty = 1;
2733
- //bigThree.add(jtp, aWindowConstraints);
2734
- aWindowConstraints.weightx = 1;
2735
- aWindowConstraints.gridwidth = 3;
2736
- // aConstraints.gridheight = 3;
2737
- aWindowConstraints.gridx = 1;
2738
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2739
- bigThree.add(centralPanel, aWindowConstraints);
2740
- aWindowConstraints.weightx = 0;
2741
- aWindowConstraints.gridx = 4;
2742
- aWindowConstraints.gridwidth = 1;
2743
- // aConstraints.gridheight = 3;
2744
- aConstraints.fill = GridBagConstraints.VERTICAL;
2745
- bigThree.add(XYZPanel, aWindowConstraints);
2746
- bigThree.revalidate();
3216
+
3217
+ if (CameraPane.FULLSCREEN)
3218
+ fullscreenLayout = radio.layout;
3219
+
3220
+// bigThree.remove(scenePanel);
3221
+// bigThree.remove(centralPanel);
3222
+// bigThree.remove(XYZPanel);
3223
+// aWindowConstraints.gridx = 0;
3224
+// aWindowConstraints.gridy = 0;
3225
+// aWindowConstraints.gridwidth = 1;
3226
+// // aConstraints.gridheight = 3;
3227
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3228
+// aWindowConstraints.weightx = 0;
3229
+// aWindowConstraints.weighty = 1;
3230
+// //bigThree.add(jtp, aWindowConstraints);
3231
+// aWindowConstraints.weightx = 1;
3232
+// aWindowConstraints.gridwidth = 3;
3233
+// // aConstraints.gridheight = 3;
3234
+// aWindowConstraints.gridx = 1;
3235
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3236
+// bigThree.add(centralPanel, aWindowConstraints);
3237
+// aWindowConstraints.weightx = 0;
3238
+// aWindowConstraints.gridx = 4;
3239
+// aWindowConstraints.gridwidth = 1;
3240
+// // aConstraints.gridheight = 3;
3241
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3242
+// bigThree.add(XYZPanel, aWindowConstraints);
3243
+// bigThree.validate();
3244
+// scenePanel.setVisible(false);
3245
+// centralPanel.setVisible(true);
3246
+// XYZPanel.setVisible(true);
3247
+ bigThree.ClearUI();
3248
+ bigThree.add(centralPanel);
3249
+ bigThree.add(XYZPanel);
3250
+ bigThree.FlushUI();
3251
+
3252
+ cameraView.requestFocusInWindow();
27473253 } else
2748
- if (event.getSource() == fourButton)
3254
+ if (source == fourButton)
27493255 {
27503256 radio.layout = fourButton;
2751
- bigThree.remove(scenePanel);
2752
- bigThree.remove(centralPanel);
2753
- bigThree.remove(XYZPanel);
2754
- aWindowConstraints.gridx = 0;
2755
- aWindowConstraints.gridy = 0;
2756
- aWindowConstraints.gridwidth = 1;
2757
- // aWindowConstraints.gridheight = 3;
2758
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2759
- aWindowConstraints.weightx = 1;
2760
- aWindowConstraints.weighty = 1;
2761
- bigThree.add(scenePanel, aWindowConstraints);
2762
- aWindowConstraints.weightx = 1;
2763
- aWindowConstraints.gridwidth = 3;
2764
- // aConstraints.gridheight = 3;
2765
- aWindowConstraints.gridx = 1;
2766
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2767
- //bigThree.add(cameraPanel, aWindowConstraints);
2768
- aWindowConstraints.weightx = 0;
2769
- aWindowConstraints.gridx = 4;
2770
- aWindowConstraints.gridwidth = 1;
2771
- // aWindowConstraints.gridheight = 3;
2772
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2773
- //bigThree.add(XYZPanel, aWindowConstraints);
2774
- bigThree.revalidate();
3257
+
3258
+ if (CameraPane.FULLSCREEN)
3259
+ fullscreenLayout = radio.layout;
3260
+
3261
+// bigThree.remove(scenePanel);
3262
+// bigThree.remove(centralPanel);
3263
+// bigThree.remove(XYZPanel);
3264
+// aWindowConstraints.gridx = 0;
3265
+// aWindowConstraints.gridy = 0;
3266
+// aWindowConstraints.gridwidth = 1;
3267
+// // aWindowConstraints.gridheight = 3;
3268
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3269
+// aWindowConstraints.weightx = 1;
3270
+// aWindowConstraints.weighty = 1;
3271
+// bigThree.add(scenePanel, aWindowConstraints);
3272
+// aWindowConstraints.weightx = 1;
3273
+// aWindowConstraints.gridwidth = 3;
3274
+// // aConstraints.gridheight = 3;
3275
+// aWindowConstraints.gridx = 1;
3276
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3277
+// //bigThree.add(cameraPanel, aWindowConstraints);
3278
+// aWindowConstraints.weightx = 0;
3279
+// aWindowConstraints.gridx = 4;
3280
+// aWindowConstraints.gridwidth = 1;
3281
+// // aWindowConstraints.gridheight = 3;
3282
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3283
+// //bigThree.add(XYZPanel, aWindowConstraints);
3284
+// bigThree.validate();
3285
+// scenePanel.setVisible(true);
3286
+// centralPanel.setVisible(false);
3287
+// XYZPanel.setVisible(false);
3288
+ bigThree.ClearUI();
3289
+ bigThree.add(scenePanel);
3290
+ bigThree.FlushUI();
3291
+
3292
+ cameraView.requestFocusInWindow();
27753293 } else
2776
- if (event.getSource() == sixButton)
3294
+ if (source == sixButton)
27773295 {
27783296 radio.layout = sixButton;
2779
- bigThree.remove(scenePanel);
2780
- bigThree.remove(centralPanel);
2781
- bigThree.remove(XYZPanel);
2782
- aWindowConstraints.gridx = 0;
2783
- aWindowConstraints.gridy = 0;
2784
- aWindowConstraints.gridwidth = 1;
2785
- // aConstraints.gridheight = 3;
2786
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2787
- aWindowConstraints.weightx = 0;
2788
- aWindowConstraints.weighty = 1;
2789
- bigThree.add(scenePanel, aWindowConstraints);
2790
- aWindowConstraints.weightx = 1;
2791
- aWindowConstraints.gridwidth = 3;
2792
- // aWindowConstraints.gridheight = 3;
2793
- aWindowConstraints.gridx = 1;
2794
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2795
- bigThree.add(centralPanel, aWindowConstraints);
2796
- aWindowConstraints.weightx = 0;
2797
- aWindowConstraints.gridx = 4;
2798
- aWindowConstraints.gridwidth = 1;
2799
- // aWindowConstraints.gridheight = 3;
2800
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2801
- //bigThree.add(XYZPanel, aConstraints);
2802
- bigThree.revalidate();
3297
+
3298
+ if (CameraPane.FULLSCREEN)
3299
+ fullscreenLayout = radio.layout;
3300
+
3301
+// bigThree.remove(scenePanel);
3302
+// bigThree.remove(centralPanel);
3303
+// bigThree.remove(XYZPanel);
3304
+// aWindowConstraints.gridx = 0;
3305
+// aWindowConstraints.gridy = 0;
3306
+// aWindowConstraints.gridwidth = 1;
3307
+// // aConstraints.gridheight = 3;
3308
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3309
+// aWindowConstraints.weightx = 0;
3310
+// aWindowConstraints.weighty = 1;
3311
+// bigThree.add(scenePanel, aWindowConstraints);
3312
+// aWindowConstraints.weightx = 1;
3313
+// aWindowConstraints.gridwidth = 3;
3314
+// // aWindowConstraints.gridheight = 3;
3315
+// aWindowConstraints.gridx = 1;
3316
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3317
+// bigThree.add(centralPanel, aWindowConstraints);
3318
+// aWindowConstraints.weightx = 0;
3319
+// aWindowConstraints.gridx = 4;
3320
+// aWindowConstraints.gridwidth = 1;
3321
+// // aWindowConstraints.gridheight = 3;
3322
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3323
+// //bigThree.add(XYZPanel, aConstraints);
3324
+// bigThree.validate();
3325
+// scenePanel.setVisible(true);
3326
+// centralPanel.setVisible(true);
3327
+// XYZPanel.setVisible(false);
3328
+ bigThree.ClearUI();
3329
+ bigThree.add(scenePanel);
3330
+ bigThree.add(centralPanel);
3331
+ bigThree.FlushUI();
3332
+
3333
+ cameraView.requestFocusInWindow();
28033334 } else
2804
- if (event.getSource() == sevenButton)
3335
+ if (source == sevenButton)
28053336 {
28063337 radio.layout = sevenButton;
2807
- bigThree.remove(scenePanel);
2808
- bigThree.remove(centralPanel);
2809
- bigThree.remove(XYZPanel);
2810
- aWindowConstraints.gridx = 0;
2811
- aWindowConstraints.gridy = 0;
2812
- aWindowConstraints.gridwidth = 1;
2813
- // aWindowConstraints.gridheight = 3;
2814
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2815
- aWindowConstraints.weightx = 0;
2816
- aWindowConstraints.weighty = 1;
2817
- bigThree.add(scenePanel, aWindowConstraints);
2818
- aWindowConstraints.weightx = 1;
2819
- aWindowConstraints.gridwidth = 3;
2820
- // aWindowConstraints.gridheight = 3;
2821
- aWindowConstraints.gridx = 1;
2822
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2823
- bigThree.add(centralPanel, aWindowConstraints);
2824
- aWindowConstraints.weightx = 0;
2825
- aWindowConstraints.gridx = 4;
2826
- aWindowConstraints.gridwidth = 1;
2827
- // aConstraints.gridheight = 3;
2828
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2829
- bigThree.add(XYZPanel, aWindowConstraints);
2830
- bigThree.revalidate();
3338
+
3339
+ if (CameraPane.FULLSCREEN)
3340
+ fullscreenLayout = radio.layout;
3341
+
3342
+// bigThree.remove(scenePanel);
3343
+// bigThree.remove(centralPanel);
3344
+// bigThree.remove(XYZPanel);
3345
+// aWindowConstraints.gridx = 0;
3346
+// aWindowConstraints.gridy = 0;
3347
+// aWindowConstraints.gridwidth = 1;
3348
+// // aWindowConstraints.gridheight = 3;
3349
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3350
+// aWindowConstraints.weightx = 0;
3351
+// aWindowConstraints.weighty = 1;
3352
+// bigThree.add(scenePanel, aWindowConstraints);
3353
+// aWindowConstraints.weightx = 1;
3354
+// aWindowConstraints.gridwidth = 3;
3355
+// // aWindowConstraints.gridheight = 3;
3356
+// aWindowConstraints.gridx = 1;
3357
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3358
+// bigThree.add(centralPanel, aWindowConstraints);
3359
+// aWindowConstraints.weightx = 0;
3360
+// aWindowConstraints.gridx = 4;
3361
+// aWindowConstraints.gridwidth = 1;
3362
+// // aConstraints.gridheight = 3;
3363
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3364
+// bigThree.add(XYZPanel, aWindowConstraints);
3365
+// bigThree.validate();
3366
+// scenePanel.setVisible(true);
3367
+// centralPanel.setVisible(true);
3368
+// XYZPanel.setVisible(true);
3369
+ bigThree.ClearUI();
3370
+ bigThree.add(scenePanel);
3371
+ bigThree.add(centralPanel);
3372
+ bigThree.add(XYZPanel);
3373
+ bigThree.FlushUI();
3374
+
3375
+ cameraView.requestFocusInWindow();
28313376 } else
2832
- if (event.getSource() == rootButton)
3377
+ if (source == rootButton)
28333378 {
28343379 Object3D obj;
28353380 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2839,66 +3384,84 @@
28393384 EditObject(obj);
28403385 }
28413386
3387
+ cameraView.requestFocusInWindow();
28423388 refreshContents(true);
28433389 } else
2844
- if (event.getSource() == closeButton)
3390
+ if (source == closeButton)
28453391 {
28463392 //System.out.println("CLOSE: " + buttonGroup.getSelection());
28473393 cRadio ab;
28483394 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28493395 {
28503396 ab = (cRadio)e.nextElement();
2851
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3397
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28523398 {
3399
+ // Patch to avoid bug with transparency.
3400
+ if (!ab.hadMaterial)
3401
+ {
3402
+ ab.object.material = null;
3403
+ }
3404
+
28533405 buttonGroup.remove(ab);
28543406 radioPanel.remove(ab);
28553407
2856
- ab.GetObject().editWindow = null;
3408
+ //ab.GetObject().editWindow = null;
3409
+ ab.GetObject().manipWindow = null;
28573410 // ab.GetObject().objectUI = null; // ?????????
28583411
28593412 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28603413 break;
28613414 }
28623415 }
3416
+
3417
+ cameraView.requestFocusInWindow();
28633418 refreshContents(true);
28643419 } else
2865
- if (event.getSource() == editItem || event.getSource() == editButton)
3420
+ if (source == editItem || source == editButton)
28663421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
28673428 EditSelection(false);
28683429 } else
2869
- if (event.getSource() == uneditButton)
3430
+ if (source == uneditButton)
28703431 {
28713432 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28723433 {
28733434 Object3D child = (Object3D)e.nextElement();
28743435 if(child.editWindow != null)
28753436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
28763438 child.CloseUI();
28773439 listUI.remove(child);
28783440
2879
- child.editWindow = null; // ???????????
3441
+ //child.editWindow = null; // ???????????
28803442 }
2881
- objEditor.ctrlPanel.revalidate();
3443
+ objEditor.ctrlPanel.FlushUI();
28823444 //objEditor.jTree.clearSelection();
28833445 //objEditor.ResetSliders();
28843446 refreshContents(true);
28853447 } else
2886
- if (event.getSource() == clearPanelButton)
3448
+ if (source == clearPanelButton)
28873449 {
28883450 assert(copy == group);
28893451 //copy.ClearUI();
28903452 for (Object3D obj : listUI)
28913453 {
3454
+ obj.pinned = false;
28923455 obj.CloseUI();
28933456 }
28943457 listUI.clear();
28953458 refreshContents(true);
28963459 } else
2897
- if (event.getSource() == allParamsButton)
3460
+ if (source == allParamsButton)
28983461 {
28993462 assert(copy == group);
29003463
2901
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29023465
29033466 for (Object3D obj : listUI)
29043467 {
....@@ -2915,19 +3478,19 @@
29153478
29163479 refreshContents(true);
29173480 } else
2918
- if (event.getSource() == unselectButton)
3481
+ if (source == unselectButton)
29193482 {
29203483 objEditor.jTree.clearSelection();
29213484 // ?? oct 2012 GrafreeD.clipboard.clear();
29223485 objEditor.ResetSliders();
29233486 refreshContents(true);
29243487 } else
2925
- if(event.getSource() instanceof cRadio)
3488
+ if(source instanceof cRadio)
29263489 {
29273490 group.parent = keepparent;
29283491 group.attributes = 0;
29293492 //group.editWindow = null;
2930
- /*cRadio*/ radio = (cRadio)event.getSource();
3493
+ /*cRadio*/ radio = (cRadio)source;
29313494 Object3D obj = radio.GetObject();
29323495 System.out.println("Edit " + obj);
29333496 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2947,6 +3510,9 @@
29473510 }
29483511
29493512 copy = group;
3513
+
3514
+ SetUndoStates();
3515
+
29503516 //Globals.theRenderer.object = group;
29513517 if(!useclient)
29523518 {
....@@ -2962,20 +3528,44 @@
29623528 frontView.object = group;
29633529 sideView.object = group;
29643530 }
2965
- group.editWindow = this;
3531
+
3532
+// fix "+" issue
3533
+ //group.editWindow = this;
3534
+ group.manipWindow = this;
3535
+
29663536 /*
29673537 currentLayout = radio.layout;
29683538 if (currentLayout == null)
29693539 currentLayout = sevenButton;
29703540 */
29713541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
29723547 keepparent = group.parent;
29733548 // PARENT = NULL or not???
29743549 //group.parent = null; // ROOT
29753550 //group.attributes = -1;
29763551 ResetModel();
3552
+
3553
+ cameraView.requestFocusInWindow();
29773554 refreshContents(true);
2978
- }
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
+ }
29793569 else
29803570 {
29813571 //return super.action(event, arg);
....@@ -2984,7 +3574,6 @@
29843574 }
29853575
29863576 boolean useclient = false;
2987
- cRadio radio;
29883577
29893578 void ToggleRoot()
29903579 {
....@@ -3036,6 +3625,28 @@
30363625 refreshContents();
30373626 }
30383627
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
+ }
30393650
30403651 void ResetTransform()
30413652 {
....@@ -3148,7 +3759,7 @@
31483759 refreshContents();
31493760 }
31503761
3151
- void ResetCentroid()
3762
+ void ResetCentroid(boolean full)
31523763 {
31533764 Object3D obj;
31543765 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3163,12 +3774,16 @@
31633774 LA.matIdentity(Object3D.mat);
31643775 obj.getBounds(minima, maxima, false);
31653776 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3166
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3777
+ if (full)
3778
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31673779 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31683780 obj.TransformMesh(Object3D.mat);
3781
+
31693782 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3170
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3783
+ if (full)
3784
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31713785 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3786
+
31723787 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31733788 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31743789 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3197,7 +3812,8 @@
31973812
31983813 int size = obj.MemorySize();
31993814
3200
- 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)");
32013817 }
32023818 }
32033819 catch (Exception e)
....@@ -3234,9 +3850,9 @@
32343850 obj = (Object3D)e.nextElement();
32353851
32363852 System.out.println("Object is: " + obj);
3237
- GrafreeD.AnalyzeObject(obj);
3853
+ Grafreed.AnalyzeObject(obj);
32383854 System.out.println("Boundary rep: " + obj.bRep);
3239
- GrafreeD.AnalyzeObject(obj.bRep);
3855
+ Grafreed.AnalyzeObject(obj.bRep);
32403856
32413857 // System.err.println((size/1024) + " KB is the size of " + obj);
32423858 }
....@@ -3278,6 +3894,13 @@
32783894 void GenNormals(boolean crease)
32793895 {
32803896 group.GenNormalsS(crease);
3897
+
3898
+ refreshContents();
3899
+ }
3900
+
3901
+ void GenNormalsMESH()
3902
+ {
3903
+ group.GenNormalsMeshS();
32813904
32823905 refreshContents();
32833906 }
....@@ -3450,8 +4073,8 @@
34504073
34514074 void ParseVertices()
34524075 {
3453
- boolean epsequal = GrafreeD.epsequal;
3454
- GrafreeD.epsequal = true;
4076
+ boolean epsequal = Grafreed.epsequal;
4077
+ Grafreed.epsequal = true;
34554078
34564079 for (int i=0; i<group.selection.size(); i++)
34574080 {
....@@ -3476,7 +4099,7 @@
34764099 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34774100 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34784101
3479
- g.add(GrafreeD.clipboard);
4102
+ g.add(Grafreed.clipboard);
34804103
34814104 buffer.add(g);
34824105 }
....@@ -3491,7 +4114,7 @@
34914114 makeSomething(buffer, i==group.selection.size()-1);
34924115 }
34934116
3494
- GrafreeD.epsequal = epsequal;
4117
+ Grafreed.epsequal = epsequal;
34954118
34964119 refreshContents();
34974120 }
....@@ -3509,7 +4132,16 @@
35094132 String pigment = Object3D.GetPigment(tex);
35104133 //String bump = Object3D.GetBump(tex);
35114134
3512
- 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
+ }
35134145
35144146 double s = v.s;
35154147
....@@ -3597,11 +4229,11 @@
35974229
35984230 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35994231
3600
- boolean random = CameraPane.RANDOM;
3601
- CameraPane.RANDOM = false; // parse all random nodes
4232
+ boolean random = CameraPane.SWITCH;
4233
+ CameraPane.SWITCH = false; // parse all random nodes
36024234 lowres.linkVerticesThis(null);
36034235 lowres.linkVerticesThis(sn);
3604
- CameraPane.RANDOM = random;
4236
+ CameraPane.SWITCH = random;
36054237
36064238 System.err.flush();
36074239
....@@ -3641,7 +4273,7 @@
36414273 return;
36424274
36434275 Object3D poses = group.selection.get(0);
3644
- Object3D ref = GrafreeD.clipboard.get(0);
4276
+ Object3D ref = Grafreed.clipboard.get(0);
36454277
36464278 Object3D newgroup = new Object3D("Po:" + poses.name);
36474279
....@@ -3835,9 +4467,9 @@
38354467
38364468 void ClipMesh()
38374469 {
3838
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4470
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38394471 {
3840
- Object3D content = GrafreeD.clipboard.get(0);
4472
+ Object3D content = Grafreed.clipboard.get(0);
38414473
38424474 if (content instanceof cGroup && ((cGroup)content).transientlink )
38434475 content = ((cGroup)content).get(0);
....@@ -3846,7 +4478,7 @@
38464478 // {
38474479 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38484480 // }
3849
- group.selection.ClipMesh(GrafreeD.clipboard);
4481
+ group.selection.ClipMesh(Grafreed.clipboard);
38504482 }
38514483 // group.selection.ClipMesh(GrafreeD.clipboard);
38524484 System.out.println("DONE.");
....@@ -3893,6 +4525,18 @@
38934525 void MarkLeaves(boolean hide)
38944526 {
38954527 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);
38964540 refreshContents();
38974541 }
38984542
....@@ -3967,10 +4611,6 @@
39674611 // }
39684612 // }
39694613
3970
- static boolean allparams = true;
3971
-
3972
- static Vector<Object3D> listUI = new Vector<Object3D>();
3973
-
39744614 void EditSelection(boolean newWindow)
39754615 {
39764616 // aConstraints.gridy = 0;
....@@ -3978,10 +4618,10 @@
39784618 {
39794619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39804620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3981
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39824622
39834623 Object3D elem = (Object3D)group.selection.elementAt(i);
3984
- if(elem != group)
4624
+ if(elem != group || !newWindow)
39854625 {
39864626 // if (!(elem instanceof Composite))
39874627 // newWindow = false;
....@@ -4063,7 +4703,8 @@
40634703 //new Exception().printStackTrace();
40644704
40654705 freezemodel = true;
4066
-
4706
+ ClearUnpinned();
4707
+
40674708 /**/
40684709 //switch (event.id)
40694710 {
....@@ -4071,7 +4712,6 @@
40714712 //case 702: // Event.LIST_DESELECT
40724713 group.deselectAll();
40734714 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4074
- objEditor.ClearInfo(); // .GetMaterial());
40754715 if (tps != null)
40764716 {
40774717 for (int i=0; i < tps.length; i++)
....@@ -4080,33 +4720,39 @@
40804720
40814721 //if (child.parent != null)
40824722 //child.parent.addSelectee(child);
4723
+ objEditor.SetMaterial(child);
40834724 group.addSelectee(child);
4084
- objEditor.SetMaterial(child); // .GetMaterial());
4085
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4086
- System.err.println("info : " + child.GetPath());
40874725 }
40884726 }
4089
- else
4090
- {
4091
- objEditor.SetMaterial(group); // .GetMaterial());
4092
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4093
- System.err.println("info : " + group.GetPath());
4094
- }
4727
+// else
4728
+// {
4729
+// objEditor.SetMaterial(group); // .GetMaterial());
4730
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4731
+// System.err.println("info : " + group.GetPath());
4732
+// }
40954733
4096
- objEditor.SetText(); // jan 2014
4097
-
4098
- 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))
40994735 CameraPane.flash = true;
41004736
4101
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4737
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41024738 // a camera
41034739 {
4104
- CameraPane.camerachangeframe = 0; // don't refuse it
4105
- 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
+ }
41064745 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41074746 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41084747 }
41094748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
41104756 refreshContents();
41114757 //return true;
41124758 }
....@@ -4115,6 +4761,35 @@
41154761
41164762 freezemodel = false;
41174763 }
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
+ }
41184793
41194794 void linkSomething(Object3D thing)
41204795 {
....@@ -4186,16 +4861,19 @@
41864861 {
41874862 if (group.selection.isEmpty())
41884863 return;
4189
- GrafreeD.clipboardIsTempGroup = false;
4864
+
4865
+ Grafreed.clipboardIsTempGroup = false;
41904866 Composite tGroup = null;
41914867 if (group.selection.size() > 0) // 1)
41924868 {
41934869 tGroup = new cGroup();
4194
- GrafreeD.clipboardIsTempGroup = true;
4870
+ Grafreed.clipboardIsTempGroup = true;
41954871 }
41964872
41974873 if (cut)
41984874 {
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
41994877 //int indices[] = jList.getSelectedIndices();
42004878 //for (int i = indices.length - 1; i >= 0; i--)
42014879 //jList.remove(indices[i]);
....@@ -4231,16 +4909,16 @@
42314909 //System.out.println("cut " + child);
42324910 //System.out.println("parent = " + child.parent);
42334911 // tmp.addChild(child);
4234
- if (GrafreeD.clipboardIsTempGroup)
4912
+ if (Grafreed.clipboardIsTempGroup)
42354913 tGroup.add/*Child*/(tmp);
42364914 else
4237
- GrafreeD.clipboard = tmp;
4915
+ Grafreed.clipboard = tmp;
42384916 }
42394917 else
4240
- if (GrafreeD.clipboardIsTempGroup)
4918
+ if (Grafreed.clipboardIsTempGroup)
42414919 tGroup.add/*Child*/(child);
42424920 else
4243
- GrafreeD.clipboard = child;
4921
+ Grafreed.clipboard = child;
42444922 }
42454923
42464924 //ResetModel();
....@@ -4272,21 +4950,23 @@
42724950 //System.out.println("cut " + elem);
42734951 //System.out.println("parent = " + elem.parent);
42744952 // tmp.addChild(elem);
4275
- if (GrafreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
42764954 tGroup.add/*Child*/(tmp);
42774955 else
4278
- GrafreeD.clipboard = tmp;
4956
+ Grafreed.clipboard = tmp;
42794957 }
42804958 else
4281
- if (GrafreeD.clipboardIsTempGroup)
4959
+ if (Grafreed.clipboardIsTempGroup)
42824960 tGroup.add/*Child*/(child);
42834961 else
4284
- GrafreeD.clipboard = child;
4962
+ Grafreed.clipboard = child;
42854963 }
42864964
42874965 }
4288
- if (GrafreeD.clipboardIsTempGroup)
4289
- GrafreeD.clipboard = tGroup;
4966
+
4967
+ if (Grafreed.clipboardIsTempGroup)
4968
+ Grafreed.clipboard = tGroup;
4969
+
42904970 if (cut)
42914971 {
42924972 ResetModel();
....@@ -4296,11 +4976,15 @@
42964976
42974977 void paste(boolean expand)
42984978 {
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
42994983 // if (GrafreeD.clipboard == null)
43004984 // return;
43014985 boolean first = true;
43024986
4303
- if (GrafreeD.clipboardIsTempGroup)
4987
+ if (Grafreed.clipboardIsTempGroup)
43044988 {
43054989 Composite temp;
43064990
....@@ -4311,7 +4995,7 @@
43114995 temp = (Composite)Applet3D.clipboard.deepCopy();
43124996 */
43134997 Object3D elem;
4314
- 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))
43154999 {
43165000 Object3D child = (Object3D)e.nextElement();
43175001
....@@ -4345,21 +5029,22 @@
43455029 //Object3D cb = Applet3D.clipboard;
43465030 //temp.addChild(cb);
43475031 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4348
- assert(GrafreeD.clipboard.parent == null);
4349
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4350
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4351
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4352
- 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());
43535037 else
4354
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4355
- GrafreeD.clipboard.get(0).parent = keepparent;
5038
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5039
+ Grafreed.clipboard.get(0).parent = keepparent;
43565040 }
43575041
5042
+ Globals.REPLACEONMAKE = keep;
43585043 ResetModel();
43595044 refreshContents();
43605045 }
43615046
4362
- void pasteInto(boolean copyit)
5047
+ void pasteInto(boolean copyit, boolean clone)
43635048 {
43645049 // if (GrafreeD.clipboard == null)
43655050 // return;
....@@ -4388,15 +5073,22 @@
43885073 if (copyit)
43895074 {
43905075 // paste(false);
4391
- CloneClipboard(false); // sept 2014
5076
+ if (clone)
5077
+ {
5078
+ CloneClipboard(false); // sept 2014
5079
+ }
5080
+ else
5081
+ {
5082
+ paste(false);
5083
+ }
43925084 }
43935085 else
43945086 {
43955087 boolean first = true;
43965088
4397
- if (GrafreeD.clipboardIsTempGroup)
5089
+ if (Grafreed.clipboardIsTempGroup)
43985090 {
4399
- Composite temp = (Composite)GrafreeD.clipboard;
5091
+ Composite temp = (Composite)Grafreed.clipboard;
44005092 Object3D copy;
44015093 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44025094 {
....@@ -4406,7 +5098,7 @@
44065098 }
44075099 } else
44085100 {
4409
- linkSomething(GrafreeD.clipboard); //.get(0));
5101
+ linkSomething(Grafreed.clipboard); //.get(0));
44105102 }
44115103 }
44125104 }
....@@ -4483,6 +5175,10 @@
44835175
44845176 void group(Object3D csg, boolean grab)
44855177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
44865182 if (//false) // why??
44875183 !group.selection.isEmpty())
44885184 {
....@@ -4596,10 +5292,15 @@
45965292 //node.add(csg);
45975293 //makeSomething(node);
45985294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
45995296 }
46005297
46015298 void Ungroup(Object3D g)
46025299 {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
46035304 if (g instanceof HiddenObject)
46045305 {
46055306 HiddenObject h = (HiddenObject) g;
....@@ -4616,6 +5317,7 @@
46165317 objEditor.makeSomething(g.get(i), false);
46175318 }
46185319 }
5320
+ Globals.REPLACEONMAKE = keep;
46195321 }
46205322
46215323 void ungroup()
....@@ -4811,21 +5513,6 @@
48115513 }
48125514 */
48135515
4814
- void ImportGFD()
4815
- {
4816
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4817
- browser.show();
4818
- String filename = browser.getFile();
4819
- if (filename != null && filename.length() > 0)
4820
- {
4821
- String fullname = browser.getDirectory() + filename;
4822
-
4823
- //Object3D readobj =
4824
- objEditor.ReadGFD(fullname, objEditor);
4825
- //makeSomething(readobj);
4826
- }
4827
- }
4828
-
48295516 /*
48305517 public void Callback(Object obj)
48315518 {
....@@ -4849,26 +5536,9 @@
48495536 }
48505537 */
48515538
4852
- void ImportVRMLX3D()
4853
- {
4854
- if (GrafreeD.standAlone)
4855
- {
4856
- /**/
4857
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4858
- browser.show();
4859
- String filename = browser.getFile();
4860
- if (filename != null && filename.length() > 0)
4861
- {
4862
- String fullname = browser.getDirectory() + filename;
4863
- LoadVRMLX3D(fullname);
4864
- }
4865
- /**/
4866
- }
4867
- }
4868
-
48695539 String GetFile(String dialogName)
48705540 {
4871
- if (GrafreeD.standAlone)
5541
+ if (Grafreed.standAlone)
48725542 {
48735543 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48745544 browser.show();
....@@ -4932,10 +5602,33 @@
49325602 cButton flashSelectionButton;
49335603 cButton editButton;
49345604 cButton uneditButton;
5605
+ JCheckBox allParamsButton;
49355606 cButton clearpanelButton;
4936
- cButton allParamsButton;
49375607 cButton unselectButton;
49385608
5609
+ cButton restoreCameraButton;
5610
+
5611
+ cButton saveButton;
5612
+ 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;
5631
+
49395632 cButton screenfitButton;
49405633 cButton screenfitpointButton;
49415634 cButton snapobjectButton;
....@@ -4947,14 +5640,6 @@
49475640
49485641 cButton setsupportButton;
49495642
4950
- cButton twoButton;
4951
- cButton sixButton;
4952
- cButton threeButton;
4953
- cButton sevenButton;
4954
- cButton fourButton; // full panel
4955
- cButton oneButton; // full XYZ
4956
- //cButton currentLayout;
4957
-
49585643 //
49595644 //Composite
49605645 Object3D // to do !!
....@@ -4964,9 +5649,11 @@
49645649 //JTree jTree;
49655650 private MenuItem lookAtItem;
49665651 private MenuItem lookFromItem;
4967
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
49685653 private MenuItem cutItem;
4969
- private MenuItem duplicateItem;
5654
+ private MenuItem undoItem;
5655
+ private MenuItem redoItem;
5656
+ private JMenuItem duplicateItem;
49705657 private MenuItem cloneItem;
49715658 private MenuItem cloneSupportItem;
49725659 private MenuItem overwriteGeoItem;
....@@ -4979,7 +5666,7 @@
49795666 private MenuItem linkverticesItem;
49805667 private MenuItem relinkverticesItem;
49815668 private MenuItem setMasterItem;
4982
- private MenuItem resetMeshItem;
5669
+ private MenuItem resetAllItem;
49835670 private MenuItem stepAllItem;
49845671 private MenuItem revertMeshItem;
49855672 private MenuItem poseMeshItem;
....@@ -4990,6 +5677,7 @@
49905677 private MenuItem mergeGeometriesItem;
49915678 private MenuItem copyItem;
49925679 private MenuItem pasteItem;
5680
+ private MenuItem pasteIntoItem;
49935681 private MenuItem pasteLinkItem;
49945682 private MenuItem pasteCloneItem;
49955683 private MenuItem pasteExpandItem;
....@@ -5028,6 +5716,10 @@
50285716 private MenuItem showleavesItem;
50295717 private MenuItem markleavesItem;
50305718 private MenuItem unmarkleavesItem;
5719
+ private MenuItem rewindleavesItem;
5720
+ private MenuItem unrewindleavesItem;
5721
+ private MenuItem randomleavesItem;
5722
+ private MenuItem unrandomleavesItem;
50315723
50325724 private MenuItem flipVItem;
50335725 private MenuItem unflipVItem;
....@@ -5039,15 +5731,17 @@
50395731 private MenuItem panoTexturesItem;
50405732
50415733 private MenuItem resetCentroidItem;
5042
- private MenuItem transformgeometryItem;
5734
+ private MenuItem resetCentroidXZItem;
50435735 private MenuItem resetTransformItem;
5736
+ private MenuItem transformGeometryItem;
5737
+ private MenuItem transformChildrenItem;
50445738 private MenuItem hideItem;
50455739 private MenuItem grabItem;
50465740 private MenuItem backItem;
50475741 private MenuItem frontItem;
50485742 private MenuItem cameraItem;
50495743 private MenuItem compositeItem;
5050
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
50515745 private MenuItem physicsItem;
50525746 private MenuItem frameselectorItem;
50535747 private MenuItem scriptNodeItem;
....@@ -5087,7 +5781,7 @@
50875781 private MenuItem blobItem;
50885782 private MenuItem latheItem;
50895783 private MenuItem bezierItem;
5090
- private MenuItem checkerItem;
5784
+ private MenuItem overlayItem;
50915785 private MenuItem meshItem;
50925786 // private MenuItem meshGroupItem;
50935787 private MenuItem springItem;
....@@ -5109,11 +5803,6 @@
51095803 private MenuItem doubleItem;
51105804 private MenuItem tripleItem;
51115805
5112
- private MenuItem importGFDItem;
5113
- private MenuItem importVRMLX3DItem;
5114
- private MenuItem import3DSItem;
5115
- private MenuItem importOBJItem;
5116
-
51175806 private MenuItem computeAOItem;
51185807 private MenuItem recompileItem;
51195808 private MenuItem editScriptItem;
....@@ -5123,4 +5812,8 @@
51235812 private MenuItem analyzeItem;
51245813 private MenuItem dumpItem;
51255814 //boolean freezemodel = false;
5815
+
5816
+ Menu cameraMenu;
5817
+ MenuItem editCameraItem;
5818
+ MenuItem restoreCameraItem;
51265819 }