Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
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.SAVEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.SAVEONMAKE;
90
+ Globals.SAVEONMAKE = 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.SAVEONMAKE = 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"));
....@@ -287,6 +419,11 @@
287419 genNormalsCADItem.addActionListener(this);
288420 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
289421 genNormalsMESHItem.addActionListener(this);
422
+ if (Globals.ADVANCED)
423
+ {
424
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
425
+ genNormalsMINEItem.addActionListener(this);
426
+ }
290427 stripifyItem = menu.add(new MenuItem("Stripify"));
291428 stripifyItem.addActionListener(this);
292429 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -308,23 +445,34 @@
308445 reduce34MeshItem.addActionListener(this);
309446 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
310447 increaseMeshItem.addActionListener(this);
311
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
312
- smoothMeshItem.addActionListener(this);
313448 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
314449 clipMeshItem.addActionListener(this);
450
+
451
+ if (Globals.ADVANCED)
452
+ {
453
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
454
+ smoothMeshItem.addActionListener(this);
455
+ }
315456
316457 oe.menuBar.add(menu = new Menu("Attributes"));
317458 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
318459 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);
319464 menu.add("-");
320465 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
321466 liveleavesItem.addActionListener(this);
322467 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
323468 unliveleavesItem.addActionListener(this);
469
+ if (Globals.ADVANCED)
470
+ {
324471 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
325472 supportleavesItem.addActionListener(this);
326473 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
327474 unsupportleavesItem.addActionListener(this);
475
+ }
328476 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
329477 hideleavesItem.addActionListener(this);
330478 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -333,6 +481,14 @@
333481 markleavesItem.addActionListener(this);
334482 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
335483 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);
336492 menu.add("-");
337493 flipVItem = menu.add(new MenuItem("Flip V"));
338494 flipVItem.addActionListener(this);
....@@ -368,35 +524,40 @@
368524 sortbynameItem = menu.add(new MenuItem("Sort by name"));
369525 sortbynameItem.addActionListener(this);
370526 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.
371534 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
372535 extractGeometriesItem.addActionListener(this);
373536 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
374537 cloneGeometriesItem.addActionListener(this);
375
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
376
- shareGeometriesItem.addActionListener(this);
377
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
378
- mergeGeometriesItem.addActionListener(this);
538
+ }
379539
380540 oe.menuBar.add(menu = new Menu("Insert"));
381541 buildCreateMenu(menu);
382542
383
-
384
- oe.menuBar.add(menu = new Menu("Include"));
385
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
386
- importGFDItem.addActionListener(this);
387
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
388
- importVRMLX3DItem.addActionListener(this);
389
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
390
- importOBJItem.addActionListener(this);
391
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
392
- import3DSItem.addActionListener(this);
393
-
394543 oe.menuBar.add(menu = new Menu("Tools"));
395544 buildToolsMenu(menu);
396545 }
397546
398547 void SetupUI2(ObjEditor oe)
399548 {
549
+ // June 2019
550
+ if (oe == null)
551
+ {
552
+ //super.SetupUI2(this);
553
+ //return;
554
+ }
555
+
556
+ if (copy != group)
557
+ {
558
+ //super.SetupUI2(this);
559
+ }
560
+
400561 //new Exception().printStackTrace();
401562
402563 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -425,150 +586,217 @@
425586 oe.radioPanel.add(dummyButton);
426587 oe.buttonGroup.add(dummyButton);
427588 */
428
- aConstraints.gridy += 1;
429
- oe.aConstraints.gridwidth = 1;
430
- oe.aConstraints.gridx = 0;
589
+ cGridBag copyOptionsPanel = new cGridBag();
590
+
591
+ copyOptionsPanel.preferredHeight = 1;
431592
432
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
593
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
594
+
595
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ //minButton.setToolTipText("Minimize window");
597
+ //minButton.addActionListener(this);
598
+
599
+ if (Globals.ADVANCED)
600
+ {
601
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ maxButton.setToolTipText("Maximize window");
603
+ maxButton.addActionListener(this);
604
+ }
605
+
606
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
607
+ fullButton.setToolTipText("Full-screen window");
608
+ fullButton.addActionListener(this);
609
+
610
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ screenfitButton.setToolTipText("Screen fit");
612
+ screenfitButton.addActionListener(this);
613
+
614
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ restoreCameraButton.setToolTipText("Restore viewpoint");
616
+ restoreCameraButton.addActionListener(this);
617
+
618
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ undoButton.setToolTipText("Undo changes");
620
+ undoButton.addActionListener(this);
621
+ undoButton.setEnabled(false);
622
+
623
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ redoButton.setToolTipText("Redo changes");
625
+ redoButton.addActionListener(this);
626
+ redoButton.setEnabled(false);
627
+
628
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ saveButton.setToolTipText("Save changes");
630
+ saveButton.addActionListener(this);
631
+
632
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
633
+ liveCB.setToolTipText("Enable animation");
433634 liveCB.addItemListener(this);
434635
435
- oe.aConstraints.gridx += 1;
436
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
437
- supportCB.addItemListener(this);
438
-
439
- // oe.aConstraints.gridx += 1;
440
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
441
- // localCB.addItemListener(this);
442
-
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
445
- crowdCB.addItemListener(this);
446
-
447
- oe.aConstraints.gridx += 1;
448
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
449
- smoothCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
636
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637
+ oneStepButton.setToolTipText("Animate one step forward");
638
+ oneStepButton.addActionListener(this);
639
+
640
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
641
+ fastCB.setToolTipText("Fast mode");
453642 fastCB.addItemListener(this);
454
- oe.aConstraints.gridx += 1;
455
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
456
- slowCB.addItemListener(this);
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
459
- boxCB.addItemListener(this);
643
+
644
+ //oe.toolboxPanel.Return();
645
+
646
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
647
+// trackCB.setToolTipText("Enable tracking");
648
+// trackCB.addItemListener(this);
460649
461
-// oe.aConstraints.gridx += 1;
462
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
463
-// speakerMocapCB.addItemListener(this);
464
-
465
- if (false)
466
- {
467
- // handled in scripts
468
- oe.aConstraints.gridx += 1;
469
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
470
- speakerCameraCB.addItemListener(this);
471
-
472
- oe.aConstraints.gridx += 1;
473
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
474
- speakerFocusCB.addItemListener(this);
475
-
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
478
- smoothfocusCB.addItemListener(this);
479
- }
480
-
481
-//oe.aConstraints.gridx += 1;
482
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
483
-// debugCB.addItemListener(this);
484
-
485
- oe.aConstraints.gridx += 1;
486
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
487
- oeilCB.addItemListener(this);
488
-
489
- oe.aConstraints.gridx += 1;
490
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
491
- lookAtCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
495
- trackCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
499
- screenfitButton.addActionListener(this);
500
- oe.aConstraints.gridx += 1;
501650 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
502651 // screenfitpointButton.addActionListener(this);
503
-// oe.aConstraints.gridx += 1;
504
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
505
- snapobjectButton.addActionListener(this);
506
- oe.aConstraints.gridx += 1;
507652
508
- //aConstraints.gridx = 0;
509
- //aConstraints.gridy += 1;
510
- oe.aConstraints.weighty = 0;
511
- oe.aConstraints.gridwidth = 1;
512
-
513
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
514
- flashSelectionButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.aConstraints.weighty = 0;
517
- oe.aConstraints.gridwidth = 1;
653
+ if (Globals.ADVANCED)
654
+ {
655
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ snapobjectButton.addActionListener(this);
657
+ snapobjectButton.setToolTipText("Snap Object");
658
+ }
659
+
660
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
518661
519
- //
520
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
+ twoButton.setToolTipText("Show center view only");
521664 twoButton.addActionListener(this);
522
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
665
+ this.fullscreenLayout = twoButton;
666
+
667
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
523668 fourButton.addActionListener(this);
524
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
669
+ fourButton.setToolTipText("Show left panel only");
670
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
+ sixButton.setToolTipText("2-column layout left");
525672 sixButton.addActionListener(this);
526
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
673
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
+ threeButton.setToolTipText("2-column layout right");
527675 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
677
+ sevenButton.setToolTipText("3-column layout");
529678 sevenButton.addActionListener(this);
530679 //
531680
532
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
681
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ rootButton.setToolTipText("Edit selection in new tab");
533683 rootButton.addActionListener(this);
534
- oe.aConstraints.gridx += 1;
535
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
684
+
685
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686
+ closeButton.setToolTipText("Close tab");
536687 closeButton.addActionListener(this);
537688 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
538689 //clearButton.addActionListener(this);
539
- oe.aConstraints.gridx += 1;
540
-
541
- oe.aConstraints.gridx = 1; //
542
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
543
- editButton.addActionListener(this);
544
- oe.aConstraints.gridx += 1;
545
- oe.aConstraints.weighty = 0;
546
- oe.aConstraints.gridwidth = 1;
547690
548
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
691
+ // INSERT
692
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ gridButton.setToolTipText("Create grid");
694
+ gridButton.addActionListener(this);
695
+
696
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697
+ boxButton.setToolTipText("Create box");
698
+ boxButton.addActionListener(this);
699
+
700
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+ sphereButton.setToolTipText("Create sphere");
702
+ sphereButton.addActionListener(this);
703
+
704
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705
+ coneButton.setToolTipText("Create cone");
706
+ coneButton.addActionListener(this);
707
+
708
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ torusButton.setToolTipText("Create torus");
710
+ torusButton.addActionListener(this);
711
+
712
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ superButton.setToolTipText("Create superellipsoid");
714
+ superButton.addActionListener(this);
715
+
716
+ if (Globals.ADVANCED)
717
+ {
718
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ kleinButton.setToolTipText("Create Klein bottle");
720
+ kleinButton.addActionListener(this);
721
+ }
722
+
723
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ particlesButton.setToolTipText("Create particle system");
725
+ particlesButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.Return();
728
+
729
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ groupButton.setToolTipText("Create group");
731
+ groupButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ compositeButton.setToolTipText("Create composite");
735
+ compositeButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ switchButton.setToolTipText("Create item switcher");
739
+ switchButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ loopButton.setToolTipText("Create loop");
743
+ loopButton.addActionListener(this);
744
+
745
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ textureButton.setToolTipText("Create texture");
747
+ textureButton.addActionListener(this);
748
+
749
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ overlayButton.setToolTipText("Create overlay");
751
+ overlayButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
+ lightButton.setToolTipText("Create light");
755
+ lightButton.addActionListener(this);
756
+
757
+ for (int i=6; --i>=0;)
758
+ {
759
+ oe.toolboxPanel.Return();
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ oe.toolboxPanel.add(new cGridBag());
762
+ oe.toolboxPanel.add(new cGridBag());
763
+ oe.toolboxPanel.add(new cGridBag());
764
+ oe.toolboxPanel.add(new cGridBag());
765
+ oe.toolboxPanel.add(new cGridBag());
766
+ oe.toolboxPanel.add(new cGridBag());
767
+ }
768
+
769
+ // EDIT panel
770
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ editButton.setToolTipText("Pin selection controls");
772
+ editButton.addActionListener(this);
773
+
774
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ uneditButton.setToolTipText("Remove selection controls");
549776 uneditButton.addActionListener(this);
550777
551
- oe.aConstraints.gridx += 1;
552
- oe.aConstraints.weighty = 0;
553
- oe.aConstraints.gridwidth = 1;
554
-
555
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
556
- clearPanelButton.addActionListener(this);
557
-
558
- oe.aConstraints.gridx += 1;
559
- oe.aConstraints.weighty = 0;
560
- oe.aConstraints.gridwidth = 1;
561
-
562
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
778
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
779
+ allParamsButton.setToolTipText("Show all controle");
563780 allParamsButton.addActionListener(this);
564781
565
- oe.aConstraints.gridx += 1;
566
- oe.aConstraints.weighty = 0;
567
- oe.aConstraints.gridwidth = 1;
568
-
569
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
782
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
783
+ clearPanelButton.setToolTipText("Clear edit panel");
784
+ clearPanelButton.addActionListener(this);
785
+
786
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
787
+ unselectButton.setToolTipText("Unselect");
570788 unselectButton.addActionListener(this);
571789
790
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
791
+ flashSelectionButton.setToolTipText("Highlight selection");
792
+ flashSelectionButton.addActionListener(this);
793
+
794
+ editCommandsPanel.preferredHeight = 1;
795
+
796
+ SetPinStates(false);
797
+// oe.treePanel.add(commandsPanel);
798
+// oe.treePanel.Return();
799
+
572800 // oe.aConstraints.gridx += 1;
573801 // oe.aConstraints.weighty = 0;
574802 // oe.aConstraints.gridwidth = 1;
....@@ -580,40 +808,22 @@
580808 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
581809 // gcButton.addActionListener(this);
582810
583
- oe.aConstraints.gridx = 0;
584
- oe.aConstraints.gridy += 1;
585
-
586
- //ctrlPanel.add(objList = new List(5, true));
587
- oe.aConstraints.gridwidth = 100;
588
- // oe.aConstraints.gridheight = 100;
589
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
590
- oe.aConstraints.gridheight = 1;
591
- oe.aConstraints.weighty = 0.5;
592
- oe.aConstraints.gridx = 0;
593
- JScrollPane jSP;
811
+ cGridBag jSPPanel = new cGridBag();
812
+
813
+ JScrollPane jSP;
594814 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
595
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
815
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
596816 ResetModel();
597
- oe.aConstraints.weighty = 0.5;
598
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
599
- oe.aConstraints.gridy += 1;
600
- oe.aConstraints.gridwidth = 1;
601
-
602
- oe.aConstraints.weighty = 0;
603
- oe.aConstraints.gridwidth = 2;
604
-
605
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
606
- colorCB.addItemListener(this);
607
- oe.aConstraints.gridx += 2;
608
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
609
- materialCB.addItemListener(this);
610
- oe.aConstraints.gridx += 2;
611
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
612
- textureCB.addItemListener(this);
613
-
614
- oe.aConstraints.gridx = 0;
615
- oe.aConstraints.gridy += 1;
616817
818
+ oe.treePanel.add(jSPPanel);
819
+ oe.treePanel.Return();
820
+
821
+ oe.treePanel.add(copyOptionsPanel);
822
+ oe.treePanel.Return();
823
+
824
+// mainPanel.setDividerLocation(0.5); //1.0);
825
+// mainPanel.setResizeWeight(0.5);
826
+
617827 //jList.addListSelectionListener(this);
618828 oe.jTree.addTreeSelectionListener(this);
619829 //jTree.setRootVisible(false);
....@@ -635,20 +845,157 @@
635845 radio.layout = sevenButton;
636846 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
637847 }
848
+
849
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
850
+ {
851
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
852
+ colorCB.setToolTipText("Copy color when dropped");
853
+ colorCB.addItemListener(this);
854
+
855
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
856
+ materialCB.setToolTipText("Copy material when dropped");
857
+ materialCB.addItemListener(this);
858
+
859
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
860
+ textureCB.setToolTipText("Copy texture when dropped");
861
+ textureCB.addItemListener(this);
862
+
863
+ panel.Return();
864
+
865
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
866
+ boxCB.setToolTipText("Display bounding boxes");
867
+ boxCB.addItemListener(this);
868
+
869
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
870
+ zoomBoxCB.setToolTipText("Display only for wheel");
871
+ zoomBoxCB.addItemListener(this);
872
+
873
+ if (true) // Globals.ADVANCED)
874
+ {
875
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
876
+// supportCB.setToolTipText("Enable rigging");
877
+// supportCB.addItemListener(this);
878
+
879
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
880
+ freezeCB.setToolTipText("Fast moving camera");
881
+ freezeCB.addItemListener(this);
882
+
883
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
884
+ // localCB.addItemListener(this);
885
+
886
+ panel.Return();
887
+
888
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
889
+ crowdCB.setToolTipText("Used for crowds");
890
+ crowdCB.addItemListener(this);
891
+
892
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
893
+ smoothCB.setToolTipText("Snapping delay");
894
+ smoothCB.addItemListener(this);
895
+
896
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
897
+ slowCB.setToolTipText("Smooth interpolation");
898
+ slowCB.addItemListener(this);
899
+
900
+// constraints.gridy += 1;
901
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
902
+// speakerMocapCB.addItemListener(this);
903
+
904
+ panel.Return();
905
+
906
+ if (false)
907
+ {
908
+ // handled in scripts
909
+ //constraints.gridy += 1;
910
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
911
+ speakerCameraCB.addItemListener(this);
912
+
913
+ //constraints.gridy += 1;
914
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
915
+ speakerFocusCB.addItemListener(this);
916
+
917
+ //constraints.gridy += 1;
918
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
919
+ smoothfocusCB.addItemListener(this);
920
+ panel.Return();
921
+ }
922
+
923
+//constraints.gridx += 1;
924
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
925
+// debugCB.addItemListener(this);
926
+
927
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
928
+ trackCB.setToolTipText("Enable tracking target");
929
+ trackCB.addItemListener(this);
930
+
931
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
932
+ oeilCB.setToolTipText("Move camera when tracking");
933
+ oeilCB.addItemListener(this);
934
+
935
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
936
+ shadowCB.setToolTipText("When live compute shadows");
937
+ shadowCB.addItemListener(this);
938
+
939
+ panel.Return();
940
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
941
+ toggleTextureCB.setToolTipText("Load textures");
942
+ toggleTextureCB.addItemListener(this);
943
+
944
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
945
+ toggleSwitchCB.setToolTipText("Choose a single item");
946
+ toggleSwitchCB.addItemListener(this);
947
+
948
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
949
+ autosaveCB.setToolTipText("On structure change");
950
+ autosaveCB.addItemListener(this);
951
+
952
+ panel.Return();
953
+ if (Globals.ADVANCED)
954
+ {
955
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
956
+ lookAtCB.setToolTipText("Look-at target");
957
+ lookAtCB.addItemListener(this);
958
+ }
959
+
960
+ }
961
+
962
+ cGridBag fill = new cGridBag();
963
+ fill.preferredHeight = 200;
964
+ cGridBag fill2 = new cGridBag();
965
+ fill2.preferredHeight = 200;
966
+ cGridBag fill3 = new cGridBag();
967
+ fill3.preferredHeight = 200;
968
+
969
+ panel.add(fill);
970
+ panel.add(fill2);
971
+ panel.add(fill3);
972
+
973
+ }
638974
639975 void EditObject(Object3D obj)
640976 {
641
- cRadio dummyButton = new cRadio(obj.name);
642
- dummyButton.SetObject(obj);
643
- dummyButton.layout = sevenButton;
644
- dummyButton.SetCamera(cameraView.renderCamera, false);
645
- dummyButton.addActionListener(this);
646
- radioPanel.add(dummyButton);
647
- buttonGroup.add(dummyButton);
648
- dummyButton.doClick();
977
+ cRadio radioButton = new cRadio(obj.name);
978
+
979
+ // June 2019. Patch to avoid bug with transparency.
980
+ radioButton.hadMaterial = obj.material != null;
981
+ if (!radioButton.hadMaterial)
982
+ {
983
+ obj.material = new cMaterial();
984
+ }
985
+
986
+ radioButton.SetObject(obj);
987
+ radioButton.layout = sevenButton;
988
+ radioButton.SetCamera(cameraView.renderCamera, false);
989
+ radioButton.addActionListener(this);
990
+ radioPanel.add(radioButton);
991
+ buttonGroup.add(radioButton);
992
+ radioButton.doClick();
649993 }
994
+
650995 void SetupViews(ObjEditor oe)
651996 {
997
+ theFrame = this;
998
+
652999 oe.SetupViews();
6531000
6541001 System.out.println("SetupViews");
....@@ -657,22 +1004,28 @@
6571004 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6581005 }
6591006
660
- JCheckBox liveCB;
661
- JCheckBox supportCB;
662
- JCheckBox localCB;
663
- JCheckBox crowdCB;
664
- JCheckBox smoothCB;
665
- JCheckBox fastCB;
666
- JCheckBox slowCB;
667
- JCheckBox boxCB;
668
- JCheckBox trackCB;
669
- JCheckBox smoothfocusCB;
1007
+ cToggleButton liveCB;
1008
+ cCheckBox supportCB;
1009
+ cCheckBox localCB;
1010
+ cCheckBox crowdCB;
1011
+ cCheckBox smoothCB;
1012
+ cToggleButton fastCB;
1013
+ cCheckBox slowCB;
1014
+ cCheckBox boxCB;
1015
+ cCheckBox zoomBoxCB;
1016
+ cCheckBox freezeCB;
1017
+ //cToggleButton trackCB;
1018
+ cCheckBox trackCB;
1019
+ cCheckBox smoothfocusCB;
6701020 // JCheckBox speakerMocapCB;
671
- JCheckBox speakerCameraCB;
672
- JCheckBox speakerFocusCB;
673
- JCheckBox debugCB;
674
- JCheckBox oeilCB;
675
- JCheckBox lookAtCB;
1021
+ cCheckBox speakerCameraCB;
1022
+ cCheckBox speakerFocusCB;
1023
+ cCheckBox debugCB;
1024
+
1025
+ cCheckBox oeilCB;
1026
+ cCheckBox shadowCB;
1027
+ cCheckBox autosaveCB;
1028
+ cCheckBox lookAtCB;
6761029
6771030 // static int COLOR = 1;
6781031 // static int MATERIAL = 2;
....@@ -680,9 +1033,9 @@
6801033
6811034 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6821035
683
- JCheckBox colorCB;
684
- JCheckBox materialCB;
685
- JCheckBox textureCB;
1036
+ cCheckBox colorCB;
1037
+ cCheckBox materialCB;
1038
+ cCheckBox textureCB;
6861039
6871040 public void itemStateChanged(ItemEvent e)
6881041 {
....@@ -707,10 +1060,10 @@
7071060 dropAttributes |= Object3D.TEXTURE;
7081061 else
7091062 dropAttributes &= ~Object3D.TEXTURE;
710
- }
711
- else if(e.getSource() == liveCB)
1063
+ } else if(e.getSource() == liveCB)
7121064 {
7131065 cameraView.ToggleLive();
1066
+ refreshContents(false);
7141067 }
7151068 else if(e.getSource() == supportCB)
7161069 {
....@@ -746,6 +1099,10 @@
7461099 cameraView.repaint();
7471100 // refreshContents();
7481101 }
1102
+ else if(e.getSource() == zoomBoxCB)
1103
+ {
1104
+ cameraView.ToggleZoomBoxMode();
1105
+ }
7491106 else if(e.getSource() == smoothfocusCB)
7501107 {
7511108 cameraView.ToggleSmoothFocus();
....@@ -771,6 +1128,18 @@
7711128 {
7721129 cameraView.ToggleOeil();
7731130 }
1131
+ else if(e.getSource() == shadowCB)
1132
+ {
1133
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1134
+ }
1135
+ else if(e.getSource() == freezeCB)
1136
+ {
1137
+ Globals.FREEZEONMOVE ^= true;
1138
+ }
1139
+ else if(e.getSource() == autosaveCB)
1140
+ {
1141
+ Globals.SAVEONMAKE ^= true;
1142
+ }
7741143 else if(e.getSource() == lookAtCB)
7751144 {
7761145 cameraView.ToggleLookAt();
....@@ -787,7 +1156,8 @@
7871156
7881157 /**/
7891158 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
790
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1159
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1160
+ TreePath path = objEditor.jTree.getSelectionPath();
7911161 if ((path == null) || (path.getPathCount() <= 1)) {
7921162 // We can't move the root node or an empty selection
7931163 return;
....@@ -850,8 +1220,6 @@
8501220 }
8511221 }
8521222
853
- String string = (String) object;
854
-
8551223 System.out.println("Transfer = " + object + "; drop : " + target);
8561224 // if( object instanceof java.io.File[])
8571225 // {
....@@ -859,7 +1227,11 @@
8591227 // objEditor.DropFile((java.io.File[]) object, true);
8601228 // return;
8611229 // }
862
- if (string.charAt(0) == '/')
1230
+
1231
+ String string = object.toString();
1232
+
1233
+ // File path for Mac and Windows
1234
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8631235 {
8641236 // file(s)
8651237 String[] names = string.split("\n");
....@@ -886,7 +1258,7 @@
8861258
8871259 flashIt = false;
8881260 CameraPane pane = (CameraPane) target;
889
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1261
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8901262 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8911263
8921264 if (group.selection.size() == 1)
....@@ -902,23 +1274,33 @@
9021274
9031275 assert target == objEditor.jTree;
9041276 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1277
+ Object3D destinationLeaf;
9051278 try {
906
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1279
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9071280 } catch (Exception e) {
9081281 System.out.println("destinationPath : " + destinationPath);
9091282 return;
9101283 }
9111284
912
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1285
+ for (int i=group.selection.size(); --i>=0;)
9131286 {
1287
+ Object3D child = (Object3D)group.selection.elementAt(i);
1288
+
1289
+ // Cannot move into itself
1290
+ if (child == destinationLeaf)
1291
+ return;
1292
+ }
1293
+
1294
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1295
+// {
9141296 loadClipboard(true);
9151297 objEditor.jTree.setSelectionPath(destinationPath);
916
- pasteInto(false);
917
- } else {
918
- loadClipboard(false);
919
- objEditor.jTree.setSelectionPath(destinationPath);
920
- pasteInto(false); // true); // ???
921
- }
1298
+ pasteInto(false, false);
1299
+// } else {
1300
+// loadClipboard(false);
1301
+// objEditor.jTree.setSelectionPath(destinationPath);
1302
+// pasteInto(false, false); // true); // ???
1303
+// }
9221304 }
9231305 public void dropActionChanged(DropTargetDragEvent dtde)
9241306 // Called if the user has modified the current drop gesture
....@@ -1023,83 +1405,107 @@
10231405 {
10241406 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10251407 //heightFieldItem.addActionListener(this);
1026
- gridItem = menu.add(new MenuItem("Grid"));
1027
- gridItem.addActionListener(this);
1028
- rectoidItem = menu.add(new MenuItem("Box"));
1029
- rectoidItem.addActionListener(this);
1030
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1031
- ellipsoidItem.addActionListener(this);
1032
- coneItem = menu.add(new MenuItem("Cone"));
1033
- coneItem.addActionListener(this);
1034
- torusItem = menu.add(new MenuItem("Torus"));
1035
- torusItem.addActionListener(this);
1036
- superItem = menu.add(new MenuItem("Superellipsoid"));
1037
- superItem.addActionListener(this);
1038
- particleItem = menu.add(new MenuItem("Particle system"));
1039
- particleItem.addActionListener(this);
1408
+// gridItem = menu.add(new MenuItem("Grid"));
1409
+// gridItem.addActionListener(this);
1410
+// rectoidItem = menu.add(new MenuItem("Box"));
1411
+// rectoidItem.addActionListener(this);
1412
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1413
+// ellipsoidItem.addActionListener(this);
1414
+// coneItem = menu.add(new MenuItem("Cone"));
1415
+// coneItem.addActionListener(this);
1416
+// torusItem = menu.add(new MenuItem("Torus"));
1417
+// torusItem.addActionListener(this);
1418
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1419
+// superItem.addActionListener(this);
1420
+
1421
+ cameraItem = menu.add(new MenuItem("Camera"));
1422
+ cameraItem.addActionListener(this);
1423
+
1424
+ if (!Globals.ADVANCED)
1425
+ {
1426
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1427
+ kleinItem.addActionListener(this);
1428
+ }
1429
+
1430
+// particleItem = menu.add(new MenuItem("Particle system"));
1431
+// particleItem.addActionListener(this);
1432
+ if (Globals.ADVANCED)
1433
+ {
10401434 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10411435 ragdollItem.addActionListener(this);
10421436 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10431437 ragdoll2Item.addActionListener(this);
1438
+ }
10441439 menu.add("-");
1045
- meshItem = menu.add(new MenuItem("Mesh"));
1440
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10461441 meshItem.addActionListener(this);
10471442 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10481443 // meshGroupItem.addActionListener(this);
1444
+ if (Globals.ADVANCED)
1445
+ {
10491446 springItem = menu.add(new MenuItem("Spring"));
10501447 springItem.addActionListener(this);
10511448 flagItem = menu.add(new MenuItem("Flag"));
10521449 flagItem.addActionListener(this);
1053
- bezierItem = menu.add(new MenuItem("Patch"));
1054
- bezierItem.addActionListener(this);
1055
- checkerItem = menu.add(new MenuItem("Checker"));
1056
- checkerItem.addActionListener(this);
10571450 blobItem = menu.add(new MenuItem("Blob"));
10581451 blobItem.addActionListener(this);
10591452 latheItem = menu.add(new MenuItem("Lathe"));
10601453 latheItem.addActionListener(this);
1061
- lightItem = menu.add(new MenuItem("Light"));
1062
- lightItem.addActionListener(this);
1454
+ }
1455
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1456
+ bezierItem.addActionListener(this);
1457
+// overlayItem = menu.add(new MenuItem("Overlay"));
1458
+// overlayItem.addActionListener(this);
1459
+// lightItem = menu.add(new MenuItem("Light"));
1460
+// lightItem.addActionListener(this);
10631461 menu.add("-");
10641462 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10651463 //superLoopItem.addActionListener(this);
1066
- loopItem = menu.add(new MenuItem("Loop"));
1067
- loopItem.addActionListener(this);
1464
+// loopItem = menu.add(new MenuItem("Loop"));
1465
+// loopItem.addActionListener(this);
10681466 doubleItem = menu.add(new MenuItem("Fork"));
10691467 doubleItem.addActionListener(this);
1468
+ if (Globals.ADVANCED)
1469
+ {
10701470 tripleItem = menu.add(new MenuItem("Trident"));
10711471 tripleItem.addActionListener(this);
1472
+ }
10721473 }
10731474
10741475 void buildToolsMenu(Menu menu)
10751476 {
10761477 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10771478 animationItem.addItemListener(this);
1078
- animationItem.setState(CameraPane.ANIMATION);
1479
+ animationItem.setState(Globals.ANIMATION);
1480
+
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
10791483
10801484 menu.add("-");
10811485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10821486 parseverticesItem.addActionListener(this);
10831487 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10841488 textureFieldItem.addActionListener(this);
1085
- alignItem = menu.add(new MenuItem("Align"));
1489
+ alignItem = menu.add(new MenuItem("Align Objects"));
10861490 alignItem.addActionListener(this);
1087
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1088
- mirrorItem.addActionListener(this);
10891491 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10901492 reduceMorphItem.addActionListener(this);
10911493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10921494 reduce34MorphItem.addActionListener(this);
1093
-
1094
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1095
- computeAOItem.addActionListener(this);
10961495 menu.add("-");
1097
-
10981496 menu.add(memoryItem = new MenuItem("Memory Usage"));
10991497 memoryItem.addActionListener(this);
1498
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1499
+ computeAOItem.addActionListener(this);
1500
+
1501
+ if (Globals.ADVANCED)
1502
+ {
1503
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1504
+ mirrorItem.addActionListener(this);
1505
+ menu.add("-");
11001506 menu.add(analyzeItem = new MenuItem("Analyze"));
11011507 analyzeItem.addActionListener(this);
1102
- menu.add(dumpItem = new MenuItem("Dump"));
1508
+ menu.add(dumpItem = new MenuItem("Print"));
11031509 dumpItem.addActionListener(this);
11041510 // menu.add(pathItem = new MenuItem("From-to path"));
11051511 // pathItem.addActionListener(this);
....@@ -1108,6 +1514,8 @@
11081514 resetParentItem.addActionListener(this);
11091515 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11101516 repairParentItem.addActionListener(this);
1517
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1518
+ repairShadowItem.addActionListener(this);
11111519 menu.add(invariantsItem = new MenuItem("Invariants"));
11121520 invariantsItem.addActionListener(this);
11131521 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1115,6 +1523,7 @@
11151523 menu.add("-");
11161524 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11171525 editScriptItem.addActionListener(this);
1526
+ }
11181527 }
11191528
11201529 void ScreenFit()
....@@ -1237,9 +1646,24 @@
12371646 shadow.material = new cMaterial(obj.material);
12381647 shadow.material.diffuse = 0.0001f;
12391648 shadow.material.specular = 0.0001f;
1649
+ //shadow.projectedVertices[1].x = 300;
12401650
12411651 makeSomething(shadow);
12421652 }
1653
+
1654
+ private void ClearUnpinned()
1655
+ {
1656
+ //for (Object3D obj : listUI)
1657
+ for (int i=listUI.size(); --i>=0;)
1658
+ {
1659
+ Object3D obj = listUI.elementAt(i);
1660
+ if (!obj.pinned)
1661
+ {
1662
+ obj.CloseUI();
1663
+ listUI.remove(i);
1664
+ }
1665
+ }
1666
+ }
12431667
12441668 /**
12451669 * applyExample
....@@ -1443,9 +1867,9 @@
14431867
14441868 void Overwrite(int mask)
14451869 {
1446
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1870
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14471871 {
1448
- Object3D content = GrafreeD.clipboard.get(0);
1872
+ Object3D content = Grafreed.clipboard.get(0);
14491873
14501874 if (content instanceof cGroup && ((cGroup)content).transientlink )
14511875 content = ((cGroup)content).get(0);
....@@ -1468,6 +1892,7 @@
14681892 //
14691893 public void actionPerformed(ActionEvent event) // , Object arg)
14701894 {
1895
+ Object source = event.getSource();
14711896 /*
14721897 if (event.getSource() == nameField)
14731898 {
....@@ -1479,11 +1904,11 @@
14791904 }
14801905 else
14811906 */
1482
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1907
+ if (source == lookAtItem || source == lookFromItem)
14831908 {
14841909 ScreenFit();
14851910 } else
1486
- if (event.getSource() == switchItem)
1911
+ if (source == switchViewItem)
14871912 {
14881913 cVector v1 = new cVector();
14891914 cVector v2 = new cVector();
....@@ -1492,11 +1917,11 @@
14921917 objEditor.cameraView.renderCamera.setAim(v2, v1);
14931918 objEditor.cameraView.repaint();
14941919 } else
1495
- if (event.getSource() == rectoidItem)
1920
+ if (source == rectoidItem || source == boxButton)
14961921 {
14971922 makeSomething(new Box());
14981923 } else
1499
- if (event.getSource() == particleItem)
1924
+ if (source == particleItem || source == particlesButton)
15001925 {
15011926 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15021927 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1517,9 +1942,9 @@
15171942 applyExample(particleGeom, "SMOKE");
15181943 makeSomething(particleGeom);
15191944 } else
1520
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1945
+ if (source == ragdollItem || source == ragdoll2Item)
15211946 {
1522
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1947
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15231948
15241949 ragdoll.toParent = LA.newMatrix();
15251950 ragdoll.fromParent = LA.newMatrix();
....@@ -1537,7 +1962,7 @@
15371962 } else
15381963 /*
15391964 */
1540
- if (event.getSource() == heightFieldItem)
1965
+ if (source == heightFieldItem)
15411966 {
15421967 Object3D obj = new Object3D();
15431968
....@@ -1575,27 +2000,31 @@
15752000
15762001 makeSomething(obj);
15772002 } else
1578
- if (event.getSource() == gridItem)
2003
+ if (source == gridItem || source == gridButton)
15792004 {
15802005 makeSomething(new Grid());
15812006 } else
1582
- if (event.getSource() == ellipsoidItem)
2007
+ if (source == ellipsoidItem || source == sphereButton)
15832008 {
15842009 makeSomething(new Sphere());
15852010 } else
1586
- if (event.getSource() == coneItem)
2011
+ if (source == coneItem || source == coneButton)
15872012 {
15882013 makeSomething(new Cone());
15892014 } else
1590
- if (event.getSource() == torusItem)
2015
+ if (source == torusItem || source == torusButton)
15912016 {
15922017 makeSomething(new Torus());
15932018 } else
1594
- if (event.getSource() == superItem)
2019
+ if (source == superItem || source == superButton)
15952020 {
15962021 makeSomething(new Superellipsoid());
15972022 } else
1598
- if (event.getSource() == blobItem)
2023
+ if (source == kleinItem || source == kleinButton)
2024
+ {
2025
+ makeSomething(new Klein());
2026
+ } else
2027
+ if (source == blobItem)
15992028 {
16002029 Blob blob = new Blob();
16012030 BlobComponent comp = new BlobComponent();
....@@ -1603,15 +2032,15 @@
16032032 //blob.retile();
16042033 makeSomething(blob);
16052034 } else
1606
- if (event.getSource() == latheItem)
2035
+ if (source == latheItem)
16072036 {
16082037 makeSomething(new Lathe());
16092038 } else
1610
- if (event.getSource() == bezierItem)
2039
+ if (source == bezierItem)
16112040 {
16122041 makeSomething(new BezierSurface());
16132042 } else
1614
- if (event.getSource() == checkerItem)
2043
+ if (source == overlayItem || source == overlayButton)
16152044 {
16162045 /*
16172046 Object3D obj = new BezierSurface(5,8);
....@@ -1626,7 +2055,7 @@
16262055 */
16272056 makeSomething(new Checker());
16282057 } else
1629
- if (event.getSource() == meshItem)
2058
+ if (source == meshItem)
16302059 {
16312060 Object3D itemtomake = new Object3D();
16322061 Object3D child;
....@@ -1647,35 +2076,35 @@
16472076 makeSomething(child);
16482077 }
16492078 } else
1650
- if (event.getSource() == springItem)
2079
+ if (source == springItem)
16512080 {
16522081 cSpring s = new cSpring();
16532082 s.setup();
16542083 makeSomething(s);
16552084 } else
1656
- if (event.getSource() == flagItem)
2085
+ if (source == flagItem)
16572086 {
16582087 cSpring s = new cFlag();
16592088 s.setup();
16602089 makeSomething(s);
16612090 } else
1662
- if (event.getSource() == lightItem)
2091
+ if (source == lightItem || source == lightButton)
16632092 {
16642093 makeSomething(new Light());
16652094 } else
1666
- if (event.getSource() == csgItem)
2095
+ if (source == csgItem)
16672096 {
16682097 group(new CSG());
16692098 } else
1670
- if (event.getSource() == templateItem)
2099
+ if (source == templateItem)
16712100 {
16722101 group(new cTemplate());
16732102 } else
1674
- if (event.getSource() == attributeItem)
2103
+ if (source == attributeItem)
16752104 {
16762105 makeSomething(new Attribute());
16772106 } else
1678
- if (event.getSource() == pointflowItem)
2107
+ if (source == pointflowItem)
16792108 {
16802109 makeSomething(new PointFlow());
16812110 } else
....@@ -1687,7 +2116,7 @@
16872116 } else
16882117 */
16892118
1690
- if (event.getSource() == superLoopItem)
2119
+ if (source == superLoopItem)
16912120 {
16922121 Composite g = new cGroup();
16932122 for (int i=0; i<15; i++)
....@@ -1709,30 +2138,30 @@
17092138
17102139 group(g);
17112140 } else
1712
- if (event.getSource() == loopItem)
2141
+ if (source == loopItem || source == loopButton)
17132142 {
17142143 Composite csg = new GroupLeaf();
17152144 csg.count = 5;
17162145 group(csg);
1717
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
17182147 csg.addChild(child);
17192148 child.addChild(csg);
17202149 } else
1721
- if (event.getSource() == doubleItem)
2150
+ if (source == doubleItem)
17222151 {
1723
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
17242153 csg.count = 5;
17252154 group(csg);
1726
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
17272156 csg.addChild(child);
17282157 child.addChild(csg);
1729
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
17302159 csg.addChild(child);
17312160 child.addChild(csg);
17322161 } else
1733
- if (event.getSource() == tripleItem)
2162
+ if (source == tripleItem)
17342163 {
1735
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
17362165 csg.count = 4;
17372166 group(csg);
17382167 Composite child = new cGroup();
....@@ -1745,73 +2174,84 @@
17452174 csg.addChild(child);
17462175 child.addChild(csg);
17472176 } else
1748
-
1749
- if (event.getSource() == importGFDItem)
2177
+ if (source == computeAOItem)
17502178 {
1751
- ImportGFD();
2179
+ Globals.drawMode = CameraPane.OCCLUSION;
2180
+ Globals.theRenderer.repaint();
17522181 } else
1753
- if (event.getSource() == importVRMLX3DItem)
1754
- {
1755
- ImportVRMLX3D();
1756
- } else
1757
- if (event.getSource() == import3DSItem)
1758
- {
1759
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1760
- } else
1761
- if (event.getSource() == importOBJItem)
1762
- {
1763
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1764
- } else
1765
- if (event.getSource() == computeAOItem)
1766
- {
1767
- CameraPane.drawMode = CameraPane.OCCLUSION;
1768
- CameraPane.theRenderer.repaint();
1769
- } else
1770
- if (event.getSource() == recompileItem)
2182
+ if (source == recompileItem)
17712183 {
17722184 Recompile();
17732185 refreshContents();
17742186 } else
1775
- if (event.getSource() == editScriptItem)
2187
+ if (source == editScriptItem)
17762188 {
17772189 OpenDialog();
17782190 refreshContents();
17792191 } else
1780
- if (event.getSource() == invariantsItem)
2192
+ if (source == invariantsItem)
17812193 {
17822194 System.out.println("Invariants:");
1783
- GrafreeD.theApplet3D.universe.invariants();
2195
+ Grafreed.grafreeD.universe.invariants();
17842196 } else
1785
- if (event.getSource() == memoryItem)
2197
+ if (source == memoryItem)
17862198 {
17872199 //System.out.println("Invariants:");
17882200 PrintMemory();
17892201 } else
1790
- if (event.getSource() == pathItem)
2202
+ if (source == pathItem)
17912203 {
17922204 PrintPath();
17932205 } else
1794
- if (event.getSource() == analyzeItem)
2206
+ if (source == analyzeItem)
17952207 {
17962208 AnalyzeObject();
17972209 } else
1798
- if (event.getSource() == dumpItem)
2210
+ if (source == dumpItem)
17992211 {
18002212 DumpObject();
18012213 } else
1802
- if (event.getSource() == screenfitButton)
2214
+ if (source == minButton)
18032215 {
1804
- //Reload(lastConverter, lastFilename, true);
2216
+ Minimize();
2217
+ } else
2218
+ if (source == maxButton)
2219
+ {
2220
+ Maximize();
2221
+ } else
2222
+ if (source == fullButton)
2223
+ {
2224
+ ToggleFullScreen();
2225
+ } else
2226
+ if (source == undoButton)
2227
+ {
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
2230
+ } else
2231
+ if (source == redoButton)
2232
+ {
2233
+ Redo();
2234
+ } else
2235
+ if (source == saveButton)
2236
+ {
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
2239
+ } else
2240
+ if (source == oneStepButton)
2241
+ {
2242
+ Globals.ONESTEP = true;
2243
+ cameraView.repaint();
2244
+ } else
2245
+ if (source == screenfitButton)
2246
+ {
18052247 ScreenFit();
18062248 } else
1807
- if (event.getSource() == screenfitpointButton)
2249
+ if (source == screenfitpointButton)
18082250 {
1809
- //Reload(lastConverter, lastFilename, true);
18102251 ScreenFitPoint();
18112252 } else
1812
- if (event.getSource() == snapobjectButton)
2253
+ if (source == snapobjectButton)
18132254 {
1814
- //Reload(lastConverter, lastFilename, true);
18152255 SnapObject();
18162256 } else
18172257 // if (event.getSource() == recompileButton)
....@@ -1820,13 +2260,13 @@
18202260 // Recompile();
18212261 // refreshContents();
18222262 // } else
1823
- if (event.getSource() == gcButton)
2263
+ if (source == gcButton)
18242264 {
18252265 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262266 System.gc();
18272267 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18282268 } else
1829
- if (event.getSource() == editLeafItem)
2269
+ if (source == editLeafItem)
18302270 {
18312271 Object3D obj;
18322272 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1840,62 +2280,74 @@
18402280 }
18412281 refreshContents(true);
18422282 } else
1843
- if (event.getSource() == openWindowItem)
2283
+ if (source == openWindowItem)
18442284 {
18452285 EditSelection(true);
18462286 } else
1847
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2287
+ if (source == cutItem || source == clearButton)
18482288 {
18492289 loadClipboard(true);
18502290 } else
1851
- if (event.getSource() == duplicateItem)
2291
+ if (source == undoItem)
18522292 {
1853
- Object3D keep = GrafreeD.clipboard;
2293
+ Undo();
2294
+ } else
2295
+ if (source == redoItem)
2296
+ {
2297
+ Redo();
2298
+ } else
2299
+ if (source == duplicateItem)
2300
+ {
2301
+ Object3D keep = Grafreed.clipboard;
18542302 loadClipboard(false);
18552303 paste(false);
1856
- GrafreeD.clipboard = keep;
2304
+ Grafreed.clipboard = keep;
18572305 } else
1858
- if (event.getSource() == cloneItem)
2306
+ if (source == cloneItem)
18592307 {
18602308 CloneSelection(false);
18612309 } else
1862
- if (event.getSource() == cloneSupportItem)
2310
+ if (source == cloneSupportItem)
18632311 {
18642312 CloneSelection(true);
18652313 } else
1866
- if (event.getSource() == copyItem)
2314
+ if (source == copyItem)
18672315 {
18682316 loadClipboard(false);
18692317 } else
1870
- if (event.getSource() == pasteItem)
2318
+ if (source == pasteItem)
18712319 {
18722320 paste(false);
18732321 } else
1874
- if (event.getSource() == pasteLinkItem)
2322
+ if (source == pasteIntoItem)
18752323 {
1876
- pasteInto(false);
2324
+ pasteInto(true, false);
18772325 } else
1878
- if (event.getSource() == pasteCloneItem)
2326
+ if (source == pasteLinkItem)
18792327 {
1880
- pasteInto(true);
2328
+ pasteInto(false, false);
18812329 } else
1882
- if (event.getSource() == pasteExpandItem)
2330
+ if (source == pasteCloneItem)
2331
+ {
2332
+ pasteInto(true, true);
2333
+ } else
2334
+ if (source == pasteExpandItem)
18832335 {
18842336 paste(true);
18852337 } else
1886
- if (event.getSource() == synchronizeItem)
2338
+ if (source == synchronizeItem)
18872339 {
18882340 Overwrite(Object3D.TRANSFORM);
18892341 } else
1890
- if (event.getSource() == overwriteNameItem)
2342
+ if (source == overwriteNameItem)
18912343 {
18922344 Overwrite(Object3D.NAME);
18932345 } else
1894
- if (event.getSource() == overwriteUVItem)
2346
+ if (source == overwriteUVItem)
18952347 {
18962348 Overwrite(Object3D.UV);
18972349 } else
1898
- if (event.getSource() == overwriteMatItem)
2350
+ if (source == overwriteMatItem)
18992351 {
19002352 /* july 2015
19012353 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1915,7 +2367,7 @@
19152367
19162368 Overwrite(dropAttributes);
19172369 }
1918
- if (event.getSource() == overwriteGeoItem)
2370
+ if (source == overwriteGeoItem)
19192371 {
19202372 Overwrite(Object3D.GEOMETRY);
19212373 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1932,7 +2384,7 @@
19322384 // refreshContents();
19332385 // }
19342386 } else
1935
- if (event.getSource() == generateMeshItem)
2387
+ if (source == generateMeshItem)
19362388 {
19372389 //if (group.selection.size() == 1)
19382390 // for (int i=0; i<group.selection.size(); i++)
....@@ -1943,7 +2395,7 @@
19432395 ResetModel();
19442396 refreshContents();
19452397 } else
1946
- if (event.getSource() == extractGeometriesItem)
2398
+ if (source == extractGeometriesItem)
19472399 {
19482400 boolean one = false;
19492401
....@@ -1970,7 +2422,7 @@
19702422 ResetModel();
19712423 refreshContents();
19722424 } else
1973
- if (event.getSource() == cloneGeometriesItem)
2425
+ if (source == cloneGeometriesItem)
19742426 {
19752427 boolean one = false;
19762428
....@@ -1996,32 +2448,37 @@
19962448 ResetModel();
19972449 refreshContents();
19982450 } else
1999
- if (event.getSource() == shareGeometriesItem)
2451
+ if (source == shareGeometriesItem)
20002452 {
20012453 boolean one = false;
20022454
20032455 if (group.selection.size() == 1)
20042456 one = true;
20052457
2458
+ Object3D merge = null;
2459
+
20062460 Object3D content = new cGroup();
20072461
20082462 for (int i=0; i<group.selection.size(); i++)
20092463 {
2010
- Object3D sel = new Merge(group.selection.get(i));
2464
+ merge = new Merge(group.selection.get(i));
20112465
20122466 if (one)
2013
- makeSomething(sel, false);
2467
+ makeSomething(merge, false);
20142468 else
2015
- content.addChild(sel);
2469
+ content.addChild(merge);
20162470 }
20172471
20182472 if (!one)
2019
- makeSomething(content, false);
2020
-
2021
- ResetModel();
2022
- refreshContents();
2473
+ makeSomething(content, true);
2474
+ else
2475
+ {
2476
+ ResetModel();
2477
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2478
+ refreshContents();
2479
+ }
20232480 } else
2024
- if (event.getSource() == mergeGeometriesItem)
2481
+ if (source == mergeGeometriesItem)
20252482 {
20262483 boolean one = false;
20272484
....@@ -2051,7 +2508,7 @@
20512508 ResetModel();
20522509 refreshContents();
20532510 } else
2054
- if (event.getSource() == linkverticesItem)
2511
+ if (source == linkverticesItem)
20552512 {
20562513 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20572514 // {
....@@ -2064,39 +2521,48 @@
20642521 // group.selection.get(0).setMasterThis(content); // should be identity
20652522 // refreshContents();
20662523 // }
2067
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2524
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20682525 {
2069
- Object3D content = GrafreeD.clipboard.get(0);
2526
+ Object3D content = Grafreed.clipboard.get(0);
20702527
20712528 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722529 content = ((cGroup)content).get(0);
20732530
2074
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2531
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20752532 for (int i=0; i<group.selection.size(); i++)
20762533 {
2077
- boolean random = CameraPane.RANDOM;
2078
- CameraPane.RANDOM = false; // parse all random nodes
2534
+ boolean random = CameraPane.SWITCH;
2535
+ CameraPane.SWITCH = false; // parse all random nodes
20792536 group.selection.get(i).linkVerticesThis(content);
20802537 // group.selection.get(i).setMasterThis(content); // should be identity
2081
- CameraPane.RANDOM = random;
2538
+ CameraPane.SWITCH = random;
20822539 }
2083
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2540
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20842541 refreshContents();
20852542 }
20862543 } else
2087
- if (event.getSource() == resetsupportItem)
2544
+ if (source == resetsupportItem)
20882545 {
20892546 for (int i=0; i<group.selection.size(); i++)
20902547 {
2091
- boolean random = CameraPane.RANDOM;
2092
- CameraPane.RANDOM = false; // parse all random nodes
2548
+ boolean random = CameraPane.SWITCH;
2549
+ CameraPane.SWITCH = false; // parse all random nodes
20932550 group.selection.get(i).linkVerticesThis(null);
2094
- CameraPane.RANDOM = random;
2551
+ CameraPane.SWITCH = random;
20952552 }
20962553
20972554 refreshContents();
20982555 } else
2099
- if (event.getSource() == resetreferencesItem)
2556
+ if (source == relinkverticesItem)
2557
+ {
2558
+ boolean random = CameraPane.SWITCH;
2559
+ CameraPane.SWITCH = false; // parse all random nodes
2560
+ group.selection.RelinkToSupport();
2561
+ CameraPane.SWITCH = random;
2562
+
2563
+ refreshContents();
2564
+ } else
2565
+ if (source == resetreferencesItem)
21002566 {
21012567 for (int i=0; i<group.selection.size(); i++)
21022568 {
....@@ -2105,11 +2571,11 @@
21052571
21062572 refreshContents();
21072573 } else
2108
- if (event.getSource() == setMasterItem)
2574
+ if (source == setMasterItem)
21092575 {
2110
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2576
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21112577 {
2112
- Object3D content = GrafreeD.clipboard.get(0);
2578
+ Object3D content = Grafreed.clipboard.get(0);
21132579
21142580 if (content instanceof cGroup && ((cGroup)content).transientlink )
21152581 content = ((cGroup)content).get(0);
....@@ -2118,13 +2584,13 @@
21182584 refreshContents();
21192585 }
21202586 } else
2121
- if (event.getSource() == poseMeshItem)
2587
+ if (source == poseMeshItem)
21222588 {
21232589 if (group.selection.size() == 1)
21242590 {
2125
- if (GrafreeD.clipboard.size() == 1)
2591
+ if (Grafreed.clipboard.size() == 1)
21262592 {
2127
- Object3D content = GrafreeD.clipboard.get(0);
2593
+ Object3D content = Grafreed.clipboard.get(0);
21282594
21292595 if (content instanceof cGroup && ((cGroup)content).transientlink )
21302596 content = ((cGroup)content).get(0);
....@@ -2137,19 +2603,19 @@
21372603 }
21382604
21392605 } else
2140
- if (event.getSource() == revertMeshItem)
2606
+ if (source == revertMeshItem)
21412607 {
21422608 RevertMeshes();
21432609 } else
2144
- if (event.getSource() == resetMeshItem)
2610
+ if (source == resetAllItem)
21452611 {
21462612 ResetAll();
21472613 } else
2148
- if (event.getSource() == stepAllItem)
2614
+ if (source == stepAllItem)
21492615 {
21502616 StepAll();
21512617 } else
2152
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2618
+ if (source == clearItem) // || event.getSource() == clearButton)
21532619 {
21542620 //int indices[] = jList.getSelectedIndices();
21552621 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2157,42 +2623,46 @@
21572623
21582624 ClearSelection(false);
21592625 } else
2160
- if (event.getSource() == clearAllItem)
2626
+ if (source == clearAllItem)
21612627 {
21622628 ClearSelection(true);
21632629 } else
2164
- if (event.getSource() == grabItem)
2630
+ if (source == grabItem || source == groupButton)
21652631 {
2166
- group(new cGroup(), true);
2632
+ group(new cGroup(), false); // true);
21672633 } else
2168
- if (event.getSource() == frontItem)
2634
+ if (source == hideItem)
2635
+ {
2636
+ group(new HiddenObject());
2637
+ } else
2638
+ if (source == frontItem)
21692639 {
21702640 front();
21712641 } else
2172
- if (event.getSource() == backItem)
2642
+ if (source == backItem)
21732643 {
21742644 back();
21752645 } else
2176
- if (event.getSource() == cameraItem)
2646
+ if (source == cameraItem)
21772647 {
21782648 makeSomething(new Camera());
21792649 } else
2180
- if (event.getSource() == compositeItem)
2650
+ if (source == compositeItem || source == compositeButton)
21812651 {
21822652 group(new Composite());
21832653 } else
2184
- if (event.getSource() == randomItem)
2654
+ if (source == switchItem || source == switchButton)
21852655 {
21862656 RandomNode random = new RandomNode();
21872657 group(random);
21882658 if (random.size() > 0)
2189
- random.name = random.get(0).name + "Rnd";
2659
+ random.name = random.get(0).name + "Switch";
21902660 } else
2191
- if (event.getSource() == physicsItem)
2661
+ if (source == physicsItem)
21922662 {
21932663 group(new PhysicsNode());
21942664 } else
2195
- if (event.getSource() == frameselectorItem)
2665
+ if (source == frameselectorItem)
21962666 {
21972667 for (int i=0; i<group.selection.size(); i++)
21982668 {
....@@ -2204,7 +2674,7 @@
22042674 ResetModel();
22052675 refreshContents();
22062676 } else
2207
- if (event.getSource() == switchGeoItem)
2677
+ if (source == switchGeoItem)
22082678 {
22092679 for (int i=0; i<group.selection.size(); i++)
22102680 {
....@@ -2216,7 +2686,7 @@
22162686 ResetModel();
22172687 refreshContents();
22182688 } else
2219
- if (event.getSource() == switchTransfoItem)
2689
+ if (source == switchTransfoItem)
22202690 {
22212691 for (int i=0; i<group.selection.size(); i++)
22222692 {
....@@ -2228,7 +2698,7 @@
22282698 ResetModel();
22292699 refreshContents();
22302700 } else
2231
- if (event.getSource() == morphItem)
2701
+ if (source == morphItem)
22322702 {
22332703 for (int i=0; i<group.selection.size(); i++)
22342704 {
....@@ -2240,7 +2710,7 @@
22402710 ResetModel();
22412711 refreshContents();
22422712 } else
2243
- if (event.getSource() == scriptNodeItem)
2713
+ if (source == scriptNodeItem)
22442714 {
22452715 boolean atleastone = false;
22462716
....@@ -2279,199 +2749,252 @@
22792749 }
22802750 }
22812751 } else
2282
- if (event.getSource() == linkerItem)
2752
+ if (source == linkerItem)
22832753 {
22842754 group(new cLinker());
22852755 } else
2286
- if (event.getSource() == textureItem)
2756
+ if (source == textureItem || source == textureButton)
22872757 {
22882758 group(new TextureNode());
22892759 } else
2290
- if (event.getSource() == shadowXItem)
2760
+ if (source == billboardItem)
2761
+ {
2762
+ group(new BillboardNode());
2763
+ } else
2764
+ if (source == shadowXItem)
22912765 {
22922766 CastShadow(0);
22932767 } else
2294
- if (event.getSource() == shadowYItem)
2768
+ if (source == shadowYItem)
22952769 {
22962770 CastShadow(1);
22972771 } else
2298
- if (event.getSource() == shadowZItem)
2772
+ if (source == shadowZItem)
22992773 {
23002774 CastShadow(2);
23012775 } else
2302
- if (event.getSource() == ungroupItem)
2776
+ if (source == ungroupItem || source == ungroupButton)
23032777 {
2304
- ungroup();
2778
+ boolean hasRoot = false;
2779
+
2780
+ for (int i=0; i<group.selection.size(); i++)
2781
+ {
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
2787
+ }
2788
+
2789
+ if (!hasRoot)
2790
+ {
2791
+ for (int i=0; i<group.selection.size(); i++)
2792
+ {
2793
+ Ungroup(group.selection.get(i));
2794
+ }
2795
+
2796
+ ClearSelection(false);
2797
+
2798
+ refreshContents();
2799
+ }
23052800 } else
2306
- if (event.getSource() == genUVItem)
2801
+ if (source == genUVItem)
23072802 {
23082803 GenUV();
23092804 } else
2310
- if (event.getSource() == genNormalsCADItem)
2805
+ if (source == genNormalsCADItem)
23112806 {
23122807 GenNormals(true);
23132808 } else
2314
- if (event.getSource() == genNormalsMESHItem)
2809
+ if (source == genNormalsMESHItem)
23152810 {
2316
- GenNormals(true); // TODO
2811
+ GenNormalsMESH();
23172812 } else
2318
- if (event.getSource() == genNormalsORGANItem)
2813
+ if (source == genNormalsORGANItem)
23192814 {
23202815 GenNormals(false);
23212816 } else
2322
- if (event.getSource() == stripifyItem)
2817
+ if (source == genNormalsMINEItem)
2818
+ {
2819
+ GenNormalsMINE();
2820
+ } else
2821
+ if (source == stripifyItem)
23232822 {
23242823 Stripify();
23252824 } else
2326
- if (event.getSource() == unstripifyItem)
2825
+ if (source == unstripifyItem)
23272826 {
23282827 Unstripify();
23292828 } else
2330
- if (event.getSource() == trimItem)
2829
+ if (source == trimItem)
23312830 {
23322831 Trim();
23332832 } else
2334
- if (event.getSource() == untrimItem)
2833
+ if (source == untrimItem)
23352834 {
23362835 Untrim();
23372836 } else
2338
- if (event.getSource() == clearColorsItem)
2837
+ if (source == clearColorsItem)
23392838 {
23402839 ClearColors();
23412840 } else
2342
- if (event.getSource() == clearMaterialsItem)
2841
+ if (source == clearMaterialsItem)
23432842 {
23442843 ClearMaterials();
23452844 } else
2346
- if (event.getSource() == liveleavesItem)
2845
+ if (source == liveleavesItem)
23472846 {
23482847 LiveLeaves(true);
23492848 } else
2350
- if (event.getSource() == unliveleavesItem)
2849
+ if (source == unliveleavesItem)
23512850 {
23522851 LiveLeaves(false);
23532852 } else
2354
- if (event.getSource() == supportleavesItem)
2853
+ if (source == supportleavesItem)
23552854 {
23562855 SupportLeaves(true);
23572856 } else
2358
- if (event.getSource() == unsupportleavesItem)
2857
+ if (source == unsupportleavesItem)
23592858 {
23602859 SupportLeaves(false);
23612860 } else
2362
- if (event.getSource() == hideleavesItem)
2861
+ if (source == hideleavesItem)
23632862 {
23642863 HideLeaves(true);
23652864 } else
2366
- if (event.getSource() == showleavesItem)
2865
+ if (source == showleavesItem)
23672866 {
23682867 HideLeaves(false);
23692868 } else
2370
- if (event.getSource() == markleavesItem)
2869
+ if (source == markleavesItem)
23712870 {
23722871 MarkLeaves(true);
23732872 } else
2374
- if (event.getSource() == unmarkleavesItem)
2873
+ if (source == unmarkleavesItem)
23752874 {
23762875 MarkLeaves(false);
23772876 } else
2378
- if (event.getSource() == flipVItem)
2877
+ if (source == rewindleavesItem)
2878
+ {
2879
+ RewindLeaves(true);
2880
+ } else
2881
+ if (source == unrewindleavesItem)
2882
+ {
2883
+ RewindLeaves(false);
2884
+ } else
2885
+ if (source == randomleavesItem)
2886
+ {
2887
+ RandomLeaves(true);
2888
+ } else
2889
+ if (source == unrandomleavesItem)
2890
+ {
2891
+ RandomLeaves(false);
2892
+ } else
2893
+ if (source == flipVItem)
23792894 {
23802895 FlipV(true);
23812896 } else
2382
- if (event.getSource() == unflipVItem)
2897
+ if (source == unflipVItem)
23832898 {
23842899 FlipV(false);
23852900 } else
2386
- if (event.getSource() == lowTexturesItem)
2901
+ if (source == lowTexturesItem)
23872902 {
23882903 SetTexRes(0);
23892904 } else
2390
- if (event.getSource() == normalTexturesItem)
2905
+ if (source == normalTexturesItem)
23912906 {
23922907 SetTexRes(1);
23932908 } else
2394
- if (event.getSource() == highTexturesItem)
2909
+ if (source == highTexturesItem)
23952910 {
23962911 SetTexRes(2);
23972912 } else
2398
- if (event.getSource() == veryhighTexturesItem)
2913
+ if (source == veryhighTexturesItem)
23992914 {
24002915 SetTexRes(3);
24012916 } else
2402
- if (event.getSource() == maxTexturesItem)
2917
+ if (source == maxTexturesItem)
24032918 {
24042919 SetTexRes(4);
24052920 } else
2406
- if (event.getSource() == panoTexturesItem)
2921
+ if (source == panoTexturesItem)
24072922 {
24082923 SetTexRes(5);
24092924 } else
2410
- if (event.getSource() == reverseNormalsItem)
2925
+ if (source == reverseNormalsItem)
24112926 {
24122927 ReverseNormals();
24132928 } else
2414
- if (event.getSource() == parseverticesItem)
2929
+ if (source == parseverticesItem)
24152930 {
24162931 ParseVertices();
24172932 } else
2418
- if (event.getSource() == textureFieldItem)
2933
+ if (source == textureFieldItem)
24192934 {
24202935 TextureVertices();
24212936 } else
2422
- if (event.getSource() == alignItem)
2937
+ if (source == alignItem)
24232938 {
24242939 Align();
24252940 } else
2426
- if (event.getSource() == mirrorItem)
2941
+ if (source == mirrorItem)
24272942 {
24282943 MirrorPoses();
24292944 } else
2430
- if (event.getSource() == reduceMorphItem)
2945
+ if (source == reduceMorphItem)
24312946 {
24322947 MeshReduction(false);
24332948 } else
2434
- if (event.getSource() == reduce34MorphItem)
2949
+ if (source == reduce34MorphItem)
24352950 {
24362951 MeshReduction(true);
24372952 } else
2438
- if (event.getSource() == reverseTrianglesItem)
2953
+ if (source == reverseTrianglesItem)
24392954 {
24402955 ReverseTriangles();
24412956 } else
2442
- if (event.getSource() == reduceMeshItem)
2957
+ if (source == reduceMeshItem)
24432958 {
24442959 ReduceMesh(false);
24452960 } else
2446
- if (event.getSource() == reduce34MeshItem)
2961
+ if (source == reduce34MeshItem)
24472962 {
24482963 ReduceMesh(true);
24492964 } else
2450
- if (event.getSource() == increaseMeshItem)
2965
+ if (source == increaseMeshItem)
24512966 {
24522967 IncreaseMesh();
24532968 } else
2454
- if (event.getSource() == clipMeshItem)
2969
+ if (source == clipMeshItem)
24552970 {
24562971 ClipMesh();
24572972 } else
2458
- if (event.getSource() == smoothMeshItem)
2973
+ if (source == smoothMeshItem)
24592974 {
24602975 SmoothMesh();
24612976 } else
2462
- if (event.getSource() == transformgeometryItem)
2977
+ if (source == transformGeometryItem)
24632978 {
24642979 TransformGeometry();
24652980 } else
2466
- if (event.getSource() == resetTransformItem)
2981
+ if (source == transformChildrenItem)
2982
+ {
2983
+ TransformChildren();
2984
+ } else
2985
+ if (source == resetTransformItem)
24672986 {
24682987 ResetTransform();
24692988 } else
2470
- if (event.getSource() == resetCentroidItem)
2989
+ if (source == resetCentroidItem)
24712990 {
2472
- ResetCentroid();
2991
+ ResetCentroid(true);
24732992 } else
2474
- if (event.getSource() == resetParentItem)
2993
+ if (source == resetCentroidXZItem)
2994
+ {
2995
+ ResetCentroid(false);
2996
+ } else
2997
+ if (source == resetParentItem)
24752998 {
24762999 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24773000 {
....@@ -2481,7 +3004,7 @@
24813004
24823005 refreshContents();
24833006 } else
2484
- if (event.getSource() == repairParentItem)
3007
+ if (source == repairParentItem)
24853008 {
24863009 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24873010 {
....@@ -2495,7 +3018,21 @@
24953018
24963019 refreshContents();
24973020 } else
2498
- if (event.getSource() == sortbysizeItem)
3021
+ if (source == repairShadowItem)
3022
+ {
3023
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3024
+ {
3025
+ Object3D obj = (Object3D)e.nextElement();
3026
+ obj.RepairShadow();
3027
+// for (int i=0; i<obj.size(); i++)
3028
+// {
3029
+// obj.get(i).parent = obj;
3030
+// }
3031
+ }
3032
+
3033
+ refreshContents();
3034
+ } else
3035
+ if (source == sortbysizeItem)
24993036 {
25003037 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25013038 {
....@@ -2507,7 +3044,7 @@
25073044 ResetModel();
25083045 refreshContents();
25093046 } else
2510
- if (event.getSource() == sortbynameItem)
3047
+ if (source == sortbynameItem)
25113048 {
25123049 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25133050 {
....@@ -2519,7 +3056,7 @@
25193056 ResetModel();
25203057 refreshContents();
25213058 } else
2522
- if (event.getSource() == attachPigmentItem)
3059
+ if (source == attachPigmentItem)
25233060 {
25243061 String texture = GetFile("Attach pigment");
25253062 Object3D obj;
....@@ -2531,7 +3068,7 @@
25313068
25323069 refreshContents();
25333070 } else
2534
- if (event.getSource() == detachPigmentItem)
3071
+ if (source == detachPigmentItem)
25353072 {
25363073 Object3D obj;
25373074 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2542,7 +3079,7 @@
25423079
25433080 refreshContents();
25443081 } else
2545
- if (event.getSource() == attachBumpItem)
3082
+ if (source == attachBumpItem)
25463083 {
25473084 String texture = GetFile("Attach bump");
25483085 Object3D obj;
....@@ -2554,7 +3091,7 @@
25543091
25553092 refreshContents();
25563093 } else
2557
- if (event.getSource() == detachBumpItem)
3094
+ if (source == detachBumpItem)
25583095 {
25593096 Object3D obj;
25603097 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2565,7 +3102,7 @@
25653102
25663103 refreshContents();
25673104 } else
2568
- if (event.getSource() == pigmentBumpItem)
3105
+ if (source == pigmentBumpItem)
25693106 {
25703107 Object3D obj;
25713108 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2576,158 +3113,237 @@
25763113
25773114 refreshContents();
25783115 } else
2579
- if (event.getSource() == flashSelectionButton)
3116
+ if (source == flashSelectionButton)
25803117 {
25813118 CameraPane.flash = true;
25823119 refreshContents();
25833120 } else
2584
- if (event.getSource() == oneButton)
3121
+ if (source == oneButton)
25853122 {
25863123 } else
2587
- if (event.getSource() == twoButton)
3124
+ if (source == twoButton)
25883125 {
25893126 radio.layout = twoButton;
3127
+
3128
+ if (CameraPane.FULLSCREEN)
3129
+ fullscreenLayout = radio.layout;
3130
+
25903131 // bug
25913132 //gridPanel.setDividerLocation(1.0);
25923133 //bigPanel.setDividerLocation(0.0);
2593
- bigThree.remove(jtp);
2594
- bigThree.remove(cameraPanel);
2595
- bigThree.remove(XYZPanel);
2596
- aWindowConstraints.gridx = 0;
2597
- aWindowConstraints.gridy = 0;
2598
- aWindowConstraints.gridwidth = 1;
2599
- // aConstraints.gridheight = 3;
2600
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2601
- aWindowConstraints.weightx = 0;
2602
- aWindowConstraints.weighty = 1;
2603
- //bigThree.add(jtp, aWindowConstraints);
2604
- aWindowConstraints.weightx = 1;
2605
- aWindowConstraints.gridwidth = 3;
2606
- // aConstraints.gridheight = 3;
2607
- aWindowConstraints.gridx = 1;
2608
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2609
- bigThree.add(cameraPanel, aWindowConstraints);
2610
- aWindowConstraints.weightx = 0;
2611
- aWindowConstraints.gridx = 4;
2612
- aWindowConstraints.gridwidth = 1;
2613
- // aConstraints.gridheight = 3;
2614
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2615
- //bigThree.add(XYZPanel, aWindowConstraints);
2616
- bigThree.revalidate();
3134
+// bigThree.remove(scenePanel);
3135
+// bigThree.remove(centralPanel);
3136
+// bigThree.remove(XYZPanel);
3137
+// aWindowConstraints.gridx = 0;
3138
+// aWindowConstraints.gridy = 0;
3139
+// aWindowConstraints.gridwidth = 1;
3140
+// // aConstraints.gridheight = 3;
3141
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3142
+// aWindowConstraints.weightx = 0;
3143
+// aWindowConstraints.weighty = 1;
3144
+// //bigThree.add(jtp, aWindowConstraints);
3145
+// aWindowConstraints.weightx = 1;
3146
+// aWindowConstraints.gridwidth = 3;
3147
+// // aConstraints.gridheight = 3;
3148
+// aWindowConstraints.gridx = 1;
3149
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3150
+// bigThree.add(centralPanel, aWindowConstraints);
3151
+// aWindowConstraints.weightx = 0;
3152
+// aWindowConstraints.gridx = 4;
3153
+// aWindowConstraints.gridwidth = 1;
3154
+// // aConstraints.gridheight = 3;
3155
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3156
+// //bigThree.add(XYZPanel, aWindowConstraints);
3157
+// scenePanel.setVisible(false);
3158
+// centralPanel.setVisible(true);
3159
+// XYZPanel.setVisible(false);
3160
+ bigThree.ClearUI();
3161
+ bigThree.add(centralPanel);
3162
+ bigThree.FlushUI();
3163
+
3164
+ cameraView.requestFocusInWindow();
3165
+
3166
+// refreshContents(true);
3167
+//
3168
+// try
3169
+// {
3170
+// java.awt.Robot bot = new java.awt.Robot();
3171
+// int mask = InputEvent.BUTTON1_MASK;
3172
+// bot.mouseMove(100, 100);
3173
+// bot.mousePress(mask);
3174
+// bot.mouseRelease(mask);
3175
+// }
3176
+// catch (Exception e)
3177
+// {
3178
+//
3179
+// }
3180
+
26173181 } else
2618
- if (event.getSource() == threeButton)
3182
+ if (source == threeButton)
26193183 {
26203184 radio.layout = threeButton;
2621
- bigThree.remove(jtp);
2622
- bigThree.remove(cameraPanel);
2623
- bigThree.remove(XYZPanel);
2624
- aWindowConstraints.gridx = 0;
2625
- aWindowConstraints.gridy = 0;
2626
- aWindowConstraints.gridwidth = 1;
2627
- // aConstraints.gridheight = 3;
2628
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2629
- aWindowConstraints.weightx = 0;
2630
- aWindowConstraints.weighty = 1;
2631
- //bigThree.add(jtp, aWindowConstraints);
2632
- aWindowConstraints.weightx = 1;
2633
- aWindowConstraints.gridwidth = 3;
2634
- // aConstraints.gridheight = 3;
2635
- aWindowConstraints.gridx = 1;
2636
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2637
- bigThree.add(cameraPanel, aWindowConstraints);
2638
- aWindowConstraints.weightx = 0;
2639
- aWindowConstraints.gridx = 4;
2640
- aWindowConstraints.gridwidth = 1;
2641
- // aConstraints.gridheight = 3;
2642
- aConstraints.fill = GridBagConstraints.VERTICAL;
2643
- bigThree.add(XYZPanel, aWindowConstraints);
2644
- bigThree.revalidate();
3185
+
3186
+ if (CameraPane.FULLSCREEN)
3187
+ fullscreenLayout = radio.layout;
3188
+
3189
+// bigThree.remove(scenePanel);
3190
+// bigThree.remove(centralPanel);
3191
+// bigThree.remove(XYZPanel);
3192
+// aWindowConstraints.gridx = 0;
3193
+// aWindowConstraints.gridy = 0;
3194
+// aWindowConstraints.gridwidth = 1;
3195
+// // aConstraints.gridheight = 3;
3196
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3197
+// aWindowConstraints.weightx = 0;
3198
+// aWindowConstraints.weighty = 1;
3199
+// //bigThree.add(jtp, aWindowConstraints);
3200
+// aWindowConstraints.weightx = 1;
3201
+// aWindowConstraints.gridwidth = 3;
3202
+// // aConstraints.gridheight = 3;
3203
+// aWindowConstraints.gridx = 1;
3204
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3205
+// bigThree.add(centralPanel, aWindowConstraints);
3206
+// aWindowConstraints.weightx = 0;
3207
+// aWindowConstraints.gridx = 4;
3208
+// aWindowConstraints.gridwidth = 1;
3209
+// // aConstraints.gridheight = 3;
3210
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3211
+// bigThree.add(XYZPanel, aWindowConstraints);
3212
+// bigThree.validate();
3213
+// scenePanel.setVisible(false);
3214
+// centralPanel.setVisible(true);
3215
+// XYZPanel.setVisible(true);
3216
+ bigThree.ClearUI();
3217
+ bigThree.add(centralPanel);
3218
+ bigThree.add(XYZPanel);
3219
+ bigThree.FlushUI();
3220
+
3221
+ cameraView.requestFocusInWindow();
26453222 } else
2646
- if (event.getSource() == fourButton)
3223
+ if (source == fourButton)
26473224 {
26483225 radio.layout = fourButton;
2649
- bigThree.remove(jtp);
2650
- bigThree.remove(cameraPanel);
2651
- bigThree.remove(XYZPanel);
2652
- aWindowConstraints.gridx = 0;
2653
- aWindowConstraints.gridy = 0;
2654
- aWindowConstraints.gridwidth = 1;
2655
- // aWindowConstraints.gridheight = 3;
2656
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2657
- aWindowConstraints.weightx = 1;
2658
- aWindowConstraints.weighty = 1;
2659
- bigThree.add(jtp, aWindowConstraints);
2660
- aWindowConstraints.weightx = 1;
2661
- aWindowConstraints.gridwidth = 3;
2662
- // aConstraints.gridheight = 3;
2663
- aWindowConstraints.gridx = 1;
2664
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2665
- //bigThree.add(cameraPanel, aWindowConstraints);
2666
- aWindowConstraints.weightx = 0;
2667
- aWindowConstraints.gridx = 4;
2668
- aWindowConstraints.gridwidth = 1;
2669
- // aWindowConstraints.gridheight = 3;
2670
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2671
- //bigThree.add(XYZPanel, aWindowConstraints);
2672
- bigThree.revalidate();
3226
+
3227
+ if (CameraPane.FULLSCREEN)
3228
+ fullscreenLayout = radio.layout;
3229
+
3230
+// bigThree.remove(scenePanel);
3231
+// bigThree.remove(centralPanel);
3232
+// bigThree.remove(XYZPanel);
3233
+// aWindowConstraints.gridx = 0;
3234
+// aWindowConstraints.gridy = 0;
3235
+// aWindowConstraints.gridwidth = 1;
3236
+// // aWindowConstraints.gridheight = 3;
3237
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3238
+// aWindowConstraints.weightx = 1;
3239
+// aWindowConstraints.weighty = 1;
3240
+// bigThree.add(scenePanel, aWindowConstraints);
3241
+// aWindowConstraints.weightx = 1;
3242
+// aWindowConstraints.gridwidth = 3;
3243
+// // aConstraints.gridheight = 3;
3244
+// aWindowConstraints.gridx = 1;
3245
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3246
+// //bigThree.add(cameraPanel, aWindowConstraints);
3247
+// aWindowConstraints.weightx = 0;
3248
+// aWindowConstraints.gridx = 4;
3249
+// aWindowConstraints.gridwidth = 1;
3250
+// // aWindowConstraints.gridheight = 3;
3251
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3252
+// //bigThree.add(XYZPanel, aWindowConstraints);
3253
+// bigThree.validate();
3254
+// scenePanel.setVisible(true);
3255
+// centralPanel.setVisible(false);
3256
+// XYZPanel.setVisible(false);
3257
+ bigThree.ClearUI();
3258
+ bigThree.add(scenePanel);
3259
+ bigThree.FlushUI();
3260
+
3261
+ cameraView.requestFocusInWindow();
26733262 } else
2674
- if (event.getSource() == sixButton)
3263
+ if (source == sixButton)
26753264 {
26763265 radio.layout = sixButton;
2677
- bigThree.remove(jtp);
2678
- bigThree.remove(cameraPanel);
2679
- bigThree.remove(XYZPanel);
2680
- aWindowConstraints.gridx = 0;
2681
- aWindowConstraints.gridy = 0;
2682
- aWindowConstraints.gridwidth = 1;
2683
- // aConstraints.gridheight = 3;
2684
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2685
- aWindowConstraints.weightx = 0;
2686
- aWindowConstraints.weighty = 1;
2687
- bigThree.add(jtp, aWindowConstraints);
2688
- aWindowConstraints.weightx = 1;
2689
- aWindowConstraints.gridwidth = 3;
2690
- // aWindowConstraints.gridheight = 3;
2691
- aWindowConstraints.gridx = 1;
2692
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2693
- bigThree.add(cameraPanel, aWindowConstraints);
2694
- aWindowConstraints.weightx = 0;
2695
- aWindowConstraints.gridx = 4;
2696
- aWindowConstraints.gridwidth = 1;
2697
- // aWindowConstraints.gridheight = 3;
2698
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2699
- //bigThree.add(XYZPanel, aConstraints);
2700
- bigThree.revalidate();
3266
+
3267
+ if (CameraPane.FULLSCREEN)
3268
+ fullscreenLayout = radio.layout;
3269
+
3270
+// bigThree.remove(scenePanel);
3271
+// bigThree.remove(centralPanel);
3272
+// bigThree.remove(XYZPanel);
3273
+// aWindowConstraints.gridx = 0;
3274
+// aWindowConstraints.gridy = 0;
3275
+// aWindowConstraints.gridwidth = 1;
3276
+// // aConstraints.gridheight = 3;
3277
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3278
+// aWindowConstraints.weightx = 0;
3279
+// aWindowConstraints.weighty = 1;
3280
+// bigThree.add(scenePanel, aWindowConstraints);
3281
+// aWindowConstraints.weightx = 1;
3282
+// aWindowConstraints.gridwidth = 3;
3283
+// // aWindowConstraints.gridheight = 3;
3284
+// aWindowConstraints.gridx = 1;
3285
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3286
+// bigThree.add(centralPanel, aWindowConstraints);
3287
+// aWindowConstraints.weightx = 0;
3288
+// aWindowConstraints.gridx = 4;
3289
+// aWindowConstraints.gridwidth = 1;
3290
+// // aWindowConstraints.gridheight = 3;
3291
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3292
+// //bigThree.add(XYZPanel, aConstraints);
3293
+// bigThree.validate();
3294
+// scenePanel.setVisible(true);
3295
+// centralPanel.setVisible(true);
3296
+// XYZPanel.setVisible(false);
3297
+ bigThree.ClearUI();
3298
+ bigThree.add(scenePanel);
3299
+ bigThree.add(centralPanel);
3300
+ bigThree.FlushUI();
3301
+
3302
+ cameraView.requestFocusInWindow();
27013303 } else
2702
- if (event.getSource() == sevenButton)
3304
+ if (source == sevenButton)
27033305 {
27043306 radio.layout = sevenButton;
2705
- bigThree.remove(jtp);
2706
- bigThree.remove(cameraPanel);
2707
- bigThree.remove(XYZPanel);
2708
- aWindowConstraints.gridx = 0;
2709
- aWindowConstraints.gridy = 0;
2710
- aWindowConstraints.gridwidth = 1;
2711
- // aWindowConstraints.gridheight = 3;
2712
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2713
- aWindowConstraints.weightx = 0;
2714
- aWindowConstraints.weighty = 1;
2715
- bigThree.add(jtp, aWindowConstraints);
2716
- aWindowConstraints.weightx = 1;
2717
- aWindowConstraints.gridwidth = 3;
2718
- // aWindowConstraints.gridheight = 3;
2719
- aWindowConstraints.gridx = 1;
2720
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2721
- bigThree.add(cameraPanel, aWindowConstraints);
2722
- aWindowConstraints.weightx = 0;
2723
- aWindowConstraints.gridx = 4;
2724
- aWindowConstraints.gridwidth = 1;
2725
- // aConstraints.gridheight = 3;
2726
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2727
- bigThree.add(XYZPanel, aWindowConstraints);
2728
- bigThree.revalidate();
3307
+
3308
+ if (CameraPane.FULLSCREEN)
3309
+ fullscreenLayout = radio.layout;
3310
+
3311
+// bigThree.remove(scenePanel);
3312
+// bigThree.remove(centralPanel);
3313
+// bigThree.remove(XYZPanel);
3314
+// aWindowConstraints.gridx = 0;
3315
+// aWindowConstraints.gridy = 0;
3316
+// aWindowConstraints.gridwidth = 1;
3317
+// // aWindowConstraints.gridheight = 3;
3318
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3319
+// aWindowConstraints.weightx = 0;
3320
+// aWindowConstraints.weighty = 1;
3321
+// bigThree.add(scenePanel, aWindowConstraints);
3322
+// aWindowConstraints.weightx = 1;
3323
+// aWindowConstraints.gridwidth = 3;
3324
+// // aWindowConstraints.gridheight = 3;
3325
+// aWindowConstraints.gridx = 1;
3326
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3327
+// bigThree.add(centralPanel, aWindowConstraints);
3328
+// aWindowConstraints.weightx = 0;
3329
+// aWindowConstraints.gridx = 4;
3330
+// aWindowConstraints.gridwidth = 1;
3331
+// // aConstraints.gridheight = 3;
3332
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3333
+// bigThree.add(XYZPanel, aWindowConstraints);
3334
+// bigThree.validate();
3335
+// scenePanel.setVisible(true);
3336
+// centralPanel.setVisible(true);
3337
+// XYZPanel.setVisible(true);
3338
+ bigThree.ClearUI();
3339
+ bigThree.add(scenePanel);
3340
+ bigThree.add(centralPanel);
3341
+ bigThree.add(XYZPanel);
3342
+ bigThree.FlushUI();
3343
+
3344
+ cameraView.requestFocusInWindow();
27293345 } else
2730
- if (event.getSource() == rootButton)
3346
+ if (source == rootButton)
27313347 {
27323348 Object3D obj;
27333349 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2737,66 +3353,84 @@
27373353 EditObject(obj);
27383354 }
27393355
3356
+ cameraView.requestFocusInWindow();
27403357 refreshContents(true);
27413358 } else
2742
- if (event.getSource() == closeButton)
3359
+ if (source == closeButton)
27433360 {
27443361 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27453362 cRadio ab;
27463363 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27473364 {
27483365 ab = (cRadio)e.nextElement();
2749
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3366
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27503367 {
3368
+ // Patch to avoid bug with transparency.
3369
+ if (!ab.hadMaterial)
3370
+ {
3371
+ ab.object.material = null;
3372
+ }
3373
+
27513374 buttonGroup.remove(ab);
27523375 radioPanel.remove(ab);
27533376
2754
- ab.GetObject().editWindow = null;
3377
+ //ab.GetObject().editWindow = null;
3378
+ ab.GetObject().manipWindow = null;
27553379 // ab.GetObject().objectUI = null; // ?????????
27563380
27573381 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
27583382 break;
27593383 }
27603384 }
3385
+
3386
+ cameraView.requestFocusInWindow();
27613387 refreshContents(true);
27623388 } else
2763
- if (event.getSource() == editItem || event.getSource() == editButton)
3389
+ if (source == editItem || source == editButton)
27643390 {
3391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3392
+ {
3393
+ Object3D child = (Object3D)e.nextElement();
3394
+ child.pinned = true;
3395
+ }
3396
+
27653397 EditSelection(false);
27663398 } else
2767
- if (event.getSource() == uneditButton)
3399
+ if (source == uneditButton)
27683400 {
27693401 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27703402 {
27713403 Object3D child = (Object3D)e.nextElement();
27723404 if(child.editWindow != null)
27733405 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3406
+ child.pinned = false;
27743407 child.CloseUI();
27753408 listUI.remove(child);
27763409
2777
- child.editWindow = null; // ???????????
3410
+ //child.editWindow = null; // ???????????
27783411 }
2779
- objEditor.ctrlPanel.revalidate();
3412
+ objEditor.ctrlPanel.FlushUI();
27803413 //objEditor.jTree.clearSelection();
27813414 //objEditor.ResetSliders();
27823415 refreshContents(true);
27833416 } else
2784
- if (event.getSource() == clearPanelButton)
3417
+ if (source == clearPanelButton)
27853418 {
27863419 assert(copy == group);
27873420 //copy.ClearUI();
27883421 for (Object3D obj : listUI)
27893422 {
3423
+ obj.pinned = false;
27903424 obj.CloseUI();
27913425 }
27923426 listUI.clear();
27933427 refreshContents(true);
27943428 } else
2795
- if (event.getSource() == allParamsButton)
3429
+ if (source == allParamsButton)
27963430 {
27973431 assert(copy == group);
27983432
2799
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3433
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28003434
28013435 for (Object3D obj : listUI)
28023436 {
....@@ -2813,19 +3447,19 @@
28133447
28143448 refreshContents(true);
28153449 } else
2816
- if (event.getSource() == unselectButton)
3450
+ if (source == unselectButton)
28173451 {
28183452 objEditor.jTree.clearSelection();
28193453 // ?? oct 2012 GrafreeD.clipboard.clear();
28203454 objEditor.ResetSliders();
28213455 refreshContents(true);
28223456 } else
2823
- if(event.getSource() instanceof cRadio)
3457
+ if(source instanceof cRadio)
28243458 {
28253459 group.parent = keepparent;
28263460 group.attributes = 0;
28273461 //group.editWindow = null;
2828
- /*cRadio*/ radio = (cRadio)event.getSource();
3462
+ /*cRadio*/ radio = (cRadio)source;
28293463 Object3D obj = radio.GetObject();
28303464 System.out.println("Edit " + obj);
28313465 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2845,7 +3479,7 @@
28453479 }
28463480
28473481 copy = group;
2848
- //CameraPane.theRenderer.object = group;
3482
+ //Globals.theRenderer.object = group;
28493483 if(!useclient)
28503484 {
28513485 cameraView.renderCamera = radio.camera;
....@@ -2854,25 +3488,50 @@
28543488 cameraView.cameras[cameraView.cameracount] = radio.camera;
28553489 cameraView.targetLookAt.set(radio.camera.lookAt);
28563490 cameraView.object = group;
2857
- cameraView.lighttouched = true;
3491
+ //cameraView.lighttouched = true;
3492
+ Globals.lighttouched = true;
28583493 topView.object = group;
28593494 frontView.object = group;
28603495 sideView.object = group;
28613496 }
2862
- group.editWindow = this;
3497
+
3498
+// fix "+" issue
3499
+ //group.editWindow = this;
3500
+ group.manipWindow = this;
3501
+
28633502 /*
28643503 currentLayout = radio.layout;
28653504 if (currentLayout == null)
28663505 currentLayout = sevenButton;
28673506 */
28683507 radio.layout.doClick();
3508
+
3509
+ ClearUnpinned();
3510
+ SetPinStates(group.selection.size() > 0);
3511
+ if (group.selection.size() == 1)
3512
+ EditSelection(false);
28693513 keepparent = group.parent;
28703514 // PARENT = NULL or not???
28713515 //group.parent = null; // ROOT
28723516 //group.attributes = -1;
28733517 ResetModel();
3518
+
3519
+ cameraView.requestFocusInWindow();
28743520 refreshContents(true);
2875
- }
3521
+ } else if (event.getSource() == editCameraItem)
3522
+ {
3523
+ cameraView.ProtectCamera();
3524
+ cameraView.repaint();
3525
+ return;
3526
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3527
+ {
3528
+ cameraView.RevertCamera();
3529
+ cameraView.repaint();
3530
+ return;
3531
+ // } else if (event.getSource() == textureButton)
3532
+ // {
3533
+ // return; // true;
3534
+ }
28763535 else
28773536 {
28783537 //return super.action(event, arg);
....@@ -2881,7 +3540,6 @@
28813540 }
28823541
28833542 boolean useclient = false;
2884
- cRadio radio;
28853543
28863544 void ToggleRoot()
28873545 {
....@@ -2890,7 +3548,7 @@
28903548 if (useclient)
28913549 {
28923550 cameraView.object = client;
2893
- cameraView.lighttouched = true;
3551
+ Globals.lighttouched = true;
28943552 //topView.object = client;
28953553 //frontView.object = client;
28963554 //sideView.object = client;
....@@ -2898,7 +3556,7 @@
28983556 else
28993557 {
29003558 cameraView.object = group;
2901
- cameraView.lighttouched = true;
3559
+ Globals.lighttouched = true;
29023560 //topView.object = group;
29033561 //frontView.object = group;
29043562 //sideView.object = group;
....@@ -2933,6 +3591,28 @@
29333591 refreshContents();
29343592 }
29353593
3594
+ void TransformChildren()
3595
+ {
3596
+ Object3D obj;
3597
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3598
+ {
3599
+ obj = (Object3D)e.nextElement();
3600
+ obj.KeepTextureMatrices();
3601
+ obj.TransformChildren();
3602
+ obj.RestoreTextureMatrices();
3603
+
3604
+// if (obj.parent == null)
3605
+// {
3606
+// System.out.println("NULL PARENT!");
3607
+// new Exception().printStackTrace();
3608
+// }
3609
+// else
3610
+// TouchTransform(obj);
3611
+// //obj.parent.Touch();
3612
+ }
3613
+
3614
+ refreshContents();
3615
+ }
29363616
29373617 void ResetTransform()
29383618 {
....@@ -3045,7 +3725,7 @@
30453725 refreshContents();
30463726 }
30473727
3048
- void ResetCentroid()
3728
+ void ResetCentroid(boolean full)
30493729 {
30503730 Object3D obj;
30513731 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3060,12 +3740,16 @@
30603740 LA.matIdentity(Object3D.mat);
30613741 obj.getBounds(minima, maxima, false);
30623742 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3063
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3743
+ if (full)
3744
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30643745 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30653746 obj.TransformMesh(Object3D.mat);
3747
+
30663748 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3067
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3749
+ if (full)
3750
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30683751 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3752
+
30693753 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30703754 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30713755 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3094,7 +3778,8 @@
30943778
30953779 int size = obj.MemorySize();
30963780
3097
- System.err.println((size/1024) + " KB is the size of " + obj);
3781
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3782
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30983783 }
30993784 }
31003785 catch (Exception e)
....@@ -3131,9 +3816,9 @@
31313816 obj = (Object3D)e.nextElement();
31323817
31333818 System.out.println("Object is: " + obj);
3134
- GrafreeD.AnalyzeObject(obj);
3819
+ Grafreed.AnalyzeObject(obj);
31353820 System.out.println("Boundary rep: " + obj.bRep);
3136
- GrafreeD.AnalyzeObject(obj.bRep);
3821
+ Grafreed.AnalyzeObject(obj.bRep);
31373822
31383823 // System.err.println((size/1024) + " KB is the size of " + obj);
31393824 }
....@@ -3175,6 +3860,20 @@
31753860 void GenNormals(boolean crease)
31763861 {
31773862 group.GenNormalsS(crease);
3863
+
3864
+ refreshContents();
3865
+ }
3866
+
3867
+ void GenNormalsMESH()
3868
+ {
3869
+ group.GenNormalsMeshS();
3870
+
3871
+ refreshContents();
3872
+ }
3873
+
3874
+ void GenNormalsMINE()
3875
+ {
3876
+ group.selection.GenNormalsMINE();
31783877
31793878 refreshContents();
31803879 }
....@@ -3340,8 +4039,8 @@
33404039
33414040 void ParseVertices()
33424041 {
3343
- boolean epsequal = GrafreeD.epsequal;
3344
- GrafreeD.epsequal = true;
4042
+ boolean epsequal = Grafreed.epsequal;
4043
+ Grafreed.epsequal = true;
33454044
33464045 for (int i=0; i<group.selection.size(); i++)
33474046 {
....@@ -3366,7 +4065,7 @@
33664065 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33674066 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33684067
3369
- g.add(GrafreeD.clipboard);
4068
+ g.add(Grafreed.clipboard);
33704069
33714070 buffer.add(g);
33724071 }
....@@ -3381,7 +4080,7 @@
33814080 makeSomething(buffer, i==group.selection.size()-1);
33824081 }
33834082
3384
- GrafreeD.epsequal = epsequal;
4083
+ Grafreed.epsequal = epsequal;
33854084
33864085 refreshContents();
33874086 }
....@@ -3399,7 +4098,16 @@
33994098 String pigment = Object3D.GetPigment(tex);
34004099 //String bump = Object3D.GetBump(tex);
34014100
3402
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4101
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4102
+
4103
+ try
4104
+ {
4105
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4106
+ }
4107
+ catch (Exception e)
4108
+ {
4109
+ System.err.println("FAIL: " + node);
4110
+ }
34034111
34044112 double s = v.s;
34054113
....@@ -3447,12 +4155,26 @@
34474155
34484156 void Align()
34494157 {
4158
+ if (group.selection.size() == 0)
4159
+ return;
4160
+
4161
+ cVector bbmin = new cVector();
4162
+ cVector bbmax = new cVector();
4163
+
4164
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4165
+
4166
+ double dx = bbmax.x - bbmin.x;
4167
+ double dy = bbmax.y - bbmin.y;
4168
+ double dz = bbmax.z - bbmin.z;
4169
+
4170
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4171
+
34504172 for (int i=0; i<group.selection.size(); i++)
34514173 {
34524174 Object3D obj = group.selection.get(i);
34534175
3454
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3455
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4176
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4177
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34564178 }
34574179
34584180 refreshContents();
....@@ -3473,11 +4195,11 @@
34734195
34744196 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34754197
3476
- boolean random = CameraPane.RANDOM;
3477
- CameraPane.RANDOM = false; // parse all random nodes
4198
+ boolean random = CameraPane.SWITCH;
4199
+ CameraPane.SWITCH = false; // parse all random nodes
34784200 lowres.linkVerticesThis(null);
34794201 lowres.linkVerticesThis(sn);
3480
- CameraPane.RANDOM = random;
4202
+ CameraPane.SWITCH = random;
34814203
34824204 System.err.flush();
34834205
....@@ -3517,7 +4239,7 @@
35174239 return;
35184240
35194241 Object3D poses = group.selection.get(0);
3520
- Object3D ref = GrafreeD.clipboard.get(0);
4242
+ Object3D ref = Grafreed.clipboard.get(0);
35214243
35224244 Object3D newgroup = new Object3D("Po:" + poses.name);
35234245
....@@ -3686,7 +4408,7 @@
36864408 group.selection.RelinkToSupport(); // july 2014
36874409 System.out.println("DONE.");
36884410 refreshContents();
3689
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4411
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
36904412 }
36914413
36924414 void ReduceMesh(boolean reduction34)
....@@ -3711,9 +4433,9 @@
37114433
37124434 void ClipMesh()
37134435 {
3714
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4436
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37154437 {
3716
- Object3D content = GrafreeD.clipboard.get(0);
4438
+ Object3D content = Grafreed.clipboard.get(0);
37174439
37184440 if (content instanceof cGroup && ((cGroup)content).transientlink )
37194441 content = ((cGroup)content).get(0);
....@@ -3722,7 +4444,7 @@
37224444 // {
37234445 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37244446 // }
3725
- group.selection.ClipMesh(GrafreeD.clipboard);
4447
+ group.selection.ClipMesh(Grafreed.clipboard);
37264448 }
37274449 // group.selection.ClipMesh(GrafreeD.clipboard);
37284450 System.out.println("DONE.");
....@@ -3769,6 +4491,18 @@
37694491 void MarkLeaves(boolean hide)
37704492 {
37714493 group.selection.MarkLeaves(hide);
4494
+ refreshContents();
4495
+ }
4496
+
4497
+ void RewindLeaves(boolean hide)
4498
+ {
4499
+ group.selection.RewindLeaves(hide);
4500
+ refreshContents();
4501
+ }
4502
+
4503
+ void RandomLeaves(boolean hide)
4504
+ {
4505
+ group.selection.RandomLeaves(hide);
37724506 refreshContents();
37734507 }
37744508
....@@ -3843,10 +4577,6 @@
38434577 // }
38444578 // }
38454579
3846
- static boolean allparams = true;
3847
-
3848
- static Vector<Object3D> listUI = new Vector<Object3D>();
3849
-
38504580 void EditSelection(boolean newWindow)
38514581 {
38524582 // aConstraints.gridy = 0;
....@@ -3854,10 +4584,10 @@
38544584 {
38554585 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
38564586 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3857
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4587
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38584588
38594589 Object3D elem = (Object3D)group.selection.elementAt(i);
3860
- if(elem != group)
4590
+ if(elem != group || !newWindow)
38614591 {
38624592 // if (!(elem instanceof Composite))
38634593 // newWindow = false;
....@@ -3939,7 +4669,8 @@
39394669 //new Exception().printStackTrace();
39404670
39414671 freezemodel = true;
3942
-
4672
+ ClearUnpinned();
4673
+
39434674 /**/
39444675 //switch (event.id)
39454676 {
....@@ -3947,7 +4678,6 @@
39474678 //case 702: // Event.LIST_DESELECT
39484679 group.deselectAll();
39494680 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3950
- objEditor.ClearInfo(); // .GetMaterial());
39514681 if (tps != null)
39524682 {
39534683 for (int i=0; i < tps.length; i++)
....@@ -3956,33 +4686,39 @@
39564686
39574687 //if (child.parent != null)
39584688 //child.parent.addSelectee(child);
4689
+ objEditor.SetMaterial(child);
39594690 group.addSelectee(child);
3960
- objEditor.SetMaterial(child); // .GetMaterial());
3961
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3962
- System.err.println("info : " + child.GetPath());
39634691 }
39644692 }
3965
- else
3966
- {
3967
- objEditor.SetMaterial(group); // .GetMaterial());
3968
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3969
- System.err.println("info : " + group.GetPath());
3970
- }
4693
+// else
4694
+// {
4695
+// objEditor.SetMaterial(group); // .GetMaterial());
4696
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4697
+// System.err.println("info : " + group.GetPath());
4698
+// }
39714699
3972
- objEditor.SetText(); // jan 2014
3973
-
3974
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4700
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
39754701 CameraPane.flash = true;
39764702
3977
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4703
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39784704 // a camera
39794705 {
3980
- CameraPane.camerachangeframe = 0; // don't refuse it
3981
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3982
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3983
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
4706
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4707
+ {
4708
+ CameraPane.camerachangeframe = 0; // don't refuse it
4709
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4710
+ }
4711
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4712
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
39844713 }
39854714
4715
+ if (tps != null && tps.length == 1)
4716
+ {
4717
+ EditSelection(false);
4718
+ }
4719
+
4720
+ SetPinStates(tps != null && tps.length > 0);
4721
+
39864722 refreshContents();
39874723 //return true;
39884724 }
....@@ -3991,6 +4727,35 @@
39914727
39924728 freezemodel = false;
39934729 }
4730
+
4731
+ void SetPinStates(boolean enabled)
4732
+ {
4733
+ editButton.setEnabled(enabled);
4734
+ uneditButton.setEnabled(enabled);
4735
+ unselectButton.setEnabled(enabled);
4736
+ flashSelectionButton.setEnabled(enabled);
4737
+ }
4738
+
4739
+ void refreshContents(boolean cp)
4740
+ {
4741
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4743
+ {
4744
+ objEditor.ClearInfo(); // .GetMaterial());
4745
+
4746
+ for (int i=0; i < group.selection.Size(); i++)
4747
+ {
4748
+ Object3D child = (Object3D) group.selection.get(i);
4749
+
4750
+ objEditor.AddInfo(child, this, true);
4751
+ System.err.println("info : " + child.GetPath());
4752
+ }
4753
+
4754
+ objEditor.SetText(); // jan 2014
4755
+ }
4756
+
4757
+ super.refreshContents(cp);
4758
+ }
39944759
39954760 void linkSomething(Object3D thing)
39964761 {
....@@ -4062,16 +4827,19 @@
40624827 {
40634828 if (group.selection.isEmpty())
40644829 return;
4065
- GrafreeD.clipboardIsTempGroup = false;
4830
+
4831
+ Grafreed.clipboardIsTempGroup = false;
40664832 Composite tGroup = null;
40674833 if (group.selection.size() > 0) // 1)
40684834 {
40694835 tGroup = new cGroup();
4070
- GrafreeD.clipboardIsTempGroup = true;
4836
+ Grafreed.clipboardIsTempGroup = true;
40714837 }
40724838
40734839 if (cut)
40744840 {
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
40754843 //int indices[] = jList.getSelectedIndices();
40764844 //for (int i = indices.length - 1; i >= 0; i--)
40774845 //jList.remove(indices[i]);
....@@ -4107,16 +4875,16 @@
41074875 //System.out.println("cut " + child);
41084876 //System.out.println("parent = " + child.parent);
41094877 // tmp.addChild(child);
4110
- if (GrafreeD.clipboardIsTempGroup)
4878
+ if (Grafreed.clipboardIsTempGroup)
41114879 tGroup.add/*Child*/(tmp);
41124880 else
4113
- GrafreeD.clipboard = tmp;
4881
+ Grafreed.clipboard = tmp;
41144882 }
41154883 else
4116
- if (GrafreeD.clipboardIsTempGroup)
4884
+ if (Grafreed.clipboardIsTempGroup)
41174885 tGroup.add/*Child*/(child);
41184886 else
4119
- GrafreeD.clipboard = child;
4887
+ Grafreed.clipboard = child;
41204888 }
41214889
41224890 //ResetModel();
....@@ -4148,21 +4916,23 @@
41484916 //System.out.println("cut " + elem);
41494917 //System.out.println("parent = " + elem.parent);
41504918 // tmp.addChild(elem);
4151
- if (GrafreeD.clipboardIsTempGroup)
4919
+ if (Grafreed.clipboardIsTempGroup)
41524920 tGroup.add/*Child*/(tmp);
41534921 else
4154
- GrafreeD.clipboard = tmp;
4922
+ Grafreed.clipboard = tmp;
41554923 }
41564924 else
4157
- if (GrafreeD.clipboardIsTempGroup)
4925
+ if (Grafreed.clipboardIsTempGroup)
41584926 tGroup.add/*Child*/(child);
41594927 else
4160
- GrafreeD.clipboard = child;
4928
+ Grafreed.clipboard = child;
41614929 }
41624930
41634931 }
4164
- if (GrafreeD.clipboardIsTempGroup)
4165
- GrafreeD.clipboard = tGroup;
4932
+
4933
+ if (Grafreed.clipboardIsTempGroup)
4934
+ Grafreed.clipboard = tGroup;
4935
+
41664936 if (cut)
41674937 {
41684938 ResetModel();
....@@ -4172,11 +4942,15 @@
41724942
41734943 void paste(boolean expand)
41744944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
41754949 // if (GrafreeD.clipboard == null)
41764950 // return;
41774951 boolean first = true;
41784952
4179
- if (GrafreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
41804954 {
41814955 Composite temp;
41824956
....@@ -4187,7 +4961,7 @@
41874961 temp = (Composite)Applet3D.clipboard.deepCopy();
41884962 */
41894963 Object3D elem;
4190
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4964
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41914965 {
41924966 Object3D child = (Object3D)e.nextElement();
41934967
....@@ -4221,21 +4995,22 @@
42214995 //Object3D cb = Applet3D.clipboard;
42224996 //temp.addChild(cb);
42234997 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4224
- assert(GrafreeD.clipboard.parent == null);
4225
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4226
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4227
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4228
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4998
+ assert(Grafreed.clipboard.parent == null);
4999
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5000
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5001
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5002
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42295003 else
4230
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4231
- GrafreeD.clipboard.get(0).parent = keepparent;
5004
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5005
+ Grafreed.clipboard.get(0).parent = keepparent;
42325006 }
42335007
5008
+ Globals.SAVEONMAKE = keep;
42345009 ResetModel();
42355010 refreshContents();
42365011 }
42375012
4238
- void pasteInto(boolean copyit)
5013
+ void pasteInto(boolean copyit, boolean clone)
42395014 {
42405015 // if (GrafreeD.clipboard == null)
42415016 // return;
....@@ -4264,15 +5039,22 @@
42645039 if (copyit)
42655040 {
42665041 // paste(false);
4267
- CloneClipboard(false); // sept 2014
5042
+ if (clone)
5043
+ {
5044
+ CloneClipboard(false); // sept 2014
5045
+ }
5046
+ else
5047
+ {
5048
+ paste(false);
5049
+ }
42685050 }
42695051 else
42705052 {
42715053 boolean first = true;
42725054
4273
- if (GrafreeD.clipboardIsTempGroup)
5055
+ if (Grafreed.clipboardIsTempGroup)
42745056 {
4275
- Composite temp = (Composite)GrafreeD.clipboard;
5057
+ Composite temp = (Composite)Grafreed.clipboard;
42765058 Object3D copy;
42775059 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42785060 {
....@@ -4282,7 +5064,7 @@
42825064 }
42835065 } else
42845066 {
4285
- linkSomething(GrafreeD.clipboard); //.get(0));
5067
+ linkSomething(Grafreed.clipboard); //.get(0));
42865068 }
42875069 }
42885070 }
....@@ -4359,6 +5141,10 @@
43595141
43605142 void group(Object3D csg, boolean grab)
43615143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
43625148 if (//false) // why??
43635149 !group.selection.isEmpty())
43645150 {
....@@ -4472,8 +5258,34 @@
44725258 //node.add(csg);
44735259 //makeSomething(node);
44745260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
44755262 }
44765263
5264
+ void Ungroup(Object3D g)
5265
+ {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
5270
+ if (g instanceof HiddenObject)
5271
+ {
5272
+ HiddenObject h = (HiddenObject) g;
5273
+
5274
+ for (int i=0; i<h.ActualSize(); i++)
5275
+ {
5276
+ objEditor.makeSomething(h.get(i), false);
5277
+ }
5278
+ }
5279
+ else
5280
+ {
5281
+ for (int i=0; i<g.Size(); i++)
5282
+ {
5283
+ objEditor.makeSomething(g.get(i), false);
5284
+ }
5285
+ }
5286
+ Globals.SAVEONMAKE = keep;
5287
+ }
5288
+
44775289 void ungroup()
44785290 {
44795291 /*
....@@ -4667,21 +5479,6 @@
46675479 }
46685480 */
46695481
4670
- void ImportGFD()
4671
- {
4672
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4673
- browser.show();
4674
- String filename = browser.getFile();
4675
- if (filename != null && filename.length() > 0)
4676
- {
4677
- String fullname = browser.getDirectory() + filename;
4678
-
4679
- //Object3D readobj =
4680
- objEditor.ReadGFD(fullname, objEditor);
4681
- //makeSomething(readobj);
4682
- }
4683
- }
4684
-
46855482 /*
46865483 public void Callback(Object obj)
46875484 {
....@@ -4705,26 +5502,9 @@
47055502 }
47065503 */
47075504
4708
- void ImportVRMLX3D()
4709
- {
4710
- if (GrafreeD.standAlone)
4711
- {
4712
- /**/
4713
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4714
- browser.show();
4715
- String filename = browser.getFile();
4716
- if (filename != null && filename.length() > 0)
4717
- {
4718
- String fullname = browser.getDirectory() + filename;
4719
- LoadVRMLX3D(fullname);
4720
- }
4721
- /**/
4722
- }
4723
- }
4724
-
47255505 String GetFile(String dialogName)
47265506 {
4727
- if (GrafreeD.standAlone)
5507
+ if (Grafreed.standAlone)
47285508 {
47295509 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47305510 browser.show();
....@@ -4788,10 +5568,33 @@
47885568 cButton flashSelectionButton;
47895569 cButton editButton;
47905570 cButton uneditButton;
5571
+ JCheckBox allParamsButton;
47915572 cButton clearpanelButton;
4792
- cButton allParamsButton;
47935573 cButton unselectButton;
47945574
5575
+ cButton restoreCameraButton;
5576
+
5577
+ cButton saveButton;
5578
+ cButton oneStepButton;
5579
+
5580
+ cButton groupButton;
5581
+ cButton ungroupButton;
5582
+ cButton compositeButton;
5583
+ cButton switchButton;
5584
+ cButton loopButton;
5585
+ cButton textureButton;
5586
+
5587
+ cButton gridButton;
5588
+ cButton boxButton;
5589
+ cButton sphereButton;
5590
+ cButton coneButton;
5591
+ cButton torusButton;
5592
+ cButton superButton;
5593
+ cButton kleinButton;
5594
+ cButton particlesButton;
5595
+ cButton overlayButton;
5596
+ cButton lightButton;
5597
+
47955598 cButton screenfitButton;
47965599 cButton screenfitpointButton;
47975600 cButton snapobjectButton;
....@@ -4803,14 +5606,6 @@
48035606
48045607 cButton setsupportButton;
48055608
4806
- cButton twoButton;
4807
- cButton sixButton;
4808
- cButton threeButton;
4809
- cButton sevenButton;
4810
- cButton fourButton; // full panel
4811
- cButton oneButton; // full XYZ
4812
- //cButton currentLayout;
4813
-
48145609 //
48155610 //Composite
48165611 Object3D // to do !!
....@@ -4820,9 +5615,11 @@
48205615 //JTree jTree;
48215616 private MenuItem lookAtItem;
48225617 private MenuItem lookFromItem;
4823
- private MenuItem switchItem;
5618
+ private MenuItem switchViewItem;
48245619 private MenuItem cutItem;
4825
- private MenuItem duplicateItem;
5620
+ private MenuItem undoItem;
5621
+ private MenuItem redoItem;
5622
+ private JMenuItem duplicateItem;
48265623 private MenuItem cloneItem;
48275624 private MenuItem cloneSupportItem;
48285625 private MenuItem overwriteGeoItem;
....@@ -4833,8 +5630,9 @@
48335630 private MenuItem resetsupportItem;
48345631 private MenuItem resetreferencesItem;
48355632 private MenuItem linkverticesItem;
5633
+ private MenuItem relinkverticesItem;
48365634 private MenuItem setMasterItem;
4837
- private MenuItem resetMeshItem;
5635
+ private MenuItem resetAllItem;
48385636 private MenuItem stepAllItem;
48395637 private MenuItem revertMeshItem;
48405638 private MenuItem poseMeshItem;
....@@ -4845,6 +5643,7 @@
48455643 private MenuItem mergeGeometriesItem;
48465644 private MenuItem copyItem;
48475645 private MenuItem pasteItem;
5646
+ private MenuItem pasteIntoItem;
48485647 private MenuItem pasteLinkItem;
48495648 private MenuItem pasteCloneItem;
48505649 private MenuItem pasteExpandItem;
....@@ -4854,6 +5653,7 @@
48545653 private MenuItem genNormalsMESHItem;
48555654 private MenuItem genNormalsCADItem;
48565655 private MenuItem genNormalsORGANItem;
5656
+ private MenuItem genNormalsMINEItem;
48575657 private MenuItem stripifyItem;
48585658 private MenuItem unstripifyItem;
48595659 private MenuItem trimItem;
....@@ -4882,6 +5682,10 @@
48825682 private MenuItem showleavesItem;
48835683 private MenuItem markleavesItem;
48845684 private MenuItem unmarkleavesItem;
5685
+ private MenuItem rewindleavesItem;
5686
+ private MenuItem unrewindleavesItem;
5687
+ private MenuItem randomleavesItem;
5688
+ private MenuItem unrandomleavesItem;
48855689
48865690 private MenuItem flipVItem;
48875691 private MenuItem unflipVItem;
....@@ -4893,14 +5697,17 @@
48935697 private MenuItem panoTexturesItem;
48945698
48955699 private MenuItem resetCentroidItem;
4896
- private MenuItem transformgeometryItem;
5700
+ private MenuItem resetCentroidXZItem;
48975701 private MenuItem resetTransformItem;
5702
+ private MenuItem transformGeometryItem;
5703
+ private MenuItem transformChildrenItem;
5704
+ private MenuItem hideItem;
48985705 private MenuItem grabItem;
48995706 private MenuItem backItem;
49005707 private MenuItem frontItem;
49015708 private MenuItem cameraItem;
49025709 private MenuItem compositeItem;
4903
- private MenuItem randomItem;
5710
+ private MenuItem switchItem;
49045711 private MenuItem physicsItem;
49055712 private MenuItem frameselectorItem;
49065713 private MenuItem scriptNodeItem;
....@@ -4915,6 +5722,7 @@
49155722
49165723 private MenuItem resetParentItem;
49175724 private MenuItem repairParentItem;
5725
+ private MenuItem repairShadowItem;
49185726 private MenuItem sortbysizeItem;
49195727 private MenuItem sortbynameItem;
49205728
....@@ -4935,10 +5743,11 @@
49355743 private MenuItem coneItem;
49365744 private MenuItem torusItem;
49375745 private MenuItem superItem;
5746
+ private MenuItem kleinItem;
49385747 private MenuItem blobItem;
49395748 private MenuItem latheItem;
49405749 private MenuItem bezierItem;
4941
- private MenuItem checkerItem;
5750
+ private MenuItem overlayItem;
49425751 private MenuItem meshItem;
49435752 // private MenuItem meshGroupItem;
49445753 private MenuItem springItem;
....@@ -4947,6 +5756,7 @@
49475756 private MenuItem csgItem;
49485757 private MenuItem templateItem;
49495758 private MenuItem textureItem;
5759
+ private MenuItem billboardItem;
49505760 private MenuItem shadowXItem;
49515761 private MenuItem shadowYItem;
49525762 private MenuItem shadowZItem;
....@@ -4959,11 +5769,6 @@
49595769 private MenuItem doubleItem;
49605770 private MenuItem tripleItem;
49615771
4962
- private MenuItem importGFDItem;
4963
- private MenuItem importVRMLX3DItem;
4964
- private MenuItem import3DSItem;
4965
- private MenuItem importOBJItem;
4966
-
49675772 private MenuItem computeAOItem;
49685773 private MenuItem recompileItem;
49695774 private MenuItem editScriptItem;
....@@ -4973,4 +5778,8 @@
49735778 private MenuItem analyzeItem;
49745779 private MenuItem dumpItem;
49755780 //boolean freezemodel = false;
5781
+
5782
+ Menu cameraMenu;
5783
+ MenuItem editCameraItem;
5784
+ MenuItem restoreCameraItem;
49765785 }