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,73 +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);
326
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
327
+ relinkverticesItem.addActionListener(this);
328
+
329
+ if (Globals.ADVANCED)
330
+ {
222331 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223332 setMasterItem.addActionListener(this);
333
+ }
224334
225335 oe.menuBar.add(menu = new Menu("Group"));
226
- grabItem = menu.add(new MenuItem("Grab"));
227
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
228338 backItem = menu.add(new MenuItem("Back"));
229339 backItem.addActionListener(this);
230340 frontItem = menu.add(new MenuItem("Front"));
231341 frontItem.addActionListener(this);
232
- compositeItem = menu.add(new MenuItem("Composite"));
233
- compositeItem.addActionListener(this);
234
- menu.add("-");
235
- randomItem = menu.add(new MenuItem("Random"));
236
- randomItem.addActionListener(this);
237
- physicsItem = menu.add(new MenuItem("Physics"));
238
- physicsItem.addActionListener(this);
239
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
240
- frameselectorItem.addActionListener(this);
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"));
348
+ hideItem.addActionListener(this);
349
+ }
350
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
351
+ ungroupItem.addActionListener(this);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
241359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
242360 switchGeoItem.addActionListener(this);
243361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
244362 switchTransfoItem.addActionListener(this);
245
- morphItem = menu.add(new MenuItem("Morph"));
363
+ morphItem = menu.add(new MenuItem("Morph Group"));
246364 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);
247371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
248372 scriptNodeItem.addActionListener(this);
249
- cameraItem = menu.add(new MenuItem("Camera"));
250
- cameraItem.addActionListener(this);
373
+ }
251374
252375 oe.menuBar.add(menu = new Menu("Object"));
253
- textureItem = menu.add(new MenuItem("Texture"));
254
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
378
+ billboardItem = menu.add(new MenuItem("Billboard"));
379
+ billboardItem.addActionListener(this);
255380 csgItem = menu.add(new MenuItem("CSG"));
256381 csgItem.addActionListener(this);
257
- shadowXItem = menu.add(new MenuItem("Shadow X"));
382
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
258383 shadowXItem.addActionListener(this);
259
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
384
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
260385 shadowYItem.addActionListener(this);
261
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
386
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
262387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
391
+ if (Globals.ADVANCED)
392
+ {
393
+ menu.add("-");
263394 linkerItem = menu.add(new MenuItem("Linker"));
264395 linkerItem.addActionListener(this);
265396 templateItem = menu.add(new MenuItem("Template"));
266397 templateItem.addActionListener(this);
267
- attributeItem = menu.add(new MenuItem("Attribute"));
268
- attributeItem.addActionListener(this);
269398 pointflowItem = menu.add(new MenuItem("Point Flow"));
270399 pointflowItem.addActionListener(this);
400
+ }
271401 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274402 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275403 resetTransformItem.addActionListener(this);
276404 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277405 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.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);
280412
281413 oe.menuBar.add(menu = new Menu("Geometry"));
282414 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -285,6 +417,13 @@
285417 genNormalsORGANItem.addActionListener(this);
286418 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
287419 genNormalsCADItem.addActionListener(this);
420
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
421
+ genNormalsMESHItem.addActionListener(this);
422
+ if (Globals.ADVANCED)
423
+ {
424
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
425
+ genNormalsMINEItem.addActionListener(this);
426
+ }
288427 stripifyItem = menu.add(new MenuItem("Stripify"));
289428 stripifyItem.addActionListener(this);
290429 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -306,23 +445,34 @@
306445 reduce34MeshItem.addActionListener(this);
307446 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308447 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311448 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312449 clipMeshItem.addActionListener(this);
450
+
451
+ if (Globals.ADVANCED)
452
+ {
453
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
454
+ smoothMeshItem.addActionListener(this);
455
+ }
313456
314457 oe.menuBar.add(menu = new Menu("Attributes"));
315458 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
316459 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);
317464 menu.add("-");
318465 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
319466 liveleavesItem.addActionListener(this);
320467 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
321468 unliveleavesItem.addActionListener(this);
469
+ if (Globals.ADVANCED)
470
+ {
322471 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
323472 supportleavesItem.addActionListener(this);
324473 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
325474 unsupportleavesItem.addActionListener(this);
475
+ }
326476 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
327477 hideleavesItem.addActionListener(this);
328478 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -331,6 +481,14 @@
331481 markleavesItem.addActionListener(this);
332482 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
333483 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);
334492 menu.add("-");
335493 flipVItem = menu.add(new MenuItem("Flip V"));
336494 flipVItem.addActionListener(this);
....@@ -366,35 +524,41 @@
366524 sortbynameItem = menu.add(new MenuItem("Sort by name"));
367525 sortbynameItem.addActionListener(this);
368526 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.
369534 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
370535 extractGeometriesItem.addActionListener(this);
371536 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
372537 cloneGeometriesItem.addActionListener(this);
373
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
374
- shareGeometriesItem.addActionListener(this);
375
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
376
- mergeGeometriesItem.addActionListener(this);
538
+ }
377539
378540 oe.menuBar.add(menu = new Menu("Insert"));
379541 buildCreateMenu(menu);
380542
381
-
382
- oe.menuBar.add(menu = new Menu("Include"));
383
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
384
- importGFDItem.addActionListener(this);
385
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
386
- importVRMLX3DItem.addActionListener(this);
387
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
388
- importOBJItem.addActionListener(this);
389
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
390
- import3DSItem.addActionListener(this);
391
-
392543 oe.menuBar.add(menu = new Menu("Tools"));
393544 buildToolsMenu(menu);
394545 }
395546
547
+
396548 void SetupUI2(ObjEditor oe)
397549 {
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
+
398562 //new Exception().printStackTrace();
399563
400564 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -423,150 +587,230 @@
423587 oe.radioPanel.add(dummyButton);
424588 oe.buttonGroup.add(dummyButton);
425589 */
426
- aConstraints.gridy += 1;
427
- oe.aConstraints.gridwidth = 1;
428
- oe.aConstraints.gridx = 0;
590
+ cGridBag copyOptionsPanel = new cGridBag();
591
+
592
+ copyOptionsPanel.preferredHeight = 1;
429593
430
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
594
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
595
+
596
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ //minButton.setToolTipText("Minimize window");
598
+ //minButton.addActionListener(this);
599
+
600
+ if (Globals.ADVANCED)
601
+ {
602
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
+ maxButton.setToolTipText("Maximize window");
604
+ maxButton.addActionListener(this);
605
+ }
606
+
607
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ fullButton.setToolTipText("Full-screen window");
609
+ fullButton.addActionListener(this);
610
+
611
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ screenfitButton.setToolTipText("Screen fit");
613
+ screenfitButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ restoreCameraButton.setToolTipText("Restore viewpoint");
617
+ restoreCameraButton.addActionListener(this);
618
+
619
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ saveButton.setToolTipText("New version");
621
+ saveButton.addActionListener(this);
622
+
623
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ undoButton.setToolTipText("Previous version");
625
+ undoButton.addActionListener(this);
626
+ undoButton.setEnabled(false);
627
+
628
+ cGridBag updown = new cGridBag().setVertical(true);
629
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreButton.setToolTipText("Restore current");
631
+ restoreButton.addActionListener(this);
632
+ restoreButton.setEnabled(false);
633
+
634
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ replaceButton.setToolTipText("Replace current");
636
+ replaceButton.addActionListener(this);
637
+ replaceButton.setEnabled(false);
638
+
639
+ copyOptionsPanel.add(updown);
640
+
641
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ redoButton.setToolTipText("Next version");
643
+ redoButton.addActionListener(this);
644
+ redoButton.setEnabled(false);
645
+
646
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
647
+ liveCB.setToolTipText("Enable animation");
431648 liveCB.addItemListener(this);
432649
433
- oe.aConstraints.gridx += 1;
434
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
435
- supportCB.addItemListener(this);
436
-
437
- // oe.aConstraints.gridx += 1;
438
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
439
- // localCB.addItemListener(this);
440
-
441
- oe.aConstraints.gridx += 1;
442
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
443
- crowdCB.addItemListener(this);
444
-
445
- oe.aConstraints.gridx += 1;
446
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
447
- smoothCB.addItemListener(this);
448
-
449
- oe.aConstraints.gridx += 1;
450
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
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");
451656 fastCB.addItemListener(this);
452
- oe.aConstraints.gridx += 1;
453
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
454
- slowCB.addItemListener(this);
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
457
- boxCB.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);
458663
459
-// oe.aConstraints.gridx += 1;
460
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
461
-// speakerMocapCB.addItemListener(this);
462
-
463
- if (false)
464
- {
465
- // handled in scripts
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
468
- speakerCameraCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
472
- speakerFocusCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
476
- smoothfocusCB.addItemListener(this);
477
- }
478
-
479
-//oe.aConstraints.gridx += 1;
480
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
481
-// debugCB.addItemListener(this);
482
-
483
- oe.aConstraints.gridx += 1;
484
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
485
- oeilCB.addItemListener(this);
486
-
487
- oe.aConstraints.gridx += 1;
488
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
489
- lookAtCB.addItemListener(this);
490
-
491
- oe.aConstraints.gridx += 1;
492
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
493
- trackCB.addItemListener(this);
494
-
495
- oe.aConstraints.gridx += 1;
496
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
497
- screenfitButton.addActionListener(this);
498
- oe.aConstraints.gridx += 1;
499664 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
500665 // screenfitpointButton.addActionListener(this);
501
-// oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
503
- snapobjectButton.addActionListener(this);
504
- oe.aConstraints.gridx += 1;
505666
506
- //aConstraints.gridx = 0;
507
- //aConstraints.gridy += 1;
508
- oe.aConstraints.weighty = 0;
509
- oe.aConstraints.gridwidth = 1;
510
-
511
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
512
- flashSelectionButton.addActionListener(this);
513
- oe.aConstraints.gridx += 1;
514
- oe.aConstraints.weighty = 0;
515
- oe.aConstraints.gridwidth = 1;
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));
516675
517
- //
518
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
677
+ twoButton.setToolTipText("Show center view only");
519678 twoButton.addActionListener(this);
520
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
679
+ this.fullscreenLayout = twoButton;
680
+
681
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521682 fourButton.addActionListener(this);
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
683
+ fourButton.setToolTipText("Show left panel only");
684
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
685
+ sixButton.setToolTipText("2-column layout left");
523686 sixButton.addActionListener(this);
524
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
687
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ threeButton.setToolTipText("2-column layout right");
525689 threeButton.addActionListener(this);
526
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
691
+ sevenButton.setToolTipText("3-column layout");
527692 sevenButton.addActionListener(this);
528693 //
529694
530
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
695
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696
+ rootButton.setToolTipText("Edit selection in new tab");
531697 rootButton.addActionListener(this);
532
- oe.aConstraints.gridx += 1;
533
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
698
+
699
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ closeButton.setToolTipText("Close tab");
534701 closeButton.addActionListener(this);
535702 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
536703 //clearButton.addActionListener(this);
537
- oe.aConstraints.gridx += 1;
538
-
539
- oe.aConstraints.gridx = 1; //
540
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
541
- editButton.addActionListener(this);
542
- oe.aConstraints.gridx += 1;
543
- oe.aConstraints.weighty = 0;
544
- oe.aConstraints.gridwidth = 1;
545704
546
- 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");
547790 uneditButton.addActionListener(this);
548791
549
- oe.aConstraints.gridx += 1;
550
- oe.aConstraints.weighty = 0;
551
- oe.aConstraints.gridwidth = 1;
552
-
553
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
554
- clearPanelButton.addActionListener(this);
555
-
556
- oe.aConstraints.gridx += 1;
557
- oe.aConstraints.weighty = 0;
558
- oe.aConstraints.gridwidth = 1;
559
-
560
- 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");
561794 allParamsButton.addActionListener(this);
562795
563
- oe.aConstraints.gridx += 1;
564
- oe.aConstraints.weighty = 0;
565
- oe.aConstraints.gridwidth = 1;
566
-
567
- 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");
568802 unselectButton.addActionListener(this);
569803
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
+
570814 // oe.aConstraints.gridx += 1;
571815 // oe.aConstraints.weighty = 0;
572816 // oe.aConstraints.gridwidth = 1;
....@@ -578,40 +822,25 @@
578822 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
579823 // gcButton.addActionListener(this);
580824
581
- oe.aConstraints.gridx = 0;
582
- oe.aConstraints.gridy += 1;
583
-
584
- //ctrlPanel.add(objList = new List(5, true));
585
- oe.aConstraints.gridwidth = 100;
586
- // oe.aConstraints.gridheight = 100;
587
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
588
- oe.aConstraints.gridheight = 1;
589
- oe.aConstraints.weighty = 0.5;
590
- oe.aConstraints.gridx = 0;
591
- JScrollPane jSP;
825
+ cGridBag jSPPanel = new cGridBag();
826
+
827
+ JScrollPane jSP;
592828 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
593
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
829
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
594830 ResetModel();
595
- oe.aConstraints.weighty = 0.5;
596
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
597
- oe.aConstraints.gridy += 1;
598
- oe.aConstraints.gridwidth = 1;
599
-
600
- oe.aConstraints.weighty = 0;
601
- oe.aConstraints.gridwidth = 2;
602
-
603
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
604
- colorCB.addItemListener(this);
605
- oe.aConstraints.gridx += 2;
606
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
607
- materialCB.addItemListener(this);
608
- oe.aConstraints.gridx += 2;
609
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
610
- textureCB.addItemListener(this);
611
-
612
- oe.aConstraints.gridx = 0;
613
- oe.aConstraints.gridy += 1;
614831
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
+
615844 //jList.addListSelectionListener(this);
616845 oe.jTree.addTreeSelectionListener(this);
617846 //jTree.setRootVisible(false);
....@@ -633,20 +862,157 @@
633862 radio.layout = sevenButton;
634863 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
635864 }
865
+
866
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
867
+ {
868
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
869
+ colorCB.setToolTipText("Copy color when dropped");
870
+ colorCB.addItemListener(this);
871
+
872
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
873
+ materialCB.setToolTipText("Copy material when dropped");
874
+ materialCB.addItemListener(this);
875
+
876
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
877
+ textureCB.setToolTipText("Copy texture when dropped");
878
+ textureCB.addItemListener(this);
879
+
880
+ panel.Return();
881
+
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
+
900
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
901
+ // localCB.addItemListener(this);
902
+
903
+ panel.Return();
904
+
905
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
906
+ crowdCB.setToolTipText("Used for crowds");
907
+ crowdCB.addItemListener(this);
908
+
909
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
910
+ smoothCB.setToolTipText("Snapping delay");
911
+ smoothCB.addItemListener(this);
912
+
913
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
914
+ slowCB.setToolTipText("Smooth interpolation");
915
+ slowCB.addItemListener(this);
916
+
917
+// constraints.gridy += 1;
918
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
919
+// speakerMocapCB.addItemListener(this);
920
+
921
+ panel.Return();
922
+
923
+ if (false)
924
+ {
925
+ // handled in scripts
926
+ //constraints.gridy += 1;
927
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
928
+ speakerCameraCB.addItemListener(this);
929
+
930
+ //constraints.gridy += 1;
931
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
932
+ speakerFocusCB.addItemListener(this);
933
+
934
+ //constraints.gridy += 1;
935
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
936
+ smoothfocusCB.addItemListener(this);
937
+ panel.Return();
938
+ }
939
+
940
+//constraints.gridx += 1;
941
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
942
+// debugCB.addItemListener(this);
943
+
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");
950
+ oeilCB.addItemListener(this);
951
+
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);
973
+ lookAtCB.setToolTipText("Look-at target");
974
+ 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);
989
+
990
+ }
636991
637992 void EditObject(Object3D obj)
638993 {
639
- cRadio dummyButton = new cRadio(obj.name);
640
- dummyButton.SetObject(obj);
641
- dummyButton.layout = sevenButton;
642
- dummyButton.SetCamera(cameraView.renderCamera, false);
643
- dummyButton.addActionListener(this);
644
- radioPanel.add(dummyButton);
645
- buttonGroup.add(dummyButton);
646
- dummyButton.doClick();
994
+ 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
+
1003
+ radioButton.SetObject(obj);
1004
+ radioButton.layout = sevenButton;
1005
+ radioButton.SetCamera(cameraView.renderCamera, false);
1006
+ radioButton.addActionListener(this);
1007
+ radioPanel.add(radioButton);
1008
+ buttonGroup.add(radioButton);
1009
+ radioButton.doClick();
6471010 }
1011
+
6481012 void SetupViews(ObjEditor oe)
6491013 {
1014
+ theFrame = this;
1015
+
6501016 oe.SetupViews();
6511017
6521018 System.out.println("SetupViews");
....@@ -655,22 +1021,28 @@
6551021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6561022 }
6571023
658
- JCheckBox liveCB;
659
- JCheckBox supportCB;
660
- JCheckBox localCB;
661
- JCheckBox crowdCB;
662
- JCheckBox smoothCB;
663
- JCheckBox fastCB;
664
- JCheckBox slowCB;
665
- JCheckBox boxCB;
666
- JCheckBox trackCB;
667
- 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;
6681037 // JCheckBox speakerMocapCB;
669
- JCheckBox speakerCameraCB;
670
- JCheckBox speakerFocusCB;
671
- JCheckBox debugCB;
672
- JCheckBox oeilCB;
673
- JCheckBox lookAtCB;
1038
+ cCheckBox speakerCameraCB;
1039
+ cCheckBox speakerFocusCB;
1040
+ cCheckBox debugCB;
1041
+
1042
+ cCheckBox oeilCB;
1043
+ cCheckBox shadowCB;
1044
+ cCheckBox autokeepCB;
1045
+ cCheckBox lookAtCB;
6741046
6751047 // static int COLOR = 1;
6761048 // static int MATERIAL = 2;
....@@ -678,9 +1050,9 @@
6781050
6791051 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6801052
681
- JCheckBox colorCB;
682
- JCheckBox materialCB;
683
- JCheckBox textureCB;
1053
+ cCheckBox colorCB;
1054
+ cCheckBox materialCB;
1055
+ cCheckBox textureCB;
6841056
6851057 public void itemStateChanged(ItemEvent e)
6861058 {
....@@ -705,10 +1077,10 @@
7051077 dropAttributes |= Object3D.TEXTURE;
7061078 else
7071079 dropAttributes &= ~Object3D.TEXTURE;
708
- }
709
- else if(e.getSource() == liveCB)
1080
+ } else if(e.getSource() == liveCB)
7101081 {
7111082 cameraView.ToggleLive();
1083
+ refreshContents(false);
7121084 }
7131085 else if(e.getSource() == supportCB)
7141086 {
....@@ -744,6 +1116,10 @@
7441116 cameraView.repaint();
7451117 // refreshContents();
7461118 }
1119
+ else if(e.getSource() == zoomBoxCB)
1120
+ {
1121
+ cameraView.ToggleZoomBoxMode();
1122
+ }
7471123 else if(e.getSource() == smoothfocusCB)
7481124 {
7491125 cameraView.ToggleSmoothFocus();
....@@ -769,6 +1145,18 @@
7691145 {
7701146 cameraView.ToggleOeil();
7711147 }
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
+ }
7721160 else if(e.getSource() == lookAtCB)
7731161 {
7741162 cameraView.ToggleLookAt();
....@@ -785,7 +1173,8 @@
7851173
7861174 /**/
7871175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
788
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
7891178 if ((path == null) || (path.getPathCount() <= 1)) {
7901179 // We can't move the root node or an empty selection
7911180 return;
....@@ -848,8 +1237,6 @@
8481237 }
8491238 }
8501239
851
- String string = (String) object;
852
-
8531240 System.out.println("Transfer = " + object + "; drop : " + target);
8541241 // if( object instanceof java.io.File[])
8551242 // {
....@@ -857,7 +1244,11 @@
8571244 // objEditor.DropFile((java.io.File[]) object, true);
8581245 // return;
8591246 // }
860
- 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) == ':')
8611252 {
8621253 // file(s)
8631254 String[] names = string.split("\n");
....@@ -884,7 +1275,7 @@
8841275
8851276 flashIt = false;
8861277 CameraPane pane = (CameraPane) target;
887
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1278
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8881279 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8891280
8901281 if (group.selection.size() == 1)
....@@ -900,23 +1291,33 @@
9001291
9011292 assert target == objEditor.jTree;
9021293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
9031295 try {
904
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9051297 } catch (Exception e) {
9061298 System.out.println("destinationPath : " + destinationPath);
9071299 return;
9081300 }
9091301
910
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
9111303 {
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
+// {
9121313 loadClipboard(true);
9131314 objEditor.jTree.setSelectionPath(destinationPath);
914
- pasteInto(false);
915
- } else {
916
- loadClipboard(false);
917
- objEditor.jTree.setSelectionPath(destinationPath);
918
- pasteInto(false); // true); // ???
919
- }
1315
+ pasteInto(false, false);
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
9201321 }
9211322 public void dropActionChanged(DropTargetDragEvent dtde)
9221323 // Called if the user has modified the current drop gesture
....@@ -1021,83 +1422,107 @@
10211422 {
10221423 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10231424 //heightFieldItem.addActionListener(this);
1024
- gridItem = menu.add(new MenuItem("Grid"));
1025
- gridItem.addActionListener(this);
1026
- rectoidItem = menu.add(new MenuItem("Box"));
1027
- rectoidItem.addActionListener(this);
1028
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1029
- ellipsoidItem.addActionListener(this);
1030
- coneItem = menu.add(new MenuItem("Cone"));
1031
- coneItem.addActionListener(this);
1032
- torusItem = menu.add(new MenuItem("Torus"));
1033
- torusItem.addActionListener(this);
1034
- superItem = menu.add(new MenuItem("Superellipsoid"));
1035
- superItem.addActionListener(this);
1036
- particleItem = menu.add(new MenuItem("Particle system"));
1037
- particleItem.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
+ {
1443
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1444
+ kleinItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
1449
+ if (Globals.ADVANCED)
1450
+ {
10381451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10391452 ragdollItem.addActionListener(this);
10401453 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10411454 ragdoll2Item.addActionListener(this);
1455
+ }
10421456 menu.add("-");
1043
- meshItem = menu.add(new MenuItem("Mesh"));
1457
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10441458 meshItem.addActionListener(this);
10451459 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10461460 // meshGroupItem.addActionListener(this);
1461
+ if (Globals.ADVANCED)
1462
+ {
10471463 springItem = menu.add(new MenuItem("Spring"));
10481464 springItem.addActionListener(this);
10491465 flagItem = menu.add(new MenuItem("Flag"));
10501466 flagItem.addActionListener(this);
1051
- bezierItem = menu.add(new MenuItem("Patch"));
1052
- bezierItem.addActionListener(this);
1053
- checkerItem = menu.add(new MenuItem("Checker"));
1054
- checkerItem.addActionListener(this);
10551467 blobItem = menu.add(new MenuItem("Blob"));
10561468 blobItem.addActionListener(this);
10571469 latheItem = menu.add(new MenuItem("Lathe"));
10581470 latheItem.addActionListener(this);
1059
- lightItem = menu.add(new MenuItem("Light"));
1060
- 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);
10611478 menu.add("-");
10621479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10631480 //superLoopItem.addActionListener(this);
1064
- loopItem = menu.add(new MenuItem("Loop"));
1065
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
10661483 doubleItem = menu.add(new MenuItem("Fork"));
10671484 doubleItem.addActionListener(this);
1485
+ if (Globals.ADVANCED)
1486
+ {
10681487 tripleItem = menu.add(new MenuItem("Trident"));
10691488 tripleItem.addActionListener(this);
1489
+ }
10701490 }
10711491
10721492 void buildToolsMenu(Menu menu)
10731493 {
10741494 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10751495 animationItem.addItemListener(this);
1076
- animationItem.setState(CameraPane.ANIMATION);
1496
+ animationItem.setState(Globals.ANIMATION);
1497
+
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
10771500
10781501 menu.add("-");
10791502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10801503 parseverticesItem.addActionListener(this);
10811504 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10821505 textureFieldItem.addActionListener(this);
1083
- alignItem = menu.add(new MenuItem("Align"));
1506
+ alignItem = menu.add(new MenuItem("Align Objects"));
10841507 alignItem.addActionListener(this);
1085
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1086
- mirrorItem.addActionListener(this);
10871508 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10881509 reduceMorphItem.addActionListener(this);
10891510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10901511 reduce34MorphItem.addActionListener(this);
1091
-
1092
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1093
- computeAOItem.addActionListener(this);
10941512 menu.add("-");
1095
-
10961513 menu.add(memoryItem = new MenuItem("Memory Usage"));
10971514 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("-");
10981523 menu.add(analyzeItem = new MenuItem("Analyze"));
10991524 analyzeItem.addActionListener(this);
1100
- menu.add(dumpItem = new MenuItem("Dump"));
1525
+ menu.add(dumpItem = new MenuItem("Print"));
11011526 dumpItem.addActionListener(this);
11021527 // menu.add(pathItem = new MenuItem("From-to path"));
11031528 // pathItem.addActionListener(this);
....@@ -1106,6 +1531,8 @@
11061531 resetParentItem.addActionListener(this);
11071532 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11081533 repairParentItem.addActionListener(this);
1534
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1535
+ repairShadowItem.addActionListener(this);
11091536 menu.add(invariantsItem = new MenuItem("Invariants"));
11101537 invariantsItem.addActionListener(this);
11111538 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1113,6 +1540,7 @@
11131540 menu.add("-");
11141541 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11151542 editScriptItem.addActionListener(this);
1543
+ }
11161544 }
11171545
11181546 void ScreenFit()
....@@ -1235,9 +1663,24 @@
12351663 shadow.material = new cMaterial(obj.material);
12361664 shadow.material.diffuse = 0.0001f;
12371665 shadow.material.specular = 0.0001f;
1666
+ //shadow.projectedVertices[1].x = 300;
12381667
12391668 makeSomething(shadow);
12401669 }
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
+ }
12411684
12421685 /**
12431686 * applyExample
....@@ -1441,9 +1884,9 @@
14411884
14421885 void Overwrite(int mask)
14431886 {
1444
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1887
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14451888 {
1446
- Object3D content = GrafreeD.clipboard.get(0);
1889
+ Object3D content = Grafreed.clipboard.get(0);
14471890
14481891 if (content instanceof cGroup && ((cGroup)content).transientlink )
14491892 content = ((cGroup)content).get(0);
....@@ -1466,6 +1909,7 @@
14661909 //
14671910 public void actionPerformed(ActionEvent event) // , Object arg)
14681911 {
1912
+ Object source = event.getSource();
14691913 /*
14701914 if (event.getSource() == nameField)
14711915 {
....@@ -1477,11 +1921,11 @@
14771921 }
14781922 else
14791923 */
1480
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1924
+ if (source == lookAtItem || source == lookFromItem)
14811925 {
14821926 ScreenFit();
14831927 } else
1484
- if (event.getSource() == switchItem)
1928
+ if (source == switchViewItem)
14851929 {
14861930 cVector v1 = new cVector();
14871931 cVector v2 = new cVector();
....@@ -1490,11 +1934,11 @@
14901934 objEditor.cameraView.renderCamera.setAim(v2, v1);
14911935 objEditor.cameraView.repaint();
14921936 } else
1493
- if (event.getSource() == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
14941938 {
14951939 makeSomething(new Box());
14961940 } else
1497
- if (event.getSource() == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
14981942 {
14991943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15001944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1515,9 +1959,9 @@
15151959 applyExample(particleGeom, "SMOKE");
15161960 makeSomething(particleGeom);
15171961 } else
1518
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1962
+ if (source == ragdollItem || source == ragdoll2Item)
15191963 {
1520
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1964
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15211965
15221966 ragdoll.toParent = LA.newMatrix();
15231967 ragdoll.fromParent = LA.newMatrix();
....@@ -1535,7 +1979,7 @@
15351979 } else
15361980 /*
15371981 */
1538
- if (event.getSource() == heightFieldItem)
1982
+ if (source == heightFieldItem)
15391983 {
15401984 Object3D obj = new Object3D();
15411985
....@@ -1573,27 +2017,31 @@
15732017
15742018 makeSomething(obj);
15752019 } else
1576
- if (event.getSource() == gridItem)
2020
+ if (source == gridItem || source == gridButton)
15772021 {
15782022 makeSomething(new Grid());
15792023 } else
1580
- if (event.getSource() == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
15812025 {
15822026 makeSomething(new Sphere());
15832027 } else
1584
- if (event.getSource() == coneItem)
2028
+ if (source == coneItem || source == coneButton)
15852029 {
15862030 makeSomething(new Cone());
15872031 } else
1588
- if (event.getSource() == torusItem)
2032
+ if (source == torusItem || source == torusButton)
15892033 {
15902034 makeSomething(new Torus());
15912035 } else
1592
- if (event.getSource() == superItem)
2036
+ if (source == superItem || source == superButton)
15932037 {
15942038 makeSomething(new Superellipsoid());
15952039 } else
1596
- if (event.getSource() == blobItem)
2040
+ if (source == kleinItem || source == kleinButton)
2041
+ {
2042
+ makeSomething(new Klein());
2043
+ } else
2044
+ if (source == blobItem)
15972045 {
15982046 Blob blob = new Blob();
15992047 BlobComponent comp = new BlobComponent();
....@@ -1601,15 +2049,15 @@
16012049 //blob.retile();
16022050 makeSomething(blob);
16032051 } else
1604
- if (event.getSource() == latheItem)
2052
+ if (source == latheItem)
16052053 {
16062054 makeSomething(new Lathe());
16072055 } else
1608
- if (event.getSource() == bezierItem)
2056
+ if (source == bezierItem)
16092057 {
16102058 makeSomething(new BezierSurface());
16112059 } else
1612
- if (event.getSource() == checkerItem)
2060
+ if (source == overlayItem || source == overlayButton)
16132061 {
16142062 /*
16152063 Object3D obj = new BezierSurface(5,8);
....@@ -1624,7 +2072,7 @@
16242072 */
16252073 makeSomething(new Checker());
16262074 } else
1627
- if (event.getSource() == meshItem)
2075
+ if (source == meshItem)
16282076 {
16292077 Object3D itemtomake = new Object3D();
16302078 Object3D child;
....@@ -1645,35 +2093,35 @@
16452093 makeSomething(child);
16462094 }
16472095 } else
1648
- if (event.getSource() == springItem)
2096
+ if (source == springItem)
16492097 {
16502098 cSpring s = new cSpring();
16512099 s.setup();
16522100 makeSomething(s);
16532101 } else
1654
- if (event.getSource() == flagItem)
2102
+ if (source == flagItem)
16552103 {
16562104 cSpring s = new cFlag();
16572105 s.setup();
16582106 makeSomething(s);
16592107 } else
1660
- if (event.getSource() == lightItem)
2108
+ if (source == lightItem || source == lightButton)
16612109 {
16622110 makeSomething(new Light());
16632111 } else
1664
- if (event.getSource() == csgItem)
2112
+ if (source == csgItem)
16652113 {
16662114 group(new CSG());
16672115 } else
1668
- if (event.getSource() == templateItem)
2116
+ if (source == templateItem)
16692117 {
16702118 group(new cTemplate());
16712119 } else
1672
- if (event.getSource() == attributeItem)
2120
+ if (source == attributeItem)
16732121 {
16742122 makeSomething(new Attribute());
16752123 } else
1676
- if (event.getSource() == pointflowItem)
2124
+ if (source == pointflowItem)
16772125 {
16782126 makeSomething(new PointFlow());
16792127 } else
....@@ -1685,7 +2133,7 @@
16852133 } else
16862134 */
16872135
1688
- if (event.getSource() == superLoopItem)
2136
+ if (source == superLoopItem)
16892137 {
16902138 Composite g = new cGroup();
16912139 for (int i=0; i<15; i++)
....@@ -1707,30 +2155,30 @@
17072155
17082156 group(g);
17092157 } else
1710
- if (event.getSource() == loopItem)
2158
+ if (source == loopItem || source == loopButton)
17112159 {
17122160 Composite csg = new GroupLeaf();
17132161 csg.count = 5;
17142162 group(csg);
1715
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
17162164 csg.addChild(child);
17172165 child.addChild(csg);
17182166 } else
1719
- if (event.getSource() == doubleItem)
2167
+ if (source == doubleItem)
17202168 {
1721
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
17222170 csg.count = 5;
17232171 group(csg);
1724
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
17252173 csg.addChild(child);
17262174 child.addChild(csg);
1727
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
17282176 csg.addChild(child);
17292177 child.addChild(csg);
17302178 } else
1731
- if (event.getSource() == tripleItem)
2179
+ if (source == tripleItem)
17322180 {
1733
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
17342182 csg.count = 4;
17352183 group(csg);
17362184 Composite child = new cGroup();
....@@ -1743,73 +2191,98 @@
17432191 csg.addChild(child);
17442192 child.addChild(csg);
17452193 } else
1746
-
1747
- if (event.getSource() == importGFDItem)
2194
+ if (source == computeAOItem)
17482195 {
1749
- ImportGFD();
2196
+ Globals.drawMode = CameraPane.OCCLUSION;
2197
+ Globals.theRenderer.repaint();
17502198 } else
1751
- if (event.getSource() == importVRMLX3DItem)
1752
- {
1753
- ImportVRMLX3D();
1754
- } else
1755
- if (event.getSource() == import3DSItem)
1756
- {
1757
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1758
- } else
1759
- if (event.getSource() == importOBJItem)
1760
- {
1761
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1762
- } else
1763
- if (event.getSource() == computeAOItem)
1764
- {
1765
- CameraPane.drawMode = CameraPane.OCCLUSION;
1766
- CameraPane.theRenderer.repaint();
1767
- } else
1768
- if (event.getSource() == recompileItem)
2199
+ if (source == recompileItem)
17692200 {
17702201 Recompile();
17712202 refreshContents();
17722203 } else
1773
- if (event.getSource() == editScriptItem)
2204
+ if (source == editScriptItem)
17742205 {
17752206 OpenDialog();
17762207 refreshContents();
17772208 } else
1778
- if (event.getSource() == invariantsItem)
2209
+ if (source == invariantsItem)
17792210 {
17802211 System.out.println("Invariants:");
1781
- GrafreeD.theApplet3D.universe.invariants();
2212
+ Grafreed.grafreeD.universe.invariants();
17822213 } else
1783
- if (event.getSource() == memoryItem)
2214
+ if (source == memoryItem)
17842215 {
17852216 //System.out.println("Invariants:");
17862217 PrintMemory();
17872218 } else
1788
- if (event.getSource() == pathItem)
2219
+ if (source == pathItem)
17892220 {
17902221 PrintPath();
17912222 } else
1792
- if (event.getSource() == analyzeItem)
2223
+ if (source == analyzeItem)
17932224 {
17942225 AnalyzeObject();
17952226 } else
1796
- if (event.getSource() == dumpItem)
2227
+ if (source == dumpItem)
17972228 {
17982229 DumpObject();
17992230 } else
1800
- if (event.getSource() == screenfitButton)
2231
+ if (source == minButton)
18012232 {
1802
- //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
+ {
18032278 ScreenFit();
18042279 } else
1805
- if (event.getSource() == screenfitpointButton)
2280
+ if (source == screenfitpointButton)
18062281 {
1807
- //Reload(lastConverter, lastFilename, true);
18082282 ScreenFitPoint();
18092283 } else
1810
- if (event.getSource() == snapobjectButton)
2284
+ if (source == snapobjectButton)
18112285 {
1812
- //Reload(lastConverter, lastFilename, true);
18132286 SnapObject();
18142287 } else
18152288 // if (event.getSource() == recompileButton)
....@@ -1818,13 +2291,13 @@
18182291 // Recompile();
18192292 // refreshContents();
18202293 // } else
1821
- if (event.getSource() == gcButton)
2294
+ if (source == gcButton)
18222295 {
18232296 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18242297 System.gc();
18252298 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262299 } else
1827
- if (event.getSource() == editLeafItem)
2300
+ if (source == editLeafItem)
18282301 {
18292302 Object3D obj;
18302303 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1838,62 +2311,74 @@
18382311 }
18392312 refreshContents(true);
18402313 } else
1841
- if (event.getSource() == openWindowItem)
2314
+ if (source == openWindowItem)
18422315 {
18432316 EditSelection(true);
18442317 } else
1845
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2318
+ if (source == cutItem || source == clearButton)
18462319 {
18472320 loadClipboard(true);
18482321 } else
1849
- if (event.getSource() == duplicateItem)
2322
+ if (source == undoItem)
18502323 {
1851
- 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;
18522333 loadClipboard(false);
18532334 paste(false);
1854
- GrafreeD.clipboard = keep;
2335
+ Grafreed.clipboard = keep;
18552336 } else
1856
- if (event.getSource() == cloneItem)
2337
+ if (source == cloneItem)
18572338 {
18582339 CloneSelection(false);
18592340 } else
1860
- if (event.getSource() == cloneSupportItem)
2341
+ if (source == cloneSupportItem)
18612342 {
18622343 CloneSelection(true);
18632344 } else
1864
- if (event.getSource() == copyItem)
2345
+ if (source == copyItem)
18652346 {
18662347 loadClipboard(false);
18672348 } else
1868
- if (event.getSource() == pasteItem)
2349
+ if (source == pasteItem)
18692350 {
18702351 paste(false);
18712352 } else
1872
- if (event.getSource() == pasteLinkItem)
2353
+ if (source == pasteIntoItem)
18732354 {
1874
- pasteInto(false);
2355
+ pasteInto(true, false);
18752356 } else
1876
- if (event.getSource() == pasteCloneItem)
2357
+ if (source == pasteLinkItem)
18772358 {
1878
- pasteInto(true);
2359
+ pasteInto(false, false);
18792360 } else
1880
- if (event.getSource() == pasteExpandItem)
2361
+ if (source == pasteCloneItem)
2362
+ {
2363
+ pasteInto(true, true);
2364
+ } else
2365
+ if (source == pasteExpandItem)
18812366 {
18822367 paste(true);
18832368 } else
1884
- if (event.getSource() == synchronizeItem)
2369
+ if (source == synchronizeItem)
18852370 {
18862371 Overwrite(Object3D.TRANSFORM);
18872372 } else
1888
- if (event.getSource() == overwriteNameItem)
2373
+ if (source == overwriteNameItem)
18892374 {
18902375 Overwrite(Object3D.NAME);
18912376 } else
1892
- if (event.getSource() == overwriteUVItem)
2377
+ if (source == overwriteUVItem)
18932378 {
18942379 Overwrite(Object3D.UV);
18952380 } else
1896
- if (event.getSource() == overwriteMatItem)
2381
+ if (source == overwriteMatItem)
18972382 {
18982383 /* july 2015
18992384 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1913,7 +2398,7 @@
19132398
19142399 Overwrite(dropAttributes);
19152400 }
1916
- if (event.getSource() == overwriteGeoItem)
2401
+ if (source == overwriteGeoItem)
19172402 {
19182403 Overwrite(Object3D.GEOMETRY);
19192404 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1930,7 +2415,7 @@
19302415 // refreshContents();
19312416 // }
19322417 } else
1933
- if (event.getSource() == generateMeshItem)
2418
+ if (source == generateMeshItem)
19342419 {
19352420 //if (group.selection.size() == 1)
19362421 // for (int i=0; i<group.selection.size(); i++)
....@@ -1941,7 +2426,7 @@
19412426 ResetModel();
19422427 refreshContents();
19432428 } else
1944
- if (event.getSource() == extractGeometriesItem)
2429
+ if (source == extractGeometriesItem)
19452430 {
19462431 boolean one = false;
19472432
....@@ -1968,7 +2453,7 @@
19682453 ResetModel();
19692454 refreshContents();
19702455 } else
1971
- if (event.getSource() == cloneGeometriesItem)
2456
+ if (source == cloneGeometriesItem)
19722457 {
19732458 boolean one = false;
19742459
....@@ -1994,32 +2479,37 @@
19942479 ResetModel();
19952480 refreshContents();
19962481 } else
1997
- if (event.getSource() == shareGeometriesItem)
2482
+ if (source == shareGeometriesItem)
19982483 {
19992484 boolean one = false;
20002485
20012486 if (group.selection.size() == 1)
20022487 one = true;
20032488
2489
+ Object3D merge = null;
2490
+
20042491 Object3D content = new cGroup();
20052492
20062493 for (int i=0; i<group.selection.size(); i++)
20072494 {
2008
- Object3D sel = new Merge(group.selection.get(i));
2495
+ merge = new Merge(group.selection.get(i));
20092496
20102497 if (one)
2011
- makeSomething(sel, false);
2498
+ makeSomething(merge, false);
20122499 else
2013
- content.addChild(sel);
2500
+ content.addChild(merge);
20142501 }
20152502
20162503 if (!one)
2017
- makeSomething(content, false);
2018
-
2019
- ResetModel();
2020
- refreshContents();
2504
+ makeSomething(content, true);
2505
+ else
2506
+ {
2507
+ ResetModel();
2508
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2509
+ refreshContents();
2510
+ }
20212511 } else
2022
- if (event.getSource() == mergeGeometriesItem)
2512
+ if (source == mergeGeometriesItem)
20232513 {
20242514 boolean one = false;
20252515
....@@ -2049,7 +2539,7 @@
20492539 ResetModel();
20502540 refreshContents();
20512541 } else
2052
- if (event.getSource() == linkverticesItem)
2542
+ if (source == linkverticesItem)
20532543 {
20542544 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20552545 // {
....@@ -2062,39 +2552,48 @@
20622552 // group.selection.get(0).setMasterThis(content); // should be identity
20632553 // refreshContents();
20642554 // }
2065
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2555
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20662556 {
2067
- Object3D content = GrafreeD.clipboard.get(0);
2557
+ Object3D content = Grafreed.clipboard.get(0);
20682558
20692559 if (content instanceof cGroup && ((cGroup)content).transientlink )
20702560 content = ((cGroup)content).get(0);
20712561
2072
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2562
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20732563 for (int i=0; i<group.selection.size(); i++)
20742564 {
2075
- boolean random = CameraPane.RANDOM;
2076
- CameraPane.RANDOM = false; // parse all random nodes
2565
+ boolean random = CameraPane.SWITCH;
2566
+ CameraPane.SWITCH = false; // parse all random nodes
20772567 group.selection.get(i).linkVerticesThis(content);
20782568 // group.selection.get(i).setMasterThis(content); // should be identity
2079
- CameraPane.RANDOM = random;
2569
+ CameraPane.SWITCH = random;
20802570 }
2081
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2571
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20822572 refreshContents();
20832573 }
20842574 } else
2085
- if (event.getSource() == resetsupportItem)
2575
+ if (source == resetsupportItem)
20862576 {
20872577 for (int i=0; i<group.selection.size(); i++)
20882578 {
2089
- boolean random = CameraPane.RANDOM;
2090
- CameraPane.RANDOM = false; // parse all random nodes
2579
+ boolean random = CameraPane.SWITCH;
2580
+ CameraPane.SWITCH = false; // parse all random nodes
20912581 group.selection.get(i).linkVerticesThis(null);
2092
- CameraPane.RANDOM = random;
2582
+ CameraPane.SWITCH = random;
20932583 }
20942584
20952585 refreshContents();
20962586 } else
2097
- if (event.getSource() == resetreferencesItem)
2587
+ if (source == relinkverticesItem)
2588
+ {
2589
+ boolean random = CameraPane.SWITCH;
2590
+ CameraPane.SWITCH = false; // parse all random nodes
2591
+ group.selection.RelinkToSupport();
2592
+ CameraPane.SWITCH = random;
2593
+
2594
+ refreshContents();
2595
+ } else
2596
+ if (source == resetreferencesItem)
20982597 {
20992598 for (int i=0; i<group.selection.size(); i++)
21002599 {
....@@ -2103,11 +2602,11 @@
21032602
21042603 refreshContents();
21052604 } else
2106
- if (event.getSource() == setMasterItem)
2605
+ if (source == setMasterItem)
21072606 {
2108
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2607
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21092608 {
2110
- Object3D content = GrafreeD.clipboard.get(0);
2609
+ Object3D content = Grafreed.clipboard.get(0);
21112610
21122611 if (content instanceof cGroup && ((cGroup)content).transientlink )
21132612 content = ((cGroup)content).get(0);
....@@ -2116,13 +2615,13 @@
21162615 refreshContents();
21172616 }
21182617 } else
2119
- if (event.getSource() == poseMeshItem)
2618
+ if (source == poseMeshItem)
21202619 {
21212620 if (group.selection.size() == 1)
21222621 {
2123
- if (GrafreeD.clipboard.size() == 1)
2622
+ if (Grafreed.clipboard.size() == 1)
21242623 {
2125
- Object3D content = GrafreeD.clipboard.get(0);
2624
+ Object3D content = Grafreed.clipboard.get(0);
21262625
21272626 if (content instanceof cGroup && ((cGroup)content).transientlink )
21282627 content = ((cGroup)content).get(0);
....@@ -2135,19 +2634,19 @@
21352634 }
21362635
21372636 } else
2138
- if (event.getSource() == revertMeshItem)
2637
+ if (source == revertMeshItem)
21392638 {
21402639 RevertMeshes();
21412640 } else
2142
- if (event.getSource() == resetMeshItem)
2641
+ if (source == resetAllItem)
21432642 {
21442643 ResetAll();
21452644 } else
2146
- if (event.getSource() == stepAllItem)
2645
+ if (source == stepAllItem)
21472646 {
21482647 StepAll();
21492648 } else
2150
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2649
+ if (source == clearItem) // || event.getSource() == clearButton)
21512650 {
21522651 //int indices[] = jList.getSelectedIndices();
21532652 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2155,42 +2654,46 @@
21552654
21562655 ClearSelection(false);
21572656 } else
2158
- if (event.getSource() == clearAllItem)
2657
+ if (source == clearAllItem)
21592658 {
21602659 ClearSelection(true);
21612660 } else
2162
- if (event.getSource() == grabItem)
2661
+ if (source == grabItem || source == groupButton)
21632662 {
2164
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
21652664 } else
2166
- if (event.getSource() == frontItem)
2665
+ if (source == hideItem)
2666
+ {
2667
+ group(new HiddenObject());
2668
+ } else
2669
+ if (source == frontItem)
21672670 {
21682671 front();
21692672 } else
2170
- if (event.getSource() == backItem)
2673
+ if (source == backItem)
21712674 {
21722675 back();
21732676 } else
2174
- if (event.getSource() == cameraItem)
2677
+ if (source == cameraItem)
21752678 {
21762679 makeSomething(new Camera());
21772680 } else
2178
- if (event.getSource() == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
21792682 {
21802683 group(new Composite());
21812684 } else
2182
- if (event.getSource() == randomItem)
2685
+ if (source == switchItem || source == switchButton)
21832686 {
21842687 RandomNode random = new RandomNode();
21852688 group(random);
21862689 if (random.size() > 0)
2187
- random.name = random.get(0).name + "Rnd";
2690
+ random.name = random.get(0).name + "Switch";
21882691 } else
2189
- if (event.getSource() == physicsItem)
2692
+ if (source == physicsItem)
21902693 {
21912694 group(new PhysicsNode());
21922695 } else
2193
- if (event.getSource() == frameselectorItem)
2696
+ if (source == frameselectorItem)
21942697 {
21952698 for (int i=0; i<group.selection.size(); i++)
21962699 {
....@@ -2202,7 +2705,7 @@
22022705 ResetModel();
22032706 refreshContents();
22042707 } else
2205
- if (event.getSource() == switchGeoItem)
2708
+ if (source == switchGeoItem)
22062709 {
22072710 for (int i=0; i<group.selection.size(); i++)
22082711 {
....@@ -2214,7 +2717,7 @@
22142717 ResetModel();
22152718 refreshContents();
22162719 } else
2217
- if (event.getSource() == switchTransfoItem)
2720
+ if (source == switchTransfoItem)
22182721 {
22192722 for (int i=0; i<group.selection.size(); i++)
22202723 {
....@@ -2226,7 +2729,7 @@
22262729 ResetModel();
22272730 refreshContents();
22282731 } else
2229
- if (event.getSource() == morphItem)
2732
+ if (source == morphItem)
22302733 {
22312734 for (int i=0; i<group.selection.size(); i++)
22322735 {
....@@ -2238,7 +2741,7 @@
22382741 ResetModel();
22392742 refreshContents();
22402743 } else
2241
- if (event.getSource() == scriptNodeItem)
2744
+ if (source == scriptNodeItem)
22422745 {
22432746 boolean atleastone = false;
22442747
....@@ -2277,195 +2780,252 @@
22772780 }
22782781 }
22792782 } else
2280
- if (event.getSource() == linkerItem)
2783
+ if (source == linkerItem)
22812784 {
22822785 group(new cLinker());
22832786 } else
2284
- if (event.getSource() == textureItem)
2787
+ if (source == textureItem || source == textureButton)
22852788 {
22862789 group(new TextureNode());
22872790 } else
2288
- if (event.getSource() == shadowXItem)
2791
+ if (source == billboardItem)
2792
+ {
2793
+ group(new BillboardNode());
2794
+ } else
2795
+ if (source == shadowXItem)
22892796 {
22902797 CastShadow(0);
22912798 } else
2292
- if (event.getSource() == shadowYItem)
2799
+ if (source == shadowYItem)
22932800 {
22942801 CastShadow(1);
22952802 } else
2296
- if (event.getSource() == shadowZItem)
2803
+ if (source == shadowZItem)
22972804 {
22982805 CastShadow(2);
22992806 } else
2300
- if (event.getSource() == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
23012808 {
2302
- ungroup();
2809
+ boolean hasRoot = false;
2810
+
2811
+ for (int i=0; i<group.selection.size(); i++)
2812
+ {
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
2818
+ }
2819
+
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
+ }
23032831 } else
2304
- if (event.getSource() == genUVItem)
2832
+ if (source == genUVItem)
23052833 {
23062834 GenUV();
23072835 } else
2308
- if (event.getSource() == genNormalsCADItem)
2836
+ if (source == genNormalsCADItem)
23092837 {
23102838 GenNormals(true);
23112839 } else
2312
- if (event.getSource() == genNormalsORGANItem)
2840
+ if (source == genNormalsMESHItem)
2841
+ {
2842
+ GenNormalsMESH();
2843
+ } else
2844
+ if (source == genNormalsORGANItem)
23132845 {
23142846 GenNormals(false);
23152847 } else
2316
- if (event.getSource() == stripifyItem)
2848
+ if (source == genNormalsMINEItem)
2849
+ {
2850
+ GenNormalsMINE();
2851
+ } else
2852
+ if (source == stripifyItem)
23172853 {
23182854 Stripify();
23192855 } else
2320
- if (event.getSource() == unstripifyItem)
2856
+ if (source == unstripifyItem)
23212857 {
23222858 Unstripify();
23232859 } else
2324
- if (event.getSource() == trimItem)
2860
+ if (source == trimItem)
23252861 {
23262862 Trim();
23272863 } else
2328
- if (event.getSource() == untrimItem)
2864
+ if (source == untrimItem)
23292865 {
23302866 Untrim();
23312867 } else
2332
- if (event.getSource() == clearColorsItem)
2868
+ if (source == clearColorsItem)
23332869 {
23342870 ClearColors();
23352871 } else
2336
- if (event.getSource() == clearMaterialsItem)
2872
+ if (source == clearMaterialsItem)
23372873 {
23382874 ClearMaterials();
23392875 } else
2340
- if (event.getSource() == liveleavesItem)
2876
+ if (source == liveleavesItem)
23412877 {
23422878 LiveLeaves(true);
23432879 } else
2344
- if (event.getSource() == unliveleavesItem)
2880
+ if (source == unliveleavesItem)
23452881 {
23462882 LiveLeaves(false);
23472883 } else
2348
- if (event.getSource() == supportleavesItem)
2884
+ if (source == supportleavesItem)
23492885 {
23502886 SupportLeaves(true);
23512887 } else
2352
- if (event.getSource() == unsupportleavesItem)
2888
+ if (source == unsupportleavesItem)
23532889 {
23542890 SupportLeaves(false);
23552891 } else
2356
- if (event.getSource() == hideleavesItem)
2892
+ if (source == hideleavesItem)
23572893 {
23582894 HideLeaves(true);
23592895 } else
2360
- if (event.getSource() == showleavesItem)
2896
+ if (source == showleavesItem)
23612897 {
23622898 HideLeaves(false);
23632899 } else
2364
- if (event.getSource() == markleavesItem)
2900
+ if (source == markleavesItem)
23652901 {
23662902 MarkLeaves(true);
23672903 } else
2368
- if (event.getSource() == unmarkleavesItem)
2904
+ if (source == unmarkleavesItem)
23692905 {
23702906 MarkLeaves(false);
23712907 } else
2372
- 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)
23732925 {
23742926 FlipV(true);
23752927 } else
2376
- if (event.getSource() == unflipVItem)
2928
+ if (source == unflipVItem)
23772929 {
23782930 FlipV(false);
23792931 } else
2380
- if (event.getSource() == lowTexturesItem)
2932
+ if (source == lowTexturesItem)
23812933 {
23822934 SetTexRes(0);
23832935 } else
2384
- if (event.getSource() == normalTexturesItem)
2936
+ if (source == normalTexturesItem)
23852937 {
23862938 SetTexRes(1);
23872939 } else
2388
- if (event.getSource() == highTexturesItem)
2940
+ if (source == highTexturesItem)
23892941 {
23902942 SetTexRes(2);
23912943 } else
2392
- if (event.getSource() == veryhighTexturesItem)
2944
+ if (source == veryhighTexturesItem)
23932945 {
23942946 SetTexRes(3);
23952947 } else
2396
- if (event.getSource() == maxTexturesItem)
2948
+ if (source == maxTexturesItem)
23972949 {
23982950 SetTexRes(4);
23992951 } else
2400
- if (event.getSource() == panoTexturesItem)
2952
+ if (source == panoTexturesItem)
24012953 {
24022954 SetTexRes(5);
24032955 } else
2404
- if (event.getSource() == reverseNormalsItem)
2956
+ if (source == reverseNormalsItem)
24052957 {
24062958 ReverseNormals();
24072959 } else
2408
- if (event.getSource() == parseverticesItem)
2960
+ if (source == parseverticesItem)
24092961 {
24102962 ParseVertices();
24112963 } else
2412
- if (event.getSource() == textureFieldItem)
2964
+ if (source == textureFieldItem)
24132965 {
24142966 TextureVertices();
24152967 } else
2416
- if (event.getSource() == alignItem)
2968
+ if (source == alignItem)
24172969 {
24182970 Align();
24192971 } else
2420
- if (event.getSource() == mirrorItem)
2972
+ if (source == mirrorItem)
24212973 {
24222974 MirrorPoses();
24232975 } else
2424
- if (event.getSource() == reduceMorphItem)
2976
+ if (source == reduceMorphItem)
24252977 {
24262978 MeshReduction(false);
24272979 } else
2428
- if (event.getSource() == reduce34MorphItem)
2980
+ if (source == reduce34MorphItem)
24292981 {
24302982 MeshReduction(true);
24312983 } else
2432
- if (event.getSource() == reverseTrianglesItem)
2984
+ if (source == reverseTrianglesItem)
24332985 {
24342986 ReverseTriangles();
24352987 } else
2436
- if (event.getSource() == reduceMeshItem)
2988
+ if (source == reduceMeshItem)
24372989 {
24382990 ReduceMesh(false);
24392991 } else
2440
- if (event.getSource() == reduce34MeshItem)
2992
+ if (source == reduce34MeshItem)
24412993 {
24422994 ReduceMesh(true);
24432995 } else
2444
- if (event.getSource() == increaseMeshItem)
2996
+ if (source == increaseMeshItem)
24452997 {
24462998 IncreaseMesh();
24472999 } else
2448
- if (event.getSource() == clipMeshItem)
3000
+ if (source == clipMeshItem)
24493001 {
24503002 ClipMesh();
24513003 } else
2452
- if (event.getSource() == smoothMeshItem)
3004
+ if (source == smoothMeshItem)
24533005 {
24543006 SmoothMesh();
24553007 } else
2456
- if (event.getSource() == transformgeometryItem)
3008
+ if (source == transformGeometryItem)
24573009 {
24583010 TransformGeometry();
24593011 } else
2460
- if (event.getSource() == resetTransformItem)
3012
+ if (source == transformChildrenItem)
3013
+ {
3014
+ TransformChildren();
3015
+ } else
3016
+ if (source == resetTransformItem)
24613017 {
24623018 ResetTransform();
24633019 } else
2464
- if (event.getSource() == resetCentroidItem)
3020
+ if (source == resetCentroidItem)
24653021 {
2466
- ResetCentroid();
3022
+ ResetCentroid(true);
24673023 } else
2468
- if (event.getSource() == resetParentItem)
3024
+ if (source == resetCentroidXZItem)
3025
+ {
3026
+ ResetCentroid(false);
3027
+ } else
3028
+ if (source == resetParentItem)
24693029 {
24703030 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24713031 {
....@@ -2475,7 +3035,7 @@
24753035
24763036 refreshContents();
24773037 } else
2478
- if (event.getSource() == repairParentItem)
3038
+ if (source == repairParentItem)
24793039 {
24803040 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24813041 {
....@@ -2489,7 +3049,21 @@
24893049
24903050 refreshContents();
24913051 } else
2492
- if (event.getSource() == sortbysizeItem)
3052
+ if (source == repairShadowItem)
3053
+ {
3054
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3055
+ {
3056
+ Object3D obj = (Object3D)e.nextElement();
3057
+ obj.RepairShadow();
3058
+// for (int i=0; i<obj.size(); i++)
3059
+// {
3060
+// obj.get(i).parent = obj;
3061
+// }
3062
+ }
3063
+
3064
+ refreshContents();
3065
+ } else
3066
+ if (source == sortbysizeItem)
24933067 {
24943068 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24953069 {
....@@ -2501,7 +3075,7 @@
25013075 ResetModel();
25023076 refreshContents();
25033077 } else
2504
- if (event.getSource() == sortbynameItem)
3078
+ if (source == sortbynameItem)
25053079 {
25063080 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25073081 {
....@@ -2513,7 +3087,7 @@
25133087 ResetModel();
25143088 refreshContents();
25153089 } else
2516
- if (event.getSource() == attachPigmentItem)
3090
+ if (source == attachPigmentItem)
25173091 {
25183092 String texture = GetFile("Attach pigment");
25193093 Object3D obj;
....@@ -2525,7 +3099,7 @@
25253099
25263100 refreshContents();
25273101 } else
2528
- if (event.getSource() == detachPigmentItem)
3102
+ if (source == detachPigmentItem)
25293103 {
25303104 Object3D obj;
25313105 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2536,7 +3110,7 @@
25363110
25373111 refreshContents();
25383112 } else
2539
- if (event.getSource() == attachBumpItem)
3113
+ if (source == attachBumpItem)
25403114 {
25413115 String texture = GetFile("Attach bump");
25423116 Object3D obj;
....@@ -2548,7 +3122,7 @@
25483122
25493123 refreshContents();
25503124 } else
2551
- if (event.getSource() == detachBumpItem)
3125
+ if (source == detachBumpItem)
25523126 {
25533127 Object3D obj;
25543128 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2559,7 +3133,7 @@
25593133
25603134 refreshContents();
25613135 } else
2562
- if (event.getSource() == pigmentBumpItem)
3136
+ if (source == pigmentBumpItem)
25633137 {
25643138 Object3D obj;
25653139 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2570,158 +3144,237 @@
25703144
25713145 refreshContents();
25723146 } else
2573
- if (event.getSource() == flashSelectionButton)
3147
+ if (source == flashSelectionButton)
25743148 {
25753149 CameraPane.flash = true;
25763150 refreshContents();
25773151 } else
2578
- if (event.getSource() == oneButton)
3152
+ if (source == oneButton)
25793153 {
25803154 } else
2581
- if (event.getSource() == twoButton)
3155
+ if (source == twoButton)
25823156 {
25833157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
25843162 // bug
25853163 //gridPanel.setDividerLocation(1.0);
25863164 //bigPanel.setDividerLocation(0.0);
2587
- bigThree.remove(jtp);
2588
- bigThree.remove(cameraPanel);
2589
- bigThree.remove(XYZPanel);
2590
- aWindowConstraints.gridx = 0;
2591
- aWindowConstraints.gridy = 0;
2592
- aWindowConstraints.gridwidth = 1;
2593
- // aConstraints.gridheight = 3;
2594
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2595
- aWindowConstraints.weightx = 0;
2596
- aWindowConstraints.weighty = 1;
2597
- //bigThree.add(jtp, aWindowConstraints);
2598
- aWindowConstraints.weightx = 1;
2599
- aWindowConstraints.gridwidth = 3;
2600
- // aConstraints.gridheight = 3;
2601
- aWindowConstraints.gridx = 1;
2602
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2603
- bigThree.add(cameraPanel, aWindowConstraints);
2604
- aWindowConstraints.weightx = 0;
2605
- aWindowConstraints.gridx = 4;
2606
- aWindowConstraints.gridwidth = 1;
2607
- // aConstraints.gridheight = 3;
2608
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2609
- //bigThree.add(XYZPanel, aWindowConstraints);
2610
- 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
+
26113212 } else
2612
- if (event.getSource() == threeButton)
3213
+ if (source == threeButton)
26133214 {
26143215 radio.layout = threeButton;
2615
- bigThree.remove(jtp);
2616
- bigThree.remove(cameraPanel);
2617
- bigThree.remove(XYZPanel);
2618
- aWindowConstraints.gridx = 0;
2619
- aWindowConstraints.gridy = 0;
2620
- aWindowConstraints.gridwidth = 1;
2621
- // aConstraints.gridheight = 3;
2622
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2623
- aWindowConstraints.weightx = 0;
2624
- aWindowConstraints.weighty = 1;
2625
- //bigThree.add(jtp, aWindowConstraints);
2626
- aWindowConstraints.weightx = 1;
2627
- aWindowConstraints.gridwidth = 3;
2628
- // aConstraints.gridheight = 3;
2629
- aWindowConstraints.gridx = 1;
2630
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2631
- bigThree.add(cameraPanel, aWindowConstraints);
2632
- aWindowConstraints.weightx = 0;
2633
- aWindowConstraints.gridx = 4;
2634
- aWindowConstraints.gridwidth = 1;
2635
- // aConstraints.gridheight = 3;
2636
- aConstraints.fill = GridBagConstraints.VERTICAL;
2637
- bigThree.add(XYZPanel, aWindowConstraints);
2638
- 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();
26393253 } else
2640
- if (event.getSource() == fourButton)
3254
+ if (source == fourButton)
26413255 {
26423256 radio.layout = fourButton;
2643
- bigThree.remove(jtp);
2644
- bigThree.remove(cameraPanel);
2645
- bigThree.remove(XYZPanel);
2646
- aWindowConstraints.gridx = 0;
2647
- aWindowConstraints.gridy = 0;
2648
- aWindowConstraints.gridwidth = 1;
2649
- // aWindowConstraints.gridheight = 3;
2650
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2651
- aWindowConstraints.weightx = 1;
2652
- aWindowConstraints.weighty = 1;
2653
- bigThree.add(jtp, aWindowConstraints);
2654
- aWindowConstraints.weightx = 1;
2655
- aWindowConstraints.gridwidth = 3;
2656
- // aConstraints.gridheight = 3;
2657
- aWindowConstraints.gridx = 1;
2658
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2659
- //bigThree.add(cameraPanel, aWindowConstraints);
2660
- aWindowConstraints.weightx = 0;
2661
- aWindowConstraints.gridx = 4;
2662
- aWindowConstraints.gridwidth = 1;
2663
- // aWindowConstraints.gridheight = 3;
2664
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2665
- //bigThree.add(XYZPanel, aWindowConstraints);
2666
- 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();
26673293 } else
2668
- if (event.getSource() == sixButton)
3294
+ if (source == sixButton)
26693295 {
26703296 radio.layout = sixButton;
2671
- bigThree.remove(jtp);
2672
- bigThree.remove(cameraPanel);
2673
- bigThree.remove(XYZPanel);
2674
- aWindowConstraints.gridx = 0;
2675
- aWindowConstraints.gridy = 0;
2676
- aWindowConstraints.gridwidth = 1;
2677
- // aConstraints.gridheight = 3;
2678
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2679
- aWindowConstraints.weightx = 0;
2680
- aWindowConstraints.weighty = 1;
2681
- bigThree.add(jtp, aWindowConstraints);
2682
- aWindowConstraints.weightx = 1;
2683
- aWindowConstraints.gridwidth = 3;
2684
- // aWindowConstraints.gridheight = 3;
2685
- aWindowConstraints.gridx = 1;
2686
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2687
- bigThree.add(cameraPanel, aWindowConstraints);
2688
- aWindowConstraints.weightx = 0;
2689
- aWindowConstraints.gridx = 4;
2690
- aWindowConstraints.gridwidth = 1;
2691
- // aWindowConstraints.gridheight = 3;
2692
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2693
- //bigThree.add(XYZPanel, aConstraints);
2694
- 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();
26953334 } else
2696
- if (event.getSource() == sevenButton)
3335
+ if (source == sevenButton)
26973336 {
26983337 radio.layout = sevenButton;
2699
- bigThree.remove(jtp);
2700
- bigThree.remove(cameraPanel);
2701
- bigThree.remove(XYZPanel);
2702
- aWindowConstraints.gridx = 0;
2703
- aWindowConstraints.gridy = 0;
2704
- aWindowConstraints.gridwidth = 1;
2705
- // aWindowConstraints.gridheight = 3;
2706
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2707
- aWindowConstraints.weightx = 0;
2708
- aWindowConstraints.weighty = 1;
2709
- bigThree.add(jtp, aWindowConstraints);
2710
- aWindowConstraints.weightx = 1;
2711
- aWindowConstraints.gridwidth = 3;
2712
- // aWindowConstraints.gridheight = 3;
2713
- aWindowConstraints.gridx = 1;
2714
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2715
- bigThree.add(cameraPanel, aWindowConstraints);
2716
- aWindowConstraints.weightx = 0;
2717
- aWindowConstraints.gridx = 4;
2718
- aWindowConstraints.gridwidth = 1;
2719
- // aConstraints.gridheight = 3;
2720
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2721
- bigThree.add(XYZPanel, aWindowConstraints);
2722
- 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();
27233376 } else
2724
- if (event.getSource() == rootButton)
3377
+ if (source == rootButton)
27253378 {
27263379 Object3D obj;
27273380 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2731,66 +3384,84 @@
27313384 EditObject(obj);
27323385 }
27333386
3387
+ cameraView.requestFocusInWindow();
27343388 refreshContents(true);
27353389 } else
2736
- if (event.getSource() == closeButton)
3390
+ if (source == closeButton)
27373391 {
27383392 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27393393 cRadio ab;
27403394 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27413395 {
27423396 ab = (cRadio)e.nextElement();
2743
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3397
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27443398 {
3399
+ // Patch to avoid bug with transparency.
3400
+ if (!ab.hadMaterial)
3401
+ {
3402
+ ab.object.material = null;
3403
+ }
3404
+
27453405 buttonGroup.remove(ab);
27463406 radioPanel.remove(ab);
27473407
2748
- ab.GetObject().editWindow = null;
3408
+ //ab.GetObject().editWindow = null;
3409
+ ab.GetObject().manipWindow = null;
27493410 // ab.GetObject().objectUI = null; // ?????????
27503411
27513412 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
27523413 break;
27533414 }
27543415 }
3416
+
3417
+ cameraView.requestFocusInWindow();
27553418 refreshContents(true);
27563419 } else
2757
- if (event.getSource() == editItem || event.getSource() == editButton)
3420
+ if (source == editItem || source == editButton)
27583421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
27593428 EditSelection(false);
27603429 } else
2761
- if (event.getSource() == uneditButton)
3430
+ if (source == uneditButton)
27623431 {
27633432 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27643433 {
27653434 Object3D child = (Object3D)e.nextElement();
27663435 if(child.editWindow != null)
27673436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
27683438 child.CloseUI();
27693439 listUI.remove(child);
27703440
2771
- child.editWindow = null; // ???????????
3441
+ //child.editWindow = null; // ???????????
27723442 }
2773
- objEditor.ctrlPanel.revalidate();
3443
+ objEditor.ctrlPanel.FlushUI();
27743444 //objEditor.jTree.clearSelection();
27753445 //objEditor.ResetSliders();
27763446 refreshContents(true);
27773447 } else
2778
- if (event.getSource() == clearPanelButton)
3448
+ if (source == clearPanelButton)
27793449 {
27803450 assert(copy == group);
27813451 //copy.ClearUI();
27823452 for (Object3D obj : listUI)
27833453 {
3454
+ obj.pinned = false;
27843455 obj.CloseUI();
27853456 }
27863457 listUI.clear();
27873458 refreshContents(true);
27883459 } else
2789
- if (event.getSource() == allParamsButton)
3460
+ if (source == allParamsButton)
27903461 {
27913462 assert(copy == group);
27923463
2793
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27943465
27953466 for (Object3D obj : listUI)
27963467 {
....@@ -2807,19 +3478,19 @@
28073478
28083479 refreshContents(true);
28093480 } else
2810
- if (event.getSource() == unselectButton)
3481
+ if (source == unselectButton)
28113482 {
28123483 objEditor.jTree.clearSelection();
28133484 // ?? oct 2012 GrafreeD.clipboard.clear();
28143485 objEditor.ResetSliders();
28153486 refreshContents(true);
28163487 } else
2817
- if(event.getSource() instanceof cRadio)
3488
+ if(source instanceof cRadio)
28183489 {
28193490 group.parent = keepparent;
28203491 group.attributes = 0;
28213492 //group.editWindow = null;
2822
- /*cRadio*/ radio = (cRadio)event.getSource();
3493
+ /*cRadio*/ radio = (cRadio)source;
28233494 Object3D obj = radio.GetObject();
28243495 System.out.println("Edit " + obj);
28253496 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2839,7 +3510,10 @@
28393510 }
28403511
28413512 copy = group;
2842
- //CameraPane.theRenderer.object = group;
3513
+
3514
+ SetUndoStates();
3515
+
3516
+ //Globals.theRenderer.object = group;
28433517 if(!useclient)
28443518 {
28453519 cameraView.renderCamera = radio.camera;
....@@ -2848,25 +3522,50 @@
28483522 cameraView.cameras[cameraView.cameracount] = radio.camera;
28493523 cameraView.targetLookAt.set(radio.camera.lookAt);
28503524 cameraView.object = group;
2851
- cameraView.lighttouched = true;
3525
+ //cameraView.lighttouched = true;
3526
+ Globals.lighttouched = true;
28523527 topView.object = group;
28533528 frontView.object = group;
28543529 sideView.object = group;
28553530 }
2856
- group.editWindow = this;
3531
+
3532
+// fix "+" issue
3533
+ //group.editWindow = this;
3534
+ group.manipWindow = this;
3535
+
28573536 /*
28583537 currentLayout = radio.layout;
28593538 if (currentLayout == null)
28603539 currentLayout = sevenButton;
28613540 */
28623541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
28633547 keepparent = group.parent;
28643548 // PARENT = NULL or not???
28653549 //group.parent = null; // ROOT
28663550 //group.attributes = -1;
28673551 ResetModel();
3552
+
3553
+ cameraView.requestFocusInWindow();
28683554 refreshContents(true);
2869
- }
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
+ }
28703569 else
28713570 {
28723571 //return super.action(event, arg);
....@@ -2875,7 +3574,6 @@
28753574 }
28763575
28773576 boolean useclient = false;
2878
- cRadio radio;
28793577
28803578 void ToggleRoot()
28813579 {
....@@ -2884,7 +3582,7 @@
28843582 if (useclient)
28853583 {
28863584 cameraView.object = client;
2887
- cameraView.lighttouched = true;
3585
+ Globals.lighttouched = true;
28883586 //topView.object = client;
28893587 //frontView.object = client;
28903588 //sideView.object = client;
....@@ -2892,7 +3590,7 @@
28923590 else
28933591 {
28943592 cameraView.object = group;
2895
- cameraView.lighttouched = true;
3593
+ Globals.lighttouched = true;
28963594 //topView.object = group;
28973595 //frontView.object = group;
28983596 //sideView.object = group;
....@@ -2927,6 +3625,28 @@
29273625 refreshContents();
29283626 }
29293627
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
+ }
29303650
29313651 void ResetTransform()
29323652 {
....@@ -3039,7 +3759,7 @@
30393759 refreshContents();
30403760 }
30413761
3042
- void ResetCentroid()
3762
+ void ResetCentroid(boolean full)
30433763 {
30443764 Object3D obj;
30453765 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3054,12 +3774,16 @@
30543774 LA.matIdentity(Object3D.mat);
30553775 obj.getBounds(minima, maxima, false);
30563776 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3057
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3777
+ if (full)
3778
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30583779 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30593780 obj.TransformMesh(Object3D.mat);
3781
+
30603782 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3061
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3783
+ if (full)
3784
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30623785 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3786
+
30633787 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30643788 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30653789 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3088,7 +3812,8 @@
30883812
30893813 int size = obj.MemorySize();
30903814
3091
- 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)");
30923817 }
30933818 }
30943819 catch (Exception e)
....@@ -3125,9 +3850,9 @@
31253850 obj = (Object3D)e.nextElement();
31263851
31273852 System.out.println("Object is: " + obj);
3128
- GrafreeD.AnalyzeObject(obj);
3853
+ Grafreed.AnalyzeObject(obj);
31293854 System.out.println("Boundary rep: " + obj.bRep);
3130
- GrafreeD.AnalyzeObject(obj.bRep);
3855
+ Grafreed.AnalyzeObject(obj.bRep);
31313856
31323857 // System.err.println((size/1024) + " KB is the size of " + obj);
31333858 }
....@@ -3169,6 +3894,20 @@
31693894 void GenNormals(boolean crease)
31703895 {
31713896 group.GenNormalsS(crease);
3897
+
3898
+ refreshContents();
3899
+ }
3900
+
3901
+ void GenNormalsMESH()
3902
+ {
3903
+ group.GenNormalsMeshS();
3904
+
3905
+ refreshContents();
3906
+ }
3907
+
3908
+ void GenNormalsMINE()
3909
+ {
3910
+ group.selection.GenNormalsMINE();
31723911
31733912 refreshContents();
31743913 }
....@@ -3334,8 +4073,8 @@
33344073
33354074 void ParseVertices()
33364075 {
3337
- boolean epsequal = GrafreeD.epsequal;
3338
- GrafreeD.epsequal = true;
4076
+ boolean epsequal = Grafreed.epsequal;
4077
+ Grafreed.epsequal = true;
33394078
33404079 for (int i=0; i<group.selection.size(); i++)
33414080 {
....@@ -3360,7 +4099,7 @@
33604099 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33614100 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33624101
3363
- g.add(GrafreeD.clipboard);
4102
+ g.add(Grafreed.clipboard);
33644103
33654104 buffer.add(g);
33664105 }
....@@ -3375,7 +4114,7 @@
33754114 makeSomething(buffer, i==group.selection.size()-1);
33764115 }
33774116
3378
- GrafreeD.epsequal = epsequal;
4117
+ Grafreed.epsequal = epsequal;
33794118
33804119 refreshContents();
33814120 }
....@@ -3393,7 +4132,16 @@
33934132 String pigment = Object3D.GetPigment(tex);
33944133 //String bump = Object3D.GetBump(tex);
33954134
3396
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.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
+ }
33974145
33984146 double s = v.s;
33994147
....@@ -3441,12 +4189,26 @@
34414189
34424190 void Align()
34434191 {
4192
+ if (group.selection.size() == 0)
4193
+ return;
4194
+
4195
+ cVector bbmin = new cVector();
4196
+ cVector bbmax = new cVector();
4197
+
4198
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4199
+
4200
+ double dx = bbmax.x - bbmin.x;
4201
+ double dy = bbmax.y - bbmin.y;
4202
+ double dz = bbmax.z - bbmin.z;
4203
+
4204
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4205
+
34444206 for (int i=0; i<group.selection.size(); i++)
34454207 {
34464208 Object3D obj = group.selection.get(i);
34474209
3448
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3449
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4210
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4211
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34504212 }
34514213
34524214 refreshContents();
....@@ -3467,11 +4229,11 @@
34674229
34684230 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34694231
3470
- boolean random = CameraPane.RANDOM;
3471
- CameraPane.RANDOM = false; // parse all random nodes
4232
+ boolean random = CameraPane.SWITCH;
4233
+ CameraPane.SWITCH = false; // parse all random nodes
34724234 lowres.linkVerticesThis(null);
34734235 lowres.linkVerticesThis(sn);
3474
- CameraPane.RANDOM = random;
4236
+ CameraPane.SWITCH = random;
34754237
34764238 System.err.flush();
34774239
....@@ -3511,7 +4273,7 @@
35114273 return;
35124274
35134275 Object3D poses = group.selection.get(0);
3514
- Object3D ref = GrafreeD.clipboard.get(0);
4276
+ Object3D ref = Grafreed.clipboard.get(0);
35154277
35164278 Object3D newgroup = new Object3D("Po:" + poses.name);
35174279
....@@ -3680,7 +4442,7 @@
36804442 group.selection.RelinkToSupport(); // july 2014
36814443 System.out.println("DONE.");
36824444 refreshContents();
3683
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4445
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
36844446 }
36854447
36864448 void ReduceMesh(boolean reduction34)
....@@ -3705,9 +4467,9 @@
37054467
37064468 void ClipMesh()
37074469 {
3708
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4470
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37094471 {
3710
- Object3D content = GrafreeD.clipboard.get(0);
4472
+ Object3D content = Grafreed.clipboard.get(0);
37114473
37124474 if (content instanceof cGroup && ((cGroup)content).transientlink )
37134475 content = ((cGroup)content).get(0);
....@@ -3716,7 +4478,7 @@
37164478 // {
37174479 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37184480 // }
3719
- group.selection.ClipMesh(GrafreeD.clipboard);
4481
+ group.selection.ClipMesh(Grafreed.clipboard);
37204482 }
37214483 // group.selection.ClipMesh(GrafreeD.clipboard);
37224484 System.out.println("DONE.");
....@@ -3763,6 +4525,18 @@
37634525 void MarkLeaves(boolean hide)
37644526 {
37654527 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);
37664540 refreshContents();
37674541 }
37684542
....@@ -3837,10 +4611,6 @@
38374611 // }
38384612 // }
38394613
3840
- static boolean allparams = true;
3841
-
3842
- static Vector<Object3D> listUI = new Vector<Object3D>();
3843
-
38444614 void EditSelection(boolean newWindow)
38454615 {
38464616 // aConstraints.gridy = 0;
....@@ -3848,10 +4618,10 @@
38484618 {
38494619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
38504620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3851
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38524622
38534623 Object3D elem = (Object3D)group.selection.elementAt(i);
3854
- if(elem != group)
4624
+ if(elem != group || !newWindow)
38554625 {
38564626 // if (!(elem instanceof Composite))
38574627 // newWindow = false;
....@@ -3933,7 +4703,8 @@
39334703 //new Exception().printStackTrace();
39344704
39354705 freezemodel = true;
3936
-
4706
+ ClearUnpinned();
4707
+
39374708 /**/
39384709 //switch (event.id)
39394710 {
....@@ -3941,7 +4712,6 @@
39414712 //case 702: // Event.LIST_DESELECT
39424713 group.deselectAll();
39434714 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3944
- objEditor.ClearInfo(); // .GetMaterial());
39454715 if (tps != null)
39464716 {
39474717 for (int i=0; i < tps.length; i++)
....@@ -3950,33 +4720,39 @@
39504720
39514721 //if (child.parent != null)
39524722 //child.parent.addSelectee(child);
4723
+ objEditor.SetMaterial(child);
39534724 group.addSelectee(child);
3954
- objEditor.SetMaterial(child); // .GetMaterial());
3955
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3956
- System.err.println("info : " + child.GetPath());
39574725 }
39584726 }
3959
- else
3960
- {
3961
- objEditor.SetMaterial(group); // .GetMaterial());
3962
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3963
- System.err.println("info : " + group.GetPath());
3964
- }
4727
+// else
4728
+// {
4729
+// objEditor.SetMaterial(group); // .GetMaterial());
4730
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4731
+// System.err.println("info : " + group.GetPath());
4732
+// }
39654733
3966
- objEditor.SetText(); // jan 2014
3967
-
3968
- if (flashIt && !CameraPane.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))
39694735 CameraPane.flash = true;
39704736
3971
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4737
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39724738 // a camera
39734739 {
3974
- CameraPane.camerachangeframe = 0; // don't refuse it
3975
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3976
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3977
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
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
+ }
4745
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4746
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
39784747 }
39794748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
39804756 refreshContents();
39814757 //return true;
39824758 }
....@@ -3985,6 +4761,35 @@
39854761
39864762 freezemodel = false;
39874763 }
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
+ }
39884793
39894794 void linkSomething(Object3D thing)
39904795 {
....@@ -4056,16 +4861,19 @@
40564861 {
40574862 if (group.selection.isEmpty())
40584863 return;
4059
- GrafreeD.clipboardIsTempGroup = false;
4864
+
4865
+ Grafreed.clipboardIsTempGroup = false;
40604866 Composite tGroup = null;
40614867 if (group.selection.size() > 0) // 1)
40624868 {
40634869 tGroup = new cGroup();
4064
- GrafreeD.clipboardIsTempGroup = true;
4870
+ Grafreed.clipboardIsTempGroup = true;
40654871 }
40664872
40674873 if (cut)
40684874 {
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
40694877 //int indices[] = jList.getSelectedIndices();
40704878 //for (int i = indices.length - 1; i >= 0; i--)
40714879 //jList.remove(indices[i]);
....@@ -4101,16 +4909,16 @@
41014909 //System.out.println("cut " + child);
41024910 //System.out.println("parent = " + child.parent);
41034911 // tmp.addChild(child);
4104
- if (GrafreeD.clipboardIsTempGroup)
4912
+ if (Grafreed.clipboardIsTempGroup)
41054913 tGroup.add/*Child*/(tmp);
41064914 else
4107
- GrafreeD.clipboard = tmp;
4915
+ Grafreed.clipboard = tmp;
41084916 }
41094917 else
4110
- if (GrafreeD.clipboardIsTempGroup)
4918
+ if (Grafreed.clipboardIsTempGroup)
41114919 tGroup.add/*Child*/(child);
41124920 else
4113
- GrafreeD.clipboard = child;
4921
+ Grafreed.clipboard = child;
41144922 }
41154923
41164924 //ResetModel();
....@@ -4142,21 +4950,23 @@
41424950 //System.out.println("cut " + elem);
41434951 //System.out.println("parent = " + elem.parent);
41444952 // tmp.addChild(elem);
4145
- if (GrafreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
41464954 tGroup.add/*Child*/(tmp);
41474955 else
4148
- GrafreeD.clipboard = tmp;
4956
+ Grafreed.clipboard = tmp;
41494957 }
41504958 else
4151
- if (GrafreeD.clipboardIsTempGroup)
4959
+ if (Grafreed.clipboardIsTempGroup)
41524960 tGroup.add/*Child*/(child);
41534961 else
4154
- GrafreeD.clipboard = child;
4962
+ Grafreed.clipboard = child;
41554963 }
41564964
41574965 }
4158
- if (GrafreeD.clipboardIsTempGroup)
4159
- GrafreeD.clipboard = tGroup;
4966
+
4967
+ if (Grafreed.clipboardIsTempGroup)
4968
+ Grafreed.clipboard = tGroup;
4969
+
41604970 if (cut)
41614971 {
41624972 ResetModel();
....@@ -4166,11 +4976,15 @@
41664976
41674977 void paste(boolean expand)
41684978 {
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
41694983 // if (GrafreeD.clipboard == null)
41704984 // return;
41714985 boolean first = true;
41724986
4173
- if (GrafreeD.clipboardIsTempGroup)
4987
+ if (Grafreed.clipboardIsTempGroup)
41744988 {
41754989 Composite temp;
41764990
....@@ -4181,7 +4995,7 @@
41814995 temp = (Composite)Applet3D.clipboard.deepCopy();
41824996 */
41834997 Object3D elem;
4184
- 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))
41854999 {
41865000 Object3D child = (Object3D)e.nextElement();
41875001
....@@ -4215,21 +5029,22 @@
42155029 //Object3D cb = Applet3D.clipboard;
42165030 //temp.addChild(cb);
42175031 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4218
- assert(GrafreeD.clipboard.parent == null);
4219
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4220
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4221
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4222
- 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());
42235037 else
4224
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4225
- GrafreeD.clipboard.get(0).parent = keepparent;
5038
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5039
+ Grafreed.clipboard.get(0).parent = keepparent;
42265040 }
42275041
5042
+ Globals.REPLACEONMAKE = keep;
42285043 ResetModel();
42295044 refreshContents();
42305045 }
42315046
4232
- void pasteInto(boolean copyit)
5047
+ void pasteInto(boolean copyit, boolean clone)
42335048 {
42345049 // if (GrafreeD.clipboard == null)
42355050 // return;
....@@ -4258,15 +5073,22 @@
42585073 if (copyit)
42595074 {
42605075 // paste(false);
4261
- CloneClipboard(false); // sept 2014
5076
+ if (clone)
5077
+ {
5078
+ CloneClipboard(false); // sept 2014
5079
+ }
5080
+ else
5081
+ {
5082
+ paste(false);
5083
+ }
42625084 }
42635085 else
42645086 {
42655087 boolean first = true;
42665088
4267
- if (GrafreeD.clipboardIsTempGroup)
5089
+ if (Grafreed.clipboardIsTempGroup)
42685090 {
4269
- Composite temp = (Composite)GrafreeD.clipboard;
5091
+ Composite temp = (Composite)Grafreed.clipboard;
42705092 Object3D copy;
42715093 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42725094 {
....@@ -4276,7 +5098,7 @@
42765098 }
42775099 } else
42785100 {
4279
- linkSomething(GrafreeD.clipboard); //.get(0));
5101
+ linkSomething(Grafreed.clipboard); //.get(0));
42805102 }
42815103 }
42825104 }
....@@ -4353,6 +5175,10 @@
43535175
43545176 void group(Object3D csg, boolean grab)
43555177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
43565182 if (//false) // why??
43575183 !group.selection.isEmpty())
43585184 {
....@@ -4466,8 +5292,34 @@
44665292 //node.add(csg);
44675293 //makeSomething(node);
44685294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
44695296 }
44705297
5298
+ void Ungroup(Object3D g)
5299
+ {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
5304
+ if (g instanceof HiddenObject)
5305
+ {
5306
+ HiddenObject h = (HiddenObject) g;
5307
+
5308
+ for (int i=0; i<h.ActualSize(); i++)
5309
+ {
5310
+ objEditor.makeSomething(h.get(i), false);
5311
+ }
5312
+ }
5313
+ else
5314
+ {
5315
+ for (int i=0; i<g.Size(); i++)
5316
+ {
5317
+ objEditor.makeSomething(g.get(i), false);
5318
+ }
5319
+ }
5320
+ Globals.REPLACEONMAKE = keep;
5321
+ }
5322
+
44715323 void ungroup()
44725324 {
44735325 /*
....@@ -4661,21 +5513,6 @@
46615513 }
46625514 */
46635515
4664
- void ImportGFD()
4665
- {
4666
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4667
- browser.show();
4668
- String filename = browser.getFile();
4669
- if (filename != null && filename.length() > 0)
4670
- {
4671
- String fullname = browser.getDirectory() + filename;
4672
-
4673
- //Object3D readobj =
4674
- objEditor.ReadGFD(fullname, objEditor);
4675
- //makeSomething(readobj);
4676
- }
4677
- }
4678
-
46795516 /*
46805517 public void Callback(Object obj)
46815518 {
....@@ -4699,26 +5536,9 @@
46995536 }
47005537 */
47015538
4702
- void ImportVRMLX3D()
4703
- {
4704
- if (GrafreeD.standAlone)
4705
- {
4706
- /**/
4707
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4708
- browser.show();
4709
- String filename = browser.getFile();
4710
- if (filename != null && filename.length() > 0)
4711
- {
4712
- String fullname = browser.getDirectory() + filename;
4713
- LoadVRMLX3D(fullname);
4714
- }
4715
- /**/
4716
- }
4717
- }
4718
-
47195539 String GetFile(String dialogName)
47205540 {
4721
- if (GrafreeD.standAlone)
5541
+ if (Grafreed.standAlone)
47225542 {
47235543 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47245544 browser.show();
....@@ -4782,10 +5602,33 @@
47825602 cButton flashSelectionButton;
47835603 cButton editButton;
47845604 cButton uneditButton;
5605
+ JCheckBox allParamsButton;
47855606 cButton clearpanelButton;
4786
- cButton allParamsButton;
47875607 cButton unselectButton;
47885608
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
+
47895632 cButton screenfitButton;
47905633 cButton screenfitpointButton;
47915634 cButton snapobjectButton;
....@@ -4797,14 +5640,6 @@
47975640
47985641 cButton setsupportButton;
47995642
4800
- cButton twoButton;
4801
- cButton sixButton;
4802
- cButton threeButton;
4803
- cButton sevenButton;
4804
- cButton fourButton; // full panel
4805
- cButton oneButton; // full XYZ
4806
- //cButton currentLayout;
4807
-
48085643 //
48095644 //Composite
48105645 Object3D // to do !!
....@@ -4814,9 +5649,11 @@
48145649 //JTree jTree;
48155650 private MenuItem lookAtItem;
48165651 private MenuItem lookFromItem;
4817
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
48185653 private MenuItem cutItem;
4819
- private MenuItem duplicateItem;
5654
+ private MenuItem undoItem;
5655
+ private MenuItem redoItem;
5656
+ private JMenuItem duplicateItem;
48205657 private MenuItem cloneItem;
48215658 private MenuItem cloneSupportItem;
48225659 private MenuItem overwriteGeoItem;
....@@ -4827,8 +5664,9 @@
48275664 private MenuItem resetsupportItem;
48285665 private MenuItem resetreferencesItem;
48295666 private MenuItem linkverticesItem;
5667
+ private MenuItem relinkverticesItem;
48305668 private MenuItem setMasterItem;
4831
- private MenuItem resetMeshItem;
5669
+ private MenuItem resetAllItem;
48325670 private MenuItem stepAllItem;
48335671 private MenuItem revertMeshItem;
48345672 private MenuItem poseMeshItem;
....@@ -4839,14 +5677,17 @@
48395677 private MenuItem mergeGeometriesItem;
48405678 private MenuItem copyItem;
48415679 private MenuItem pasteItem;
5680
+ private MenuItem pasteIntoItem;
48425681 private MenuItem pasteLinkItem;
48435682 private MenuItem pasteCloneItem;
48445683 private MenuItem pasteExpandItem;
48455684 private MenuItem clearItem;
48465685 private MenuItem clearAllItem;
48475686 private MenuItem genUVItem;
5687
+ private MenuItem genNormalsMESHItem;
48485688 private MenuItem genNormalsCADItem;
48495689 private MenuItem genNormalsORGANItem;
5690
+ private MenuItem genNormalsMINEItem;
48505691 private MenuItem stripifyItem;
48515692 private MenuItem unstripifyItem;
48525693 private MenuItem trimItem;
....@@ -4875,6 +5716,10 @@
48755716 private MenuItem showleavesItem;
48765717 private MenuItem markleavesItem;
48775718 private MenuItem unmarkleavesItem;
5719
+ private MenuItem rewindleavesItem;
5720
+ private MenuItem unrewindleavesItem;
5721
+ private MenuItem randomleavesItem;
5722
+ private MenuItem unrandomleavesItem;
48785723
48795724 private MenuItem flipVItem;
48805725 private MenuItem unflipVItem;
....@@ -4886,14 +5731,17 @@
48865731 private MenuItem panoTexturesItem;
48875732
48885733 private MenuItem resetCentroidItem;
4889
- private MenuItem transformgeometryItem;
5734
+ private MenuItem resetCentroidXZItem;
48905735 private MenuItem resetTransformItem;
5736
+ private MenuItem transformGeometryItem;
5737
+ private MenuItem transformChildrenItem;
5738
+ private MenuItem hideItem;
48915739 private MenuItem grabItem;
48925740 private MenuItem backItem;
48935741 private MenuItem frontItem;
48945742 private MenuItem cameraItem;
48955743 private MenuItem compositeItem;
4896
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
48975745 private MenuItem physicsItem;
48985746 private MenuItem frameselectorItem;
48995747 private MenuItem scriptNodeItem;
....@@ -4908,6 +5756,7 @@
49085756
49095757 private MenuItem resetParentItem;
49105758 private MenuItem repairParentItem;
5759
+ private MenuItem repairShadowItem;
49115760 private MenuItem sortbysizeItem;
49125761 private MenuItem sortbynameItem;
49135762
....@@ -4928,10 +5777,11 @@
49285777 private MenuItem coneItem;
49295778 private MenuItem torusItem;
49305779 private MenuItem superItem;
5780
+ private MenuItem kleinItem;
49315781 private MenuItem blobItem;
49325782 private MenuItem latheItem;
49335783 private MenuItem bezierItem;
4934
- private MenuItem checkerItem;
5784
+ private MenuItem overlayItem;
49355785 private MenuItem meshItem;
49365786 // private MenuItem meshGroupItem;
49375787 private MenuItem springItem;
....@@ -4940,6 +5790,7 @@
49405790 private MenuItem csgItem;
49415791 private MenuItem templateItem;
49425792 private MenuItem textureItem;
5793
+ private MenuItem billboardItem;
49435794 private MenuItem shadowXItem;
49445795 private MenuItem shadowYItem;
49455796 private MenuItem shadowZItem;
....@@ -4952,11 +5803,6 @@
49525803 private MenuItem doubleItem;
49535804 private MenuItem tripleItem;
49545805
4955
- private MenuItem importGFDItem;
4956
- private MenuItem importVRMLX3DItem;
4957
- private MenuItem import3DSItem;
4958
- private MenuItem importOBJItem;
4959
-
49605806 private MenuItem computeAOItem;
49615807 private MenuItem recompileItem;
49625808 private MenuItem editScriptItem;
....@@ -4966,4 +5812,8 @@
49665812 private MenuItem analyzeItem;
49675813 private MenuItem dumpItem;
49685814 //boolean freezemodel = false;
5815
+
5816
+ Menu cameraMenu;
5817
+ MenuItem editCameraItem;
5818
+ MenuItem restoreCameraItem;
49695819 }