Normand Briere
2019-06-23 f1382bc839a74ef1d1534c61ea94e53cf54716df
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);
....@@ -97,14 +98,14 @@
9798
9899 void CloneClipboard(boolean supports)
99100 {
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));
101
+ assert(Grafreed.clipboard.parent == null);
102
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
103
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
104
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
105
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105106 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
107
+ makeSomething(CloneObject(Grafreed.clipboard, false));
108
+ Grafreed.clipboard.get(0).parent = keepparent;
108109 }
109110
110111 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +119,7 @@
118119 // obj.support = null;
119120 if (!supports)
120121 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
122
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122123 obj.parent = parent;
123124 // obj.support = support;
124125 // clone.support = support; // aout 2013
....@@ -147,8 +148,129 @@
147148
148149 //JTextField nameField;
149150
150
- void SetupMenu2(ObjEditor oe)
151
+ void SetupMenu2(GroupEditor oe)
151152 {
153
+ Menu menu;
154
+ oe.menuBar.add(menu = new Menu("Edit"));
155
+ //editItem = menu.add(new MenuItem("Edit"));
156
+ //editItem.addActionListener(this);
157
+
158
+// undoItem = menu.add(new MenuItem("Undo"));
159
+// undoItem.addActionListener(this);
160
+// redoItem = menu.add(new MenuItem("Redo"));
161
+// redoItem.addActionListener(this);
162
+// menu.add("-");
163
+ duplicateItem = menu.add(new MenuItem("Duplicate"));
164
+ duplicateItem.addActionListener(this);
165
+ cloneItem = menu.add(new MenuItem("Clone"));
166
+ cloneItem.addActionListener(this);
167
+ if (Globals.ADVANCED)
168
+ {
169
+ cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
170
+ cloneSupportItem.addActionListener(this);
171
+ }
172
+ menu.add("-");
173
+ cutItem = menu.add(new MenuItem("Cut"));
174
+ cutItem.addActionListener(this);
175
+ copyItem = menu.add(new MenuItem("Copy"));
176
+ copyItem.addActionListener(this);
177
+ pasteItem = menu.add(new MenuItem("Paste"));
178
+ pasteItem.addActionListener(this);
179
+
180
+ menu.add("-");
181
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
182
+ pasteIntoItem.addActionListener(this);
183
+ pasteLinkItem = menu.add(new MenuItem("Paste link"));
184
+ pasteLinkItem.addActionListener(this);
185
+ pasteCloneItem = menu.add(new MenuItem("Paste clone"));
186
+ pasteCloneItem.addActionListener(this);
187
+// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
188
+// pasteExpandItem.addActionListener(this);
189
+ menu.add("-");
190
+ clearItem = menu.add(new MenuItem("Clear"));
191
+ clearItem.addActionListener(this);
192
+
193
+ if (Globals.ADVANCED)
194
+ {
195
+ // Deletes the cameras...
196
+ clearAllItem = menu.add(new MenuItem("Clear All"));
197
+ clearAllItem.addActionListener(this);
198
+ }
199
+
200
+ menuBar.add(cameraMenu = new Menu("View"));
201
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
202
+ //zBufferItem.addActionListener(this);
203
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204
+ //normalLensItem.addActionListener(this);
205
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
+ revertCameraItem.addActionListener(this);
207
+
208
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
+ toggleFullScreenItem.addItemListener(this);
210
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
+ cameraMenu.add("-");
212
+
213
+ cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
+ toggleTextureItem.addItemListener(this);
215
+ toggleTextureItem.setState(CameraPane.textureon);
216
+
217
+ cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
+ toggleSwitchItem.addItemListener(this);
219
+ toggleSwitchItem.setState(CameraPane.SWITCH);
220
+
221
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
222
+ toggleHandleItem.addItemListener(this);
223
+ toggleHandleItem.setState(CameraPane.HANDLES);
224
+
225
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
226
+ togglePaintItem.addItemListener(this);
227
+ togglePaintItem.setState(CameraPane.PAINTMODE);
228
+
229
+ if (Globals.ADVANCED)
230
+ {
231
+ cameraMenu.add("-");
232
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
233
+ toggleLiveItem.addItemListener(this);
234
+ toggleLiveItem.setState(Globals.isLIVE());
235
+
236
+ cameraMenu.add(stepItem = new MenuItem("Step"));
237
+ stepItem.addActionListener(this);
238
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
239
+ // toggleDLItem.addItemListener(this);
240
+ // toggleDLItem.setState(false);
241
+
242
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
243
+ toggleRenderItem.addItemListener(this);
244
+ toggleRenderItem.setState(!CameraPane.frozen);
245
+
246
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
247
+ toggleDebugItem.addItemListener(this);
248
+ toggleDebugItem.setState(Globals.DEBUG);
249
+
250
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
251
+ toggleFrustumItem.addItemListener(this);
252
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
253
+
254
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
255
+ toggleFootContactItem.addItemListener(this);
256
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
257
+
258
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
259
+ toggleTimelineItem.addItemListener(this);
260
+ }
261
+
262
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
263
+// toggleRootItem.addItemListener(this);
264
+// toggleRootItem.setState(false);
265
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
266
+// animationItem.addItemListener(this);
267
+// animationItem.setState(CameraPane.ANIMATION);
268
+ cameraMenu.add("-");
269
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
270
+ editCameraItem.addActionListener(this);
271
+
272
+ if (Globals.ADVANCED)
273
+ {
152274 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153275 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154276 //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
....@@ -160,45 +282,17 @@
160282 lookAtItem.addActionListener(this);
161283 //lookFromItem.addActinoListener(this);
162284 //switchItem.addActionListener(this);
163
- Menu menu;
164
- oe.menuBar.add(menu = new Menu("Edit"));
165
- //editItem = menu.add(new MenuItem("Edit"));
166
- //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
168
- duplicateItem.addActionListener(this);
169
- menu.add("-");
170
- cloneItem = menu.add(new MenuItem("Clone"));
171
- cloneItem.addActionListener(this);
172
- cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173
- cloneSupportItem.addActionListener(this);
174
- menu.add("-");
175
- cutItem = menu.add(new MenuItem("Cut"));
176
- cutItem.addActionListener(this);
177
- copyItem = menu.add(new MenuItem("Copy"));
178
- copyItem.addActionListener(this);
179
- pasteItem = menu.add(new MenuItem("Paste"));
180
- pasteItem.addActionListener(this);
181
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
182
- pasteLinkItem.addActionListener(this);
183
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184
- pasteCloneItem.addActionListener(this);
185
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186
-// pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
189
- clearAllItem = menu.add(new MenuItem("Clear All"));
190
- clearAllItem.addActionListener(this);
191
-
285
+ }
286
+
192287 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);
288
+ if (Globals.ADVANCED)
289
+ {
197290 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198291 revertMeshItem.addActionListener(this);
199292 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200293 resetreferencesItem.addActionListener(this);
201294 menu.add("-");
295
+ }
202296 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203297 overwriteGeoItem.addActionListener(this);
204298 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,17 +304,26 @@
210304 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211305 overwriteUVItem.addActionListener(this);
212306 menu.add("-");
307
+ if (Globals.ADVANCED)
308
+ {
213309 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214310 generateMeshItem.addActionListener(this);
215311 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216312 poseMeshItem.addActionListener(this);
217313 menu.add("-");
314
+ }
218315 resetsupportItem = menu.add(new MenuItem("Reset support"));
219316 resetsupportItem.addActionListener(this);
220317 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221318 linkverticesItem.addActionListener(this);
319
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
320
+ relinkverticesItem.addActionListener(this);
321
+
322
+ if (Globals.ADVANCED)
323
+ {
222324 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223325 setMasterItem.addActionListener(this);
326
+ }
224327
225328 oe.menuBar.add(menu = new Menu("Group"));
226329 grabItem = menu.add(new MenuItem("Grab"));
....@@ -231,52 +334,69 @@
231334 frontItem.addActionListener(this);
232335 compositeItem = menu.add(new MenuItem("Composite"));
233336 compositeItem.addActionListener(this);
337
+ hideItem = menu.add(new MenuItem("Hidden Group"));
338
+ hideItem.addActionListener(this);
339
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
340
+ ungroupItem.addActionListener(this);
234341 menu.add("-");
235
- randomItem = menu.add(new MenuItem("Random"));
342
+ randomItem = menu.add(new MenuItem("Switch node"));
236343 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);
241344 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
242345 switchGeoItem.addActionListener(this);
243346 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
244347 switchTransfoItem.addActionListener(this);
245
- morphItem = menu.add(new MenuItem("Morph"));
348
+ morphItem = menu.add(new MenuItem("Morph Group"));
246349 morphItem.addActionListener(this);
350
+
351
+ if (Globals.ADVANCED)
352
+ {
353
+ menu.add("-");
354
+ physicsItem = menu.add(new MenuItem("Physics"));
355
+ physicsItem.addActionListener(this);
356
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
357
+ frameselectorItem.addActionListener(this);
247358 scriptNodeItem = menu.add(new MenuItem("Script Node"));
248359 scriptNodeItem.addActionListener(this);
249360 cameraItem = menu.add(new MenuItem("Camera"));
250361 cameraItem.addActionListener(this);
362
+ }
251363
252364 oe.menuBar.add(menu = new Menu("Object"));
253365 textureItem = menu.add(new MenuItem("Texture"));
254366 textureItem.addActionListener(this);
367
+ billboardItem = menu.add(new MenuItem("Billboard"));
368
+ billboardItem.addActionListener(this);
255369 csgItem = menu.add(new MenuItem("CSG"));
256370 csgItem.addActionListener(this);
257
- shadowXItem = menu.add(new MenuItem("Shadow X"));
371
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
258372 shadowXItem.addActionListener(this);
259
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
373
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
260374 shadowYItem.addActionListener(this);
261
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
375
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
262376 shadowZItem.addActionListener(this);
377
+ if (Globals.ADVANCED)
378
+ {
379
+ menu.add("-");
263380 linkerItem = menu.add(new MenuItem("Linker"));
264381 linkerItem.addActionListener(this);
265
- templateItem = menu.add(new MenuItem("Template"));
266
- templateItem.addActionListener(this);
267382 attributeItem = menu.add(new MenuItem("Attribute"));
268383 attributeItem.addActionListener(this);
384
+ templateItem = menu.add(new MenuItem("Template"));
385
+ templateItem.addActionListener(this);
269386 pointflowItem = menu.add(new MenuItem("Point Flow"));
270387 pointflowItem.addActionListener(this);
388
+ }
271389 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274390 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275391 resetTransformItem.addActionListener(this);
276392 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277393 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.addActionListener(this);
394
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
395
+ resetCentroidXZItem.addActionListener(this);
396
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
397
+ transformGeometryItem.addActionListener(this);
398
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
399
+ transformChildrenItem.addActionListener(this);
280400
281401 oe.menuBar.add(menu = new Menu("Geometry"));
282402 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -287,6 +407,11 @@
287407 genNormalsCADItem.addActionListener(this);
288408 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
289409 genNormalsMESHItem.addActionListener(this);
410
+ if (Globals.ADVANCED)
411
+ {
412
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
413
+ genNormalsMINEItem.addActionListener(this);
414
+ }
290415 stripifyItem = menu.add(new MenuItem("Stripify"));
291416 stripifyItem.addActionListener(this);
292417 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -308,23 +433,34 @@
308433 reduce34MeshItem.addActionListener(this);
309434 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
310435 increaseMeshItem.addActionListener(this);
311
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
312
- smoothMeshItem.addActionListener(this);
313436 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
314437 clipMeshItem.addActionListener(this);
438
+
439
+ if (Globals.ADVANCED)
440
+ {
441
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
442
+ smoothMeshItem.addActionListener(this);
443
+ }
315444
316445 oe.menuBar.add(menu = new Menu("Attributes"));
317446 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
318447 clearMaterialsItem.addActionListener(this);
448
+ resetAllItem = menu.add(new MenuItem("Reset All"));
449
+ resetAllItem.addActionListener(this);
450
+ stepAllItem = menu.add(new MenuItem("Step All"));
451
+ stepAllItem.addActionListener(this);
319452 menu.add("-");
320453 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
321454 liveleavesItem.addActionListener(this);
322455 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
323456 unliveleavesItem.addActionListener(this);
457
+ if (Globals.ADVANCED)
458
+ {
324459 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
325460 supportleavesItem.addActionListener(this);
326461 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
327462 unsupportleavesItem.addActionListener(this);
463
+ }
328464 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
329465 hideleavesItem.addActionListener(this);
330466 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -333,6 +469,14 @@
333469 markleavesItem.addActionListener(this);
334470 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
335471 unmarkleavesItem.addActionListener(this);
472
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
473
+ rewindleavesItem.addActionListener(this);
474
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
475
+ unrewindleavesItem.addActionListener(this);
476
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
477
+ randomleavesItem.addActionListener(this);
478
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
479
+ unrandomleavesItem.addActionListener(this);
336480 menu.add("-");
337481 flipVItem = menu.add(new MenuItem("Flip V"));
338482 flipVItem.addActionListener(this);
....@@ -368,35 +512,40 @@
368512 sortbynameItem = menu.add(new MenuItem("Sort by name"));
369513 sortbynameItem.addActionListener(this);
370514 menu.add("-");
515
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
516
+ shareGeometriesItem.addActionListener(this);
517
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
518
+ mergeGeometriesItem.addActionListener(this);
519
+ if (Globals.ADVANCED)
520
+ {
521
+ // Pretty much the same as duplicate and clone.
371522 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
372523 extractGeometriesItem.addActionListener(this);
373524 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
374525 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);
526
+ }
379527
380528 oe.menuBar.add(menu = new Menu("Insert"));
381529 buildCreateMenu(menu);
382530
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
-
394531 oe.menuBar.add(menu = new Menu("Tools"));
395532 buildToolsMenu(menu);
396533 }
397534
398535 void SetupUI2(ObjEditor oe)
399536 {
537
+ // June 2019
538
+ if (oe == null)
539
+ {
540
+ //super.SetupUI2(this);
541
+ //return;
542
+ }
543
+
544
+ if (copy != group)
545
+ {
546
+ //super.SetupUI2(this);
547
+ }
548
+
400549 //new Exception().printStackTrace();
401550
402551 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -425,150 +574,120 @@
425574 oe.radioPanel.add(dummyButton);
426575 oe.buttonGroup.add(dummyButton);
427576 */
428
- aConstraints.gridy += 1;
429
- oe.aConstraints.gridwidth = 1;
430
- oe.aConstraints.gridx = 0;
577
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
431578
432
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
579
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580
+ //minButton.setToolTipText("Minimize window");
581
+ //minButton.addActionListener(this);
582
+
583
+ oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
+ maxButton.setToolTipText("Maximize window");
585
+ maxButton.addActionListener(this);
586
+
587
+ oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ fullButton.setToolTipText("Full-screen window");
589
+ fullButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ undoButton.setToolTipText("Undo changes");
593
+ undoButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ redoButton.setToolTipText("Redo changes");
597
+ redoButton.addActionListener(this);
598
+
599
+ oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ saveButton.setToolTipText("Save changes");
601
+ saveButton.addActionListener(this);
602
+
603
+ oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
604
+ liveCB.setToolTipText("Enable animation");
433605 liveCB.addItemListener(this);
434606
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);
607
+ oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ oneStepButton.setToolTipText("Animate one step forward");
609
+ oneStepButton.addActionListener(this);
610
+
611
+ oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
612
+ fastCB.setToolTipText("Fast mode");
453613 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);
460
-
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);
614
+
615
+ oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
616
+ trackCB.setToolTipText("Enable tracking");
495617 trackCB.addItemListener(this);
496618
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ screenfitButton.setToolTipText("Screen fit");
499621 screenfitButton.addActionListener(this);
500
- oe.aConstraints.gridx += 1;
622
+
501623 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
502624 // 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;
507625
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);
626
+ if (Globals.ADVANCED)
627
+ {
628
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ snapobjectButton.addActionListener(this);
630
+ snapobjectButton.setToolTipText("Snap Object");
631
+ }
632
+
633
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ flashSelectionButton.setToolTipText("Show selection");
514635 flashSelectionButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.aConstraints.weighty = 0;
517
- oe.aConstraints.gridwidth = 1;
518636
519
- //
520
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
637
+ oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
638
+
639
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
640
+ twoButton.setToolTipText("Show center view only");
521641 twoButton.addActionListener(this);
522
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
642
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
523643 fourButton.addActionListener(this);
524
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
644
+ fourButton.setToolTipText("Show left panel only");
645
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646
+ sixButton.setToolTipText("2-column layout left");
525647 sixButton.addActionListener(this);
526
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
648
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ threeButton.setToolTipText("2-column layout right");
527650 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
651
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
+ sevenButton.setToolTipText("3-column layout");
529653 sevenButton.addActionListener(this);
530654 //
531655
532
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
656
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
+ rootButton.setToolTipText("Edit selection in new tab");
533658 rootButton.addActionListener(this);
534
- oe.aConstraints.gridx += 1;
535
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
659
+
660
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
+ closeButton.setToolTipText("Close tab");
536662 closeButton.addActionListener(this);
537663 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
538664 //clearButton.addActionListener(this);
539
- oe.aConstraints.gridx += 1;
540665
541
- oe.aConstraints.gridx = 1; //
542
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
666
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
+ editButton.setToolTipText("Edit selection");
543668 editButton.addActionListener(this);
544
- oe.aConstraints.gridx += 1;
545
- oe.aConstraints.weighty = 0;
546
- oe.aConstraints.gridwidth = 1;
547669
548
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
670
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
+ uneditButton.setToolTipText("Unedit selection");
549672 uneditButton.addActionListener(this);
550673
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);
674
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
+ allParamsButton.setToolTipText("Edit all params");
563676 allParamsButton.addActionListener(this);
564677
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);
678
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
+ clearPanelButton.setToolTipText("Clear edit panel");
680
+ clearPanelButton.addActionListener(this);
681
+
682
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
683
+ unselectButton.setToolTipText("Unselect");
570684 unselectButton.addActionListener(this);
571685
686
+ editCommandsPanel.preferredHeight = 1;
687
+
688
+// oe.treePanel.add(commandsPanel);
689
+// oe.treePanel.Return();
690
+
572691 // oe.aConstraints.gridx += 1;
573692 // oe.aConstraints.weighty = 0;
574693 // oe.aConstraints.gridwidth = 1;
....@@ -580,40 +699,37 @@
580699 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
581700 // gcButton.addActionListener(this);
582701
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;
702
+ cGridBag jSPPanel = new cGridBag();
703
+
704
+ JScrollPane jSP;
594705 //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);
706
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
596707 ResetModel();
597
- oe.aConstraints.weighty = 0.5;
598
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
599
- oe.aConstraints.gridy += 1;
600
- oe.aConstraints.gridwidth = 1;
708
+
709
+ oe.treePanel.add(jSPPanel);
710
+ oe.treePanel.Return();
601711
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);
712
+ cGridBag copyOptionsPanel = new cGridBag();
713
+
714
+ copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
715
+ colorCB.setToolTipText("Copy color when dropped");
606716 colorCB.addItemListener(this);
607
- oe.aConstraints.gridx += 2;
608
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
717
+
718
+ copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
719
+ materialCB.setToolTipText("Copy material when dropped");
609720 materialCB.addItemListener(this);
610
- oe.aConstraints.gridx += 2;
611
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
721
+
722
+ copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
723
+ textureCB.setToolTipText("Copy texture when dropped");
612724 textureCB.addItemListener(this);
613725
614
- oe.aConstraints.gridx = 0;
615
- oe.aConstraints.gridy += 1;
726
+ copyOptionsPanel.preferredHeight = 1;
727
+ oe.treePanel.add(copyOptionsPanel);
728
+ oe.treePanel.Return();
616729
730
+// mainPanel.setDividerLocation(0.5); //1.0);
731
+// mainPanel.setResizeWeight(0.5);
732
+
617733 //jList.addListSelectionListener(this);
618734 oe.jTree.addTreeSelectionListener(this);
619735 //jTree.setRootVisible(false);
....@@ -635,20 +751,95 @@
635751 radio.layout = sevenButton;
636752 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
637753 }
754
+
755
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
756
+ {
757
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
758
+ boxCB.setToolTipText("Display bounding boxes");
759
+ boxCB.addItemListener(this);
760
+
761
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
+ zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
763
+ zoomBoxCB.addItemListener(this);
764
+
765
+ if (true) // Globals.ADVANCED)
766
+ {
767
+ panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
+ supportCB.setToolTipText("Enable rigging");
769
+ supportCB.addItemListener(this);
770
+
771
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
772
+ // localCB.addItemListener(this);
773
+
774
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
775
+ crowdCB.setToolTipText("Used for crowds");
776
+ crowdCB.addItemListener(this);
777
+
778
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
779
+ smoothCB.setToolTipText("Snapping delay");
780
+ smoothCB.addItemListener(this);
781
+
782
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
783
+ slowCB.setToolTipText("Smooth interpolation");
784
+ slowCB.addItemListener(this);
785
+
786
+// constraints.gridy += 1;
787
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
788
+// speakerMocapCB.addItemListener(this);
789
+
790
+ if (false)
791
+ {
792
+ // handled in scripts
793
+ //constraints.gridy += 1;
794
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
795
+ speakerCameraCB.addItemListener(this);
796
+
797
+ //constraints.gridy += 1;
798
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
799
+ speakerFocusCB.addItemListener(this);
800
+
801
+ //constraints.gridy += 1;
802
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
803
+ smoothfocusCB.addItemListener(this);
804
+ }
805
+
806
+//constraints.gridx += 1;
807
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
808
+// debugCB.addItemListener(this);
809
+
810
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
+ oeilCB.addItemListener(this);
812
+
813
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
814
+ lookAtCB.setToolTipText("Look-at target");
815
+ lookAtCB.addItemListener(this);
816
+
817
+ }
818
+
819
+ cGridBag fill = new cGridBag();
820
+
821
+ fill.preferredHeight = 200;
822
+
823
+ panel.add(fill);
824
+
825
+ }
638826
639827 void EditObject(Object3D obj)
640828 {
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();
829
+ cRadio radioButton = new cRadio(obj.name);
830
+ radioButton.SetObject(obj);
831
+ radioButton.layout = sevenButton;
832
+ radioButton.SetCamera(cameraView.renderCamera, false);
833
+ radioButton.addActionListener(this);
834
+ radioPanel.add(radioButton);
835
+ buttonGroup.add(radioButton);
836
+ radioButton.doClick();
649837 }
838
+
650839 void SetupViews(ObjEditor oe)
651840 {
841
+ theFrame = this;
842
+
652843 oe.SetupViews();
653844
654845 System.out.println("SetupViews");
....@@ -665,6 +856,7 @@
665856 JCheckBox fastCB;
666857 JCheckBox slowCB;
667858 JCheckBox boxCB;
859
+ JCheckBox zoomBoxCB;
668860 JCheckBox trackCB;
669861 JCheckBox smoothfocusCB;
670862 // JCheckBox speakerMocapCB;
....@@ -707,10 +899,10 @@
707899 dropAttributes |= Object3D.TEXTURE;
708900 else
709901 dropAttributes &= ~Object3D.TEXTURE;
710
- }
711
- else if(e.getSource() == liveCB)
902
+ } else if(e.getSource() == liveCB)
712903 {
713904 cameraView.ToggleLive();
905
+ refreshContents(false);
714906 }
715907 else if(e.getSource() == supportCB)
716908 {
....@@ -745,6 +937,10 @@
745937 Recompile();
746938 cameraView.repaint();
747939 // refreshContents();
940
+ }
941
+ else if(e.getSource() == zoomBoxCB)
942
+ {
943
+ cameraView.ToggleZoomBoxMode();
748944 }
749945 else if(e.getSource() == smoothfocusCB)
750946 {
....@@ -859,7 +1055,9 @@
8591055 // objEditor.DropFile((java.io.File[]) object, true);
8601056 // return;
8611057 // }
862
- if (string.charAt(0) == '/')
1058
+
1059
+ // File path for Mac and Windows
1060
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8631061 {
8641062 // file(s)
8651063 String[] names = string.split("\n");
....@@ -886,7 +1084,7 @@
8861084
8871085 flashIt = false;
8881086 CameraPane pane = (CameraPane) target;
889
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1087
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8901088 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8911089
8921090 if (group.selection.size() == 1)
....@@ -913,11 +1111,11 @@
9131111 {
9141112 loadClipboard(true);
9151113 objEditor.jTree.setSelectionPath(destinationPath);
916
- pasteInto(false);
1114
+ pasteInto(false, false);
9171115 } else {
9181116 loadClipboard(false);
9191117 objEditor.jTree.setSelectionPath(destinationPath);
920
- pasteInto(false); // true); // ???
1118
+ pasteInto(false, false); // true); // ???
9211119 }
9221120 }
9231121 public void dropActionChanged(DropTargetDragEvent dtde)
....@@ -1035,29 +1233,37 @@
10351233 torusItem.addActionListener(this);
10361234 superItem = menu.add(new MenuItem("Superellipsoid"));
10371235 superItem.addActionListener(this);
1236
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1237
+ kleinItem.addActionListener(this);
10381238 particleItem = menu.add(new MenuItem("Particle system"));
10391239 particleItem.addActionListener(this);
1240
+ if (Globals.ADVANCED)
1241
+ {
10401242 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10411243 ragdollItem.addActionListener(this);
10421244 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10431245 ragdoll2Item.addActionListener(this);
1246
+ }
10441247 menu.add("-");
1045
- meshItem = menu.add(new MenuItem("Mesh"));
1248
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10461249 meshItem.addActionListener(this);
10471250 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10481251 // meshGroupItem.addActionListener(this);
1252
+ if (Globals.ADVANCED)
1253
+ {
10491254 springItem = menu.add(new MenuItem("Spring"));
10501255 springItem.addActionListener(this);
10511256 flagItem = menu.add(new MenuItem("Flag"));
10521257 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);
10571258 blobItem = menu.add(new MenuItem("Blob"));
10581259 blobItem.addActionListener(this);
10591260 latheItem = menu.add(new MenuItem("Lathe"));
10601261 latheItem.addActionListener(this);
1262
+ }
1263
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1264
+ bezierItem.addActionListener(this);
1265
+ overlayItem = menu.add(new MenuItem("Overlay"));
1266
+ overlayItem.addActionListener(this);
10611267 lightItem = menu.add(new MenuItem("Light"));
10621268 lightItem.addActionListener(this);
10631269 menu.add("-");
....@@ -1067,39 +1273,44 @@
10671273 loopItem.addActionListener(this);
10681274 doubleItem = menu.add(new MenuItem("Fork"));
10691275 doubleItem.addActionListener(this);
1276
+ if (Globals.ADVANCED)
1277
+ {
10701278 tripleItem = menu.add(new MenuItem("Trident"));
10711279 tripleItem.addActionListener(this);
1280
+ }
10721281 }
10731282
10741283 void buildToolsMenu(Menu menu)
10751284 {
10761285 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10771286 animationItem.addItemListener(this);
1078
- animationItem.setState(CameraPane.ANIMATION);
1287
+ animationItem.setState(Globals.ANIMATION);
10791288
10801289 menu.add("-");
10811290 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10821291 parseverticesItem.addActionListener(this);
10831292 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10841293 textureFieldItem.addActionListener(this);
1085
- alignItem = menu.add(new MenuItem("Align"));
1294
+ alignItem = menu.add(new MenuItem("Align Objects"));
10861295 alignItem.addActionListener(this);
1087
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1088
- mirrorItem.addActionListener(this);
10891296 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10901297 reduceMorphItem.addActionListener(this);
10911298 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10921299 reduce34MorphItem.addActionListener(this);
1093
-
1300
+ menu.add("-");
10941301 menu.add(computeAOItem = new MenuItem("Compute AO"));
10951302 computeAOItem.addActionListener(this);
1096
- menu.add("-");
10971303
1304
+ if (Globals.ADVANCED)
1305
+ {
1306
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1307
+ mirrorItem.addActionListener(this);
1308
+ menu.add("-");
10981309 menu.add(memoryItem = new MenuItem("Memory Usage"));
10991310 memoryItem.addActionListener(this);
11001311 menu.add(analyzeItem = new MenuItem("Analyze"));
11011312 analyzeItem.addActionListener(this);
1102
- menu.add(dumpItem = new MenuItem("Dump"));
1313
+ menu.add(dumpItem = new MenuItem("Print"));
11031314 dumpItem.addActionListener(this);
11041315 // menu.add(pathItem = new MenuItem("From-to path"));
11051316 // pathItem.addActionListener(this);
....@@ -1108,6 +1319,8 @@
11081319 resetParentItem.addActionListener(this);
11091320 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11101321 repairParentItem.addActionListener(this);
1322
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1323
+ repairShadowItem.addActionListener(this);
11111324 menu.add(invariantsItem = new MenuItem("Invariants"));
11121325 invariantsItem.addActionListener(this);
11131326 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1115,6 +1328,7 @@
11151328 menu.add("-");
11161329 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11171330 editScriptItem.addActionListener(this);
1331
+ }
11181332 }
11191333
11201334 void ScreenFit()
....@@ -1237,6 +1451,7 @@
12371451 shadow.material = new cMaterial(obj.material);
12381452 shadow.material.diffuse = 0.0001f;
12391453 shadow.material.specular = 0.0001f;
1454
+ //shadow.projectedVertices[1].x = 300;
12401455
12411456 makeSomething(shadow);
12421457 }
....@@ -1443,9 +1658,9 @@
14431658
14441659 void Overwrite(int mask)
14451660 {
1446
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1661
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14471662 {
1448
- Object3D content = GrafreeD.clipboard.get(0);
1663
+ Object3D content = Grafreed.clipboard.get(0);
14491664
14501665 if (content instanceof cGroup && ((cGroup)content).transientlink )
14511666 content = ((cGroup)content).get(0);
....@@ -1468,6 +1683,7 @@
14681683 //
14691684 public void actionPerformed(ActionEvent event) // , Object arg)
14701685 {
1686
+ Object source = event.getSource();
14711687 /*
14721688 if (event.getSource() == nameField)
14731689 {
....@@ -1479,11 +1695,11 @@
14791695 }
14801696 else
14811697 */
1482
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1698
+ if (source == lookAtItem || source == lookFromItem)
14831699 {
14841700 ScreenFit();
14851701 } else
1486
- if (event.getSource() == switchItem)
1702
+ if (source == switchItem)
14871703 {
14881704 cVector v1 = new cVector();
14891705 cVector v2 = new cVector();
....@@ -1492,11 +1708,11 @@
14921708 objEditor.cameraView.renderCamera.setAim(v2, v1);
14931709 objEditor.cameraView.repaint();
14941710 } else
1495
- if (event.getSource() == rectoidItem)
1711
+ if (source == rectoidItem)
14961712 {
14971713 makeSomething(new Box());
14981714 } else
1499
- if (event.getSource() == particleItem)
1715
+ if (source == particleItem)
15001716 {
15011717 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15021718 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1517,9 +1733,9 @@
15171733 applyExample(particleGeom, "SMOKE");
15181734 makeSomething(particleGeom);
15191735 } else
1520
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1736
+ if (source == ragdollItem || source == ragdoll2Item)
15211737 {
1522
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1738
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15231739
15241740 ragdoll.toParent = LA.newMatrix();
15251741 ragdoll.fromParent = LA.newMatrix();
....@@ -1537,7 +1753,7 @@
15371753 } else
15381754 /*
15391755 */
1540
- if (event.getSource() == heightFieldItem)
1756
+ if (source == heightFieldItem)
15411757 {
15421758 Object3D obj = new Object3D();
15431759
....@@ -1575,27 +1791,31 @@
15751791
15761792 makeSomething(obj);
15771793 } else
1578
- if (event.getSource() == gridItem)
1794
+ if (source == gridItem)
15791795 {
15801796 makeSomething(new Grid());
15811797 } else
1582
- if (event.getSource() == ellipsoidItem)
1798
+ if (source == ellipsoidItem)
15831799 {
15841800 makeSomething(new Sphere());
15851801 } else
1586
- if (event.getSource() == coneItem)
1802
+ if (source == coneItem)
15871803 {
15881804 makeSomething(new Cone());
15891805 } else
1590
- if (event.getSource() == torusItem)
1806
+ if (source == torusItem)
15911807 {
15921808 makeSomething(new Torus());
15931809 } else
1594
- if (event.getSource() == superItem)
1810
+ if (source == superItem)
15951811 {
15961812 makeSomething(new Superellipsoid());
15971813 } else
1598
- if (event.getSource() == blobItem)
1814
+ if (source == kleinItem)
1815
+ {
1816
+ makeSomething(new Klein());
1817
+ } else
1818
+ if (source == blobItem)
15991819 {
16001820 Blob blob = new Blob();
16011821 BlobComponent comp = new BlobComponent();
....@@ -1603,15 +1823,15 @@
16031823 //blob.retile();
16041824 makeSomething(blob);
16051825 } else
1606
- if (event.getSource() == latheItem)
1826
+ if (source == latheItem)
16071827 {
16081828 makeSomething(new Lathe());
16091829 } else
1610
- if (event.getSource() == bezierItem)
1830
+ if (source == bezierItem)
16111831 {
16121832 makeSomething(new BezierSurface());
16131833 } else
1614
- if (event.getSource() == checkerItem)
1834
+ if (source == overlayItem)
16151835 {
16161836 /*
16171837 Object3D obj = new BezierSurface(5,8);
....@@ -1626,7 +1846,7 @@
16261846 */
16271847 makeSomething(new Checker());
16281848 } else
1629
- if (event.getSource() == meshItem)
1849
+ if (source == meshItem)
16301850 {
16311851 Object3D itemtomake = new Object3D();
16321852 Object3D child;
....@@ -1647,35 +1867,35 @@
16471867 makeSomething(child);
16481868 }
16491869 } else
1650
- if (event.getSource() == springItem)
1870
+ if (source == springItem)
16511871 {
16521872 cSpring s = new cSpring();
16531873 s.setup();
16541874 makeSomething(s);
16551875 } else
1656
- if (event.getSource() == flagItem)
1876
+ if (source == flagItem)
16571877 {
16581878 cSpring s = new cFlag();
16591879 s.setup();
16601880 makeSomething(s);
16611881 } else
1662
- if (event.getSource() == lightItem)
1882
+ if (source == lightItem)
16631883 {
16641884 makeSomething(new Light());
16651885 } else
1666
- if (event.getSource() == csgItem)
1886
+ if (source == csgItem)
16671887 {
16681888 group(new CSG());
16691889 } else
1670
- if (event.getSource() == templateItem)
1890
+ if (source == templateItem)
16711891 {
16721892 group(new cTemplate());
16731893 } else
1674
- if (event.getSource() == attributeItem)
1894
+ if (source == attributeItem)
16751895 {
16761896 makeSomething(new Attribute());
16771897 } else
1678
- if (event.getSource() == pointflowItem)
1898
+ if (source == pointflowItem)
16791899 {
16801900 makeSomething(new PointFlow());
16811901 } else
....@@ -1687,7 +1907,7 @@
16871907 } else
16881908 */
16891909
1690
- if (event.getSource() == superLoopItem)
1910
+ if (source == superLoopItem)
16911911 {
16921912 Composite g = new cGroup();
16931913 for (int i=0; i<15; i++)
....@@ -1709,7 +1929,7 @@
17091929
17101930 group(g);
17111931 } else
1712
- if (event.getSource() == loopItem)
1932
+ if (source == loopItem)
17131933 {
17141934 Composite csg = new GroupLeaf();
17151935 csg.count = 5;
....@@ -1718,7 +1938,7 @@
17181938 csg.addChild(child);
17191939 child.addChild(csg);
17201940 } else
1721
- if (event.getSource() == doubleItem)
1941
+ if (source == doubleItem)
17221942 {
17231943 Composite csg = new GroupLeaf();
17241944 csg.count = 5;
....@@ -1730,7 +1950,7 @@
17301950 csg.addChild(child);
17311951 child.addChild(csg);
17321952 } else
1733
- if (event.getSource() == tripleItem)
1953
+ if (source == tripleItem)
17341954 {
17351955 Composite csg = new GroupLeaf();
17361956 csg.count = 4;
....@@ -1745,71 +1965,83 @@
17451965 csg.addChild(child);
17461966 child.addChild(csg);
17471967 } else
1748
-
1749
- if (event.getSource() == importGFDItem)
1968
+ if (source == computeAOItem)
17501969 {
1751
- ImportGFD();
1970
+ Globals.drawMode = CameraPane.OCCLUSION;
1971
+ Globals.theRenderer.repaint();
17521972 } 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)
1973
+ if (source == recompileItem)
17711974 {
17721975 Recompile();
17731976 refreshContents();
17741977 } else
1775
- if (event.getSource() == editScriptItem)
1978
+ if (source == editScriptItem)
17761979 {
17771980 OpenDialog();
17781981 refreshContents();
17791982 } else
1780
- if (event.getSource() == invariantsItem)
1983
+ if (source == invariantsItem)
17811984 {
17821985 System.out.println("Invariants:");
1783
- GrafreeD.theApplet3D.universe.invariants();
1986
+ Grafreed.grafreeD.universe.invariants();
17841987 } else
1785
- if (event.getSource() == memoryItem)
1988
+ if (source == memoryItem)
17861989 {
17871990 //System.out.println("Invariants:");
17881991 PrintMemory();
17891992 } else
1790
- if (event.getSource() == pathItem)
1993
+ if (source == pathItem)
17911994 {
17921995 PrintPath();
17931996 } else
1794
- if (event.getSource() == analyzeItem)
1997
+ if (source == analyzeItem)
17951998 {
17961999 AnalyzeObject();
17972000 } else
1798
- if (event.getSource() == dumpItem)
2001
+ if (source == dumpItem)
17992002 {
18002003 DumpObject();
18012004 } else
1802
- if (event.getSource() == screenfitButton)
2005
+ if (source == minButton)
2006
+ {
2007
+ Minimize();
2008
+ } else
2009
+ if (source == maxButton)
2010
+ {
2011
+ Maximize();
2012
+ } else
2013
+ if (source == fullButton)
2014
+ {
2015
+ ToggleFullScreen();
2016
+ } else
2017
+ if (source == undoButton)
2018
+ {
2019
+ Undo();
2020
+ } else
2021
+ if (source == redoButton)
2022
+ {
2023
+ Redo();
2024
+ } else
2025
+ if (source == saveButton)
2026
+ {
2027
+ Save();
2028
+ } else
2029
+ if (source == oneStepButton)
2030
+ {
2031
+ Globals.ONESTEP = true;
2032
+ cameraView.repaint();
2033
+ } else
2034
+ if (source == screenfitButton)
18032035 {
18042036 //Reload(lastConverter, lastFilename, true);
18052037 ScreenFit();
18062038 } else
1807
- if (event.getSource() == screenfitpointButton)
2039
+ if (source == screenfitpointButton)
18082040 {
18092041 //Reload(lastConverter, lastFilename, true);
18102042 ScreenFitPoint();
18112043 } else
1812
- if (event.getSource() == snapobjectButton)
2044
+ if (source == snapobjectButton)
18132045 {
18142046 //Reload(lastConverter, lastFilename, true);
18152047 SnapObject();
....@@ -1820,13 +2052,13 @@
18202052 // Recompile();
18212053 // refreshContents();
18222054 // } else
1823
- if (event.getSource() == gcButton)
2055
+ if (source == gcButton)
18242056 {
18252057 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262058 System.gc();
18272059 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18282060 } else
1829
- if (event.getSource() == editLeafItem)
2061
+ if (source == editLeafItem)
18302062 {
18312063 Object3D obj;
18322064 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1840,62 +2072,74 @@
18402072 }
18412073 refreshContents(true);
18422074 } else
1843
- if (event.getSource() == openWindowItem)
2075
+ if (source == openWindowItem)
18442076 {
18452077 EditSelection(true);
18462078 } else
1847
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2079
+ if (source == cutItem || source == clearButton)
18482080 {
18492081 loadClipboard(true);
18502082 } else
1851
- if (event.getSource() == duplicateItem)
2083
+ if (source == undoItem)
18522084 {
1853
- Object3D keep = GrafreeD.clipboard;
2085
+ Undo();
2086
+ } else
2087
+ if (source == redoItem)
2088
+ {
2089
+ Redo();
2090
+ } else
2091
+ if (source == duplicateItem)
2092
+ {
2093
+ Object3D keep = Grafreed.clipboard;
18542094 loadClipboard(false);
18552095 paste(false);
1856
- GrafreeD.clipboard = keep;
2096
+ Grafreed.clipboard = keep;
18572097 } else
1858
- if (event.getSource() == cloneItem)
2098
+ if (source == cloneItem)
18592099 {
18602100 CloneSelection(false);
18612101 } else
1862
- if (event.getSource() == cloneSupportItem)
2102
+ if (source == cloneSupportItem)
18632103 {
18642104 CloneSelection(true);
18652105 } else
1866
- if (event.getSource() == copyItem)
2106
+ if (source == copyItem)
18672107 {
18682108 loadClipboard(false);
18692109 } else
1870
- if (event.getSource() == pasteItem)
2110
+ if (source == pasteItem)
18712111 {
18722112 paste(false);
18732113 } else
1874
- if (event.getSource() == pasteLinkItem)
2114
+ if (source == pasteIntoItem)
18752115 {
1876
- pasteInto(false);
2116
+ pasteInto(true, false);
18772117 } else
1878
- if (event.getSource() == pasteCloneItem)
2118
+ if (source == pasteLinkItem)
18792119 {
1880
- pasteInto(true);
2120
+ pasteInto(false, false);
18812121 } else
1882
- if (event.getSource() == pasteExpandItem)
2122
+ if (source == pasteCloneItem)
2123
+ {
2124
+ pasteInto(true, true);
2125
+ } else
2126
+ if (source == pasteExpandItem)
18832127 {
18842128 paste(true);
18852129 } else
1886
- if (event.getSource() == synchronizeItem)
2130
+ if (source == synchronizeItem)
18872131 {
18882132 Overwrite(Object3D.TRANSFORM);
18892133 } else
1890
- if (event.getSource() == overwriteNameItem)
2134
+ if (source == overwriteNameItem)
18912135 {
18922136 Overwrite(Object3D.NAME);
18932137 } else
1894
- if (event.getSource() == overwriteUVItem)
2138
+ if (source == overwriteUVItem)
18952139 {
18962140 Overwrite(Object3D.UV);
18972141 } else
1898
- if (event.getSource() == overwriteMatItem)
2142
+ if (source == overwriteMatItem)
18992143 {
19002144 /* july 2015
19012145 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1915,7 +2159,7 @@
19152159
19162160 Overwrite(dropAttributes);
19172161 }
1918
- if (event.getSource() == overwriteGeoItem)
2162
+ if (source == overwriteGeoItem)
19192163 {
19202164 Overwrite(Object3D.GEOMETRY);
19212165 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1932,7 +2176,7 @@
19322176 // refreshContents();
19332177 // }
19342178 } else
1935
- if (event.getSource() == generateMeshItem)
2179
+ if (source == generateMeshItem)
19362180 {
19372181 //if (group.selection.size() == 1)
19382182 // for (int i=0; i<group.selection.size(); i++)
....@@ -1943,7 +2187,7 @@
19432187 ResetModel();
19442188 refreshContents();
19452189 } else
1946
- if (event.getSource() == extractGeometriesItem)
2190
+ if (source == extractGeometriesItem)
19472191 {
19482192 boolean one = false;
19492193
....@@ -1970,7 +2214,7 @@
19702214 ResetModel();
19712215 refreshContents();
19722216 } else
1973
- if (event.getSource() == cloneGeometriesItem)
2217
+ if (source == cloneGeometriesItem)
19742218 {
19752219 boolean one = false;
19762220
....@@ -1996,32 +2240,37 @@
19962240 ResetModel();
19972241 refreshContents();
19982242 } else
1999
- if (event.getSource() == shareGeometriesItem)
2243
+ if (source == shareGeometriesItem)
20002244 {
20012245 boolean one = false;
20022246
20032247 if (group.selection.size() == 1)
20042248 one = true;
20052249
2250
+ Object3D merge = null;
2251
+
20062252 Object3D content = new cGroup();
20072253
20082254 for (int i=0; i<group.selection.size(); i++)
20092255 {
2010
- Object3D sel = new Merge(group.selection.get(i));
2256
+ merge = new Merge(group.selection.get(i));
20112257
20122258 if (one)
2013
- makeSomething(sel, false);
2259
+ makeSomething(merge, false);
20142260 else
2015
- content.addChild(sel);
2261
+ content.addChild(merge);
20162262 }
20172263
20182264 if (!one)
2019
- makeSomething(content, false);
2020
-
2021
- ResetModel();
2022
- refreshContents();
2265
+ makeSomething(content, true);
2266
+ else
2267
+ {
2268
+ ResetModel();
2269
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2270
+ refreshContents();
2271
+ }
20232272 } else
2024
- if (event.getSource() == mergeGeometriesItem)
2273
+ if (source == mergeGeometriesItem)
20252274 {
20262275 boolean one = false;
20272276
....@@ -2051,7 +2300,7 @@
20512300 ResetModel();
20522301 refreshContents();
20532302 } else
2054
- if (event.getSource() == linkverticesItem)
2303
+ if (source == linkverticesItem)
20552304 {
20562305 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20572306 // {
....@@ -2064,39 +2313,48 @@
20642313 // group.selection.get(0).setMasterThis(content); // should be identity
20652314 // refreshContents();
20662315 // }
2067
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2316
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20682317 {
2069
- Object3D content = GrafreeD.clipboard.get(0);
2318
+ Object3D content = Grafreed.clipboard.get(0);
20702319
20712320 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722321 content = ((cGroup)content).get(0);
20732322
2074
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2323
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20752324 for (int i=0; i<group.selection.size(); i++)
20762325 {
2077
- boolean random = CameraPane.RANDOM;
2078
- CameraPane.RANDOM = false; // parse all random nodes
2326
+ boolean random = CameraPane.SWITCH;
2327
+ CameraPane.SWITCH = false; // parse all random nodes
20792328 group.selection.get(i).linkVerticesThis(content);
20802329 // group.selection.get(i).setMasterThis(content); // should be identity
2081
- CameraPane.RANDOM = random;
2330
+ CameraPane.SWITCH = random;
20822331 }
2083
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2332
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20842333 refreshContents();
20852334 }
20862335 } else
2087
- if (event.getSource() == resetsupportItem)
2336
+ if (source == resetsupportItem)
20882337 {
20892338 for (int i=0; i<group.selection.size(); i++)
20902339 {
2091
- boolean random = CameraPane.RANDOM;
2092
- CameraPane.RANDOM = false; // parse all random nodes
2340
+ boolean random = CameraPane.SWITCH;
2341
+ CameraPane.SWITCH = false; // parse all random nodes
20932342 group.selection.get(i).linkVerticesThis(null);
2094
- CameraPane.RANDOM = random;
2343
+ CameraPane.SWITCH = random;
20952344 }
20962345
20972346 refreshContents();
20982347 } else
2099
- if (event.getSource() == resetreferencesItem)
2348
+ if (source == relinkverticesItem)
2349
+ {
2350
+ boolean random = CameraPane.SWITCH;
2351
+ CameraPane.SWITCH = false; // parse all random nodes
2352
+ group.selection.RelinkToSupport();
2353
+ CameraPane.SWITCH = random;
2354
+
2355
+ refreshContents();
2356
+ } else
2357
+ if (source == resetreferencesItem)
21002358 {
21012359 for (int i=0; i<group.selection.size(); i++)
21022360 {
....@@ -2105,11 +2363,11 @@
21052363
21062364 refreshContents();
21072365 } else
2108
- if (event.getSource() == setMasterItem)
2366
+ if (source == setMasterItem)
21092367 {
2110
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2368
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21112369 {
2112
- Object3D content = GrafreeD.clipboard.get(0);
2370
+ Object3D content = Grafreed.clipboard.get(0);
21132371
21142372 if (content instanceof cGroup && ((cGroup)content).transientlink )
21152373 content = ((cGroup)content).get(0);
....@@ -2118,13 +2376,13 @@
21182376 refreshContents();
21192377 }
21202378 } else
2121
- if (event.getSource() == poseMeshItem)
2379
+ if (source == poseMeshItem)
21222380 {
21232381 if (group.selection.size() == 1)
21242382 {
2125
- if (GrafreeD.clipboard.size() == 1)
2383
+ if (Grafreed.clipboard.size() == 1)
21262384 {
2127
- Object3D content = GrafreeD.clipboard.get(0);
2385
+ Object3D content = Grafreed.clipboard.get(0);
21282386
21292387 if (content instanceof cGroup && ((cGroup)content).transientlink )
21302388 content = ((cGroup)content).get(0);
....@@ -2137,19 +2395,19 @@
21372395 }
21382396
21392397 } else
2140
- if (event.getSource() == revertMeshItem)
2398
+ if (source == revertMeshItem)
21412399 {
21422400 RevertMeshes();
21432401 } else
2144
- if (event.getSource() == resetMeshItem)
2402
+ if (source == resetAllItem)
21452403 {
21462404 ResetAll();
21472405 } else
2148
- if (event.getSource() == stepAllItem)
2406
+ if (source == stepAllItem)
21492407 {
21502408 StepAll();
21512409 } else
2152
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2410
+ if (source == clearItem) // || event.getSource() == clearButton)
21532411 {
21542412 //int indices[] = jList.getSelectedIndices();
21552413 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2157,42 +2415,46 @@
21572415
21582416 ClearSelection(false);
21592417 } else
2160
- if (event.getSource() == clearAllItem)
2418
+ if (source == clearAllItem)
21612419 {
21622420 ClearSelection(true);
21632421 } else
2164
- if (event.getSource() == grabItem)
2422
+ if (source == grabItem)
21652423 {
21662424 group(new cGroup(), true);
21672425 } else
2168
- if (event.getSource() == frontItem)
2426
+ if (source == hideItem)
2427
+ {
2428
+ group(new HiddenObject());
2429
+ } else
2430
+ if (source == frontItem)
21692431 {
21702432 front();
21712433 } else
2172
- if (event.getSource() == backItem)
2434
+ if (source == backItem)
21732435 {
21742436 back();
21752437 } else
2176
- if (event.getSource() == cameraItem)
2438
+ if (source == cameraItem)
21772439 {
21782440 makeSomething(new Camera());
21792441 } else
2180
- if (event.getSource() == compositeItem)
2442
+ if (source == compositeItem)
21812443 {
21822444 group(new Composite());
21832445 } else
2184
- if (event.getSource() == randomItem)
2446
+ if (source == randomItem)
21852447 {
21862448 RandomNode random = new RandomNode();
21872449 group(random);
21882450 if (random.size() > 0)
2189
- random.name = random.get(0).name + "Rnd";
2451
+ random.name = random.get(0).name + "Switch";
21902452 } else
2191
- if (event.getSource() == physicsItem)
2453
+ if (source == physicsItem)
21922454 {
21932455 group(new PhysicsNode());
21942456 } else
2195
- if (event.getSource() == frameselectorItem)
2457
+ if (source == frameselectorItem)
21962458 {
21972459 for (int i=0; i<group.selection.size(); i++)
21982460 {
....@@ -2204,7 +2466,7 @@
22042466 ResetModel();
22052467 refreshContents();
22062468 } else
2207
- if (event.getSource() == switchGeoItem)
2469
+ if (source == switchGeoItem)
22082470 {
22092471 for (int i=0; i<group.selection.size(); i++)
22102472 {
....@@ -2216,7 +2478,7 @@
22162478 ResetModel();
22172479 refreshContents();
22182480 } else
2219
- if (event.getSource() == switchTransfoItem)
2481
+ if (source == switchTransfoItem)
22202482 {
22212483 for (int i=0; i<group.selection.size(); i++)
22222484 {
....@@ -2228,7 +2490,7 @@
22282490 ResetModel();
22292491 refreshContents();
22302492 } else
2231
- if (event.getSource() == morphItem)
2493
+ if (source == morphItem)
22322494 {
22332495 for (int i=0; i<group.selection.size(); i++)
22342496 {
....@@ -2240,7 +2502,7 @@
22402502 ResetModel();
22412503 refreshContents();
22422504 } else
2243
- if (event.getSource() == scriptNodeItem)
2505
+ if (source == scriptNodeItem)
22442506 {
22452507 boolean atleastone = false;
22462508
....@@ -2279,199 +2541,239 @@
22792541 }
22802542 }
22812543 } else
2282
- if (event.getSource() == linkerItem)
2544
+ if (source == linkerItem)
22832545 {
22842546 group(new cLinker());
22852547 } else
2286
- if (event.getSource() == textureItem)
2548
+ if (source == textureItem)
22872549 {
22882550 group(new TextureNode());
22892551 } else
2290
- if (event.getSource() == shadowXItem)
2552
+ if (source == billboardItem)
2553
+ {
2554
+ group(new BillboardNode());
2555
+ } else
2556
+ if (source == shadowXItem)
22912557 {
22922558 CastShadow(0);
22932559 } else
2294
- if (event.getSource() == shadowYItem)
2560
+ if (source == shadowYItem)
22952561 {
22962562 CastShadow(1);
22972563 } else
2298
- if (event.getSource() == shadowZItem)
2564
+ if (source == shadowZItem)
22992565 {
23002566 CastShadow(2);
23012567 } else
2302
- if (event.getSource() == ungroupItem)
2568
+ if (source == ungroupItem)
23032569 {
2304
- ungroup();
2570
+ //ungroup();
2571
+ for (int i=0; i<group.selection.size(); i++)
2572
+ {
2573
+ Ungroup(group.selection.get(i));
2574
+ }
2575
+
2576
+ ClearSelection(false);
2577
+
2578
+ refreshContents();
23052579 } else
2306
- if (event.getSource() == genUVItem)
2580
+ if (source == genUVItem)
23072581 {
23082582 GenUV();
23092583 } else
2310
- if (event.getSource() == genNormalsCADItem)
2584
+ if (source == genNormalsCADItem)
23112585 {
23122586 GenNormals(true);
23132587 } else
2314
- if (event.getSource() == genNormalsMESHItem)
2588
+ if (source == genNormalsMESHItem)
23152589 {
2316
- GenNormals(true); // TODO
2590
+ GenNormalsMESH();
23172591 } else
2318
- if (event.getSource() == genNormalsORGANItem)
2592
+ if (source == genNormalsORGANItem)
23192593 {
23202594 GenNormals(false);
23212595 } else
2322
- if (event.getSource() == stripifyItem)
2596
+ if (source == genNormalsMINEItem)
2597
+ {
2598
+ GenNormalsMINE();
2599
+ } else
2600
+ if (source == stripifyItem)
23232601 {
23242602 Stripify();
23252603 } else
2326
- if (event.getSource() == unstripifyItem)
2604
+ if (source == unstripifyItem)
23272605 {
23282606 Unstripify();
23292607 } else
2330
- if (event.getSource() == trimItem)
2608
+ if (source == trimItem)
23312609 {
23322610 Trim();
23332611 } else
2334
- if (event.getSource() == untrimItem)
2612
+ if (source == untrimItem)
23352613 {
23362614 Untrim();
23372615 } else
2338
- if (event.getSource() == clearColorsItem)
2616
+ if (source == clearColorsItem)
23392617 {
23402618 ClearColors();
23412619 } else
2342
- if (event.getSource() == clearMaterialsItem)
2620
+ if (source == clearMaterialsItem)
23432621 {
23442622 ClearMaterials();
23452623 } else
2346
- if (event.getSource() == liveleavesItem)
2624
+ if (source == liveleavesItem)
23472625 {
23482626 LiveLeaves(true);
23492627 } else
2350
- if (event.getSource() == unliveleavesItem)
2628
+ if (source == unliveleavesItem)
23512629 {
23522630 LiveLeaves(false);
23532631 } else
2354
- if (event.getSource() == supportleavesItem)
2632
+ if (source == supportleavesItem)
23552633 {
23562634 SupportLeaves(true);
23572635 } else
2358
- if (event.getSource() == unsupportleavesItem)
2636
+ if (source == unsupportleavesItem)
23592637 {
23602638 SupportLeaves(false);
23612639 } else
2362
- if (event.getSource() == hideleavesItem)
2640
+ if (source == hideleavesItem)
23632641 {
23642642 HideLeaves(true);
23652643 } else
2366
- if (event.getSource() == showleavesItem)
2644
+ if (source == showleavesItem)
23672645 {
23682646 HideLeaves(false);
23692647 } else
2370
- if (event.getSource() == markleavesItem)
2648
+ if (source == markleavesItem)
23712649 {
23722650 MarkLeaves(true);
23732651 } else
2374
- if (event.getSource() == unmarkleavesItem)
2652
+ if (source == unmarkleavesItem)
23752653 {
23762654 MarkLeaves(false);
23772655 } else
2378
- if (event.getSource() == flipVItem)
2656
+ if (source == rewindleavesItem)
2657
+ {
2658
+ RewindLeaves(true);
2659
+ } else
2660
+ if (source == unrewindleavesItem)
2661
+ {
2662
+ RewindLeaves(false);
2663
+ } else
2664
+ if (source == randomleavesItem)
2665
+ {
2666
+ RandomLeaves(true);
2667
+ } else
2668
+ if (source == unrandomleavesItem)
2669
+ {
2670
+ RandomLeaves(false);
2671
+ } else
2672
+ if (source == flipVItem)
23792673 {
23802674 FlipV(true);
23812675 } else
2382
- if (event.getSource() == unflipVItem)
2676
+ if (source == unflipVItem)
23832677 {
23842678 FlipV(false);
23852679 } else
2386
- if (event.getSource() == lowTexturesItem)
2680
+ if (source == lowTexturesItem)
23872681 {
23882682 SetTexRes(0);
23892683 } else
2390
- if (event.getSource() == normalTexturesItem)
2684
+ if (source == normalTexturesItem)
23912685 {
23922686 SetTexRes(1);
23932687 } else
2394
- if (event.getSource() == highTexturesItem)
2688
+ if (source == highTexturesItem)
23952689 {
23962690 SetTexRes(2);
23972691 } else
2398
- if (event.getSource() == veryhighTexturesItem)
2692
+ if (source == veryhighTexturesItem)
23992693 {
24002694 SetTexRes(3);
24012695 } else
2402
- if (event.getSource() == maxTexturesItem)
2696
+ if (source == maxTexturesItem)
24032697 {
24042698 SetTexRes(4);
24052699 } else
2406
- if (event.getSource() == panoTexturesItem)
2700
+ if (source == panoTexturesItem)
24072701 {
24082702 SetTexRes(5);
24092703 } else
2410
- if (event.getSource() == reverseNormalsItem)
2704
+ if (source == reverseNormalsItem)
24112705 {
24122706 ReverseNormals();
24132707 } else
2414
- if (event.getSource() == parseverticesItem)
2708
+ if (source == parseverticesItem)
24152709 {
24162710 ParseVertices();
24172711 } else
2418
- if (event.getSource() == textureFieldItem)
2712
+ if (source == textureFieldItem)
24192713 {
24202714 TextureVertices();
24212715 } else
2422
- if (event.getSource() == alignItem)
2716
+ if (source == alignItem)
24232717 {
24242718 Align();
24252719 } else
2426
- if (event.getSource() == mirrorItem)
2720
+ if (source == mirrorItem)
24272721 {
24282722 MirrorPoses();
24292723 } else
2430
- if (event.getSource() == reduceMorphItem)
2724
+ if (source == reduceMorphItem)
24312725 {
24322726 MeshReduction(false);
24332727 } else
2434
- if (event.getSource() == reduce34MorphItem)
2728
+ if (source == reduce34MorphItem)
24352729 {
24362730 MeshReduction(true);
24372731 } else
2438
- if (event.getSource() == reverseTrianglesItem)
2732
+ if (source == reverseTrianglesItem)
24392733 {
24402734 ReverseTriangles();
24412735 } else
2442
- if (event.getSource() == reduceMeshItem)
2736
+ if (source == reduceMeshItem)
24432737 {
24442738 ReduceMesh(false);
24452739 } else
2446
- if (event.getSource() == reduce34MeshItem)
2740
+ if (source == reduce34MeshItem)
24472741 {
24482742 ReduceMesh(true);
24492743 } else
2450
- if (event.getSource() == increaseMeshItem)
2744
+ if (source == increaseMeshItem)
24512745 {
24522746 IncreaseMesh();
24532747 } else
2454
- if (event.getSource() == clipMeshItem)
2748
+ if (source == clipMeshItem)
24552749 {
24562750 ClipMesh();
24572751 } else
2458
- if (event.getSource() == smoothMeshItem)
2752
+ if (source == smoothMeshItem)
24592753 {
24602754 SmoothMesh();
24612755 } else
2462
- if (event.getSource() == transformgeometryItem)
2756
+ if (source == transformGeometryItem)
24632757 {
24642758 TransformGeometry();
24652759 } else
2466
- if (event.getSource() == resetTransformItem)
2760
+ if (source == transformChildrenItem)
2761
+ {
2762
+ TransformChildren();
2763
+ } else
2764
+ if (source == resetTransformItem)
24672765 {
24682766 ResetTransform();
24692767 } else
2470
- if (event.getSource() == resetCentroidItem)
2768
+ if (source == resetCentroidItem)
24712769 {
2472
- ResetCentroid();
2770
+ ResetCentroid(true);
24732771 } else
2474
- if (event.getSource() == resetParentItem)
2772
+ if (source == resetCentroidXZItem)
2773
+ {
2774
+ ResetCentroid(false);
2775
+ } else
2776
+ if (source == resetParentItem)
24752777 {
24762778 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24772779 {
....@@ -2481,7 +2783,7 @@
24812783
24822784 refreshContents();
24832785 } else
2484
- if (event.getSource() == repairParentItem)
2786
+ if (source == repairParentItem)
24852787 {
24862788 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24872789 {
....@@ -2495,7 +2797,21 @@
24952797
24962798 refreshContents();
24972799 } else
2498
- if (event.getSource() == sortbysizeItem)
2800
+ if (source == repairShadowItem)
2801
+ {
2802
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
2803
+ {
2804
+ Object3D obj = (Object3D)e.nextElement();
2805
+ obj.RepairShadow();
2806
+// for (int i=0; i<obj.size(); i++)
2807
+// {
2808
+// obj.get(i).parent = obj;
2809
+// }
2810
+ }
2811
+
2812
+ refreshContents();
2813
+ } else
2814
+ if (source == sortbysizeItem)
24992815 {
25002816 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25012817 {
....@@ -2507,7 +2823,7 @@
25072823 ResetModel();
25082824 refreshContents();
25092825 } else
2510
- if (event.getSource() == sortbynameItem)
2826
+ if (source == sortbynameItem)
25112827 {
25122828 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25132829 {
....@@ -2519,7 +2835,7 @@
25192835 ResetModel();
25202836 refreshContents();
25212837 } else
2522
- if (event.getSource() == attachPigmentItem)
2838
+ if (source == attachPigmentItem)
25232839 {
25242840 String texture = GetFile("Attach pigment");
25252841 Object3D obj;
....@@ -2531,7 +2847,7 @@
25312847
25322848 refreshContents();
25332849 } else
2534
- if (event.getSource() == detachPigmentItem)
2850
+ if (source == detachPigmentItem)
25352851 {
25362852 Object3D obj;
25372853 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2542,7 +2858,7 @@
25422858
25432859 refreshContents();
25442860 } else
2545
- if (event.getSource() == attachBumpItem)
2861
+ if (source == attachBumpItem)
25462862 {
25472863 String texture = GetFile("Attach bump");
25482864 Object3D obj;
....@@ -2554,7 +2870,7 @@
25542870
25552871 refreshContents();
25562872 } else
2557
- if (event.getSource() == detachBumpItem)
2873
+ if (source == detachBumpItem)
25582874 {
25592875 Object3D obj;
25602876 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2565,7 +2881,7 @@
25652881
25662882 refreshContents();
25672883 } else
2568
- if (event.getSource() == pigmentBumpItem)
2884
+ if (source == pigmentBumpItem)
25692885 {
25702886 Object3D obj;
25712887 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2576,158 +2892,221 @@
25762892
25772893 refreshContents();
25782894 } else
2579
- if (event.getSource() == flashSelectionButton)
2895
+ if (source == flashSelectionButton)
25802896 {
25812897 CameraPane.flash = true;
25822898 refreshContents();
25832899 } else
2584
- if (event.getSource() == oneButton)
2900
+ if (source == oneButton)
25852901 {
25862902 } else
2587
- if (event.getSource() == twoButton)
2903
+ if (source == twoButton)
25882904 {
25892905 radio.layout = twoButton;
25902906 // bug
25912907 //gridPanel.setDividerLocation(1.0);
25922908 //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();
2909
+// bigThree.remove(scenePanel);
2910
+// bigThree.remove(centralPanel);
2911
+// bigThree.remove(XYZPanel);
2912
+// aWindowConstraints.gridx = 0;
2913
+// aWindowConstraints.gridy = 0;
2914
+// aWindowConstraints.gridwidth = 1;
2915
+// // aConstraints.gridheight = 3;
2916
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2917
+// aWindowConstraints.weightx = 0;
2918
+// aWindowConstraints.weighty = 1;
2919
+// //bigThree.add(jtp, aWindowConstraints);
2920
+// aWindowConstraints.weightx = 1;
2921
+// aWindowConstraints.gridwidth = 3;
2922
+// // aConstraints.gridheight = 3;
2923
+// aWindowConstraints.gridx = 1;
2924
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2925
+// bigThree.add(centralPanel, aWindowConstraints);
2926
+// aWindowConstraints.weightx = 0;
2927
+// aWindowConstraints.gridx = 4;
2928
+// aWindowConstraints.gridwidth = 1;
2929
+// // aConstraints.gridheight = 3;
2930
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2931
+// //bigThree.add(XYZPanel, aWindowConstraints);
2932
+// scenePanel.setVisible(false);
2933
+// centralPanel.setVisible(true);
2934
+// XYZPanel.setVisible(false);
2935
+ bigThree.ClearUI();
2936
+ bigThree.add(centralPanel);
2937
+ bigThree.FlushUI();
2938
+
2939
+ cameraView.requestFocusInWindow();
2940
+
2941
+// refreshContents(true);
2942
+//
2943
+// try
2944
+// {
2945
+// java.awt.Robot bot = new java.awt.Robot();
2946
+// int mask = InputEvent.BUTTON1_MASK;
2947
+// bot.mouseMove(100, 100);
2948
+// bot.mousePress(mask);
2949
+// bot.mouseRelease(mask);
2950
+// }
2951
+// catch (Exception e)
2952
+// {
2953
+//
2954
+// }
2955
+
26172956 } else
2618
- if (event.getSource() == threeButton)
2957
+ if (source == threeButton)
26192958 {
26202959 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();
2960
+
2961
+// bigThree.remove(scenePanel);
2962
+// bigThree.remove(centralPanel);
2963
+// bigThree.remove(XYZPanel);
2964
+// aWindowConstraints.gridx = 0;
2965
+// aWindowConstraints.gridy = 0;
2966
+// aWindowConstraints.gridwidth = 1;
2967
+// // aConstraints.gridheight = 3;
2968
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2969
+// aWindowConstraints.weightx = 0;
2970
+// aWindowConstraints.weighty = 1;
2971
+// //bigThree.add(jtp, aWindowConstraints);
2972
+// aWindowConstraints.weightx = 1;
2973
+// aWindowConstraints.gridwidth = 3;
2974
+// // aConstraints.gridheight = 3;
2975
+// aWindowConstraints.gridx = 1;
2976
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2977
+// bigThree.add(centralPanel, aWindowConstraints);
2978
+// aWindowConstraints.weightx = 0;
2979
+// aWindowConstraints.gridx = 4;
2980
+// aWindowConstraints.gridwidth = 1;
2981
+// // aConstraints.gridheight = 3;
2982
+// aConstraints.fill = GridBagConstraints.VERTICAL;
2983
+// bigThree.add(XYZPanel, aWindowConstraints);
2984
+// bigThree.validate();
2985
+// scenePanel.setVisible(false);
2986
+// centralPanel.setVisible(true);
2987
+// XYZPanel.setVisible(true);
2988
+ bigThree.ClearUI();
2989
+ bigThree.add(centralPanel);
2990
+ bigThree.add(XYZPanel);
2991
+ bigThree.FlushUI();
2992
+
2993
+ cameraView.requestFocusInWindow();
26452994 } else
2646
- if (event.getSource() == fourButton)
2995
+ if (source == fourButton)
26472996 {
26482997 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();
2998
+
2999
+// bigThree.remove(scenePanel);
3000
+// bigThree.remove(centralPanel);
3001
+// bigThree.remove(XYZPanel);
3002
+// aWindowConstraints.gridx = 0;
3003
+// aWindowConstraints.gridy = 0;
3004
+// aWindowConstraints.gridwidth = 1;
3005
+// // aWindowConstraints.gridheight = 3;
3006
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3007
+// aWindowConstraints.weightx = 1;
3008
+// aWindowConstraints.weighty = 1;
3009
+// bigThree.add(scenePanel, aWindowConstraints);
3010
+// aWindowConstraints.weightx = 1;
3011
+// aWindowConstraints.gridwidth = 3;
3012
+// // aConstraints.gridheight = 3;
3013
+// aWindowConstraints.gridx = 1;
3014
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3015
+// //bigThree.add(cameraPanel, aWindowConstraints);
3016
+// aWindowConstraints.weightx = 0;
3017
+// aWindowConstraints.gridx = 4;
3018
+// aWindowConstraints.gridwidth = 1;
3019
+// // aWindowConstraints.gridheight = 3;
3020
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3021
+// //bigThree.add(XYZPanel, aWindowConstraints);
3022
+// bigThree.validate();
3023
+// scenePanel.setVisible(true);
3024
+// centralPanel.setVisible(false);
3025
+// XYZPanel.setVisible(false);
3026
+ bigThree.ClearUI();
3027
+ bigThree.add(scenePanel);
3028
+ bigThree.FlushUI();
3029
+
3030
+ cameraView.requestFocusInWindow();
26733031 } else
2674
- if (event.getSource() == sixButton)
3032
+ if (source == sixButton)
26753033 {
26763034 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();
3035
+
3036
+// bigThree.remove(scenePanel);
3037
+// bigThree.remove(centralPanel);
3038
+// bigThree.remove(XYZPanel);
3039
+// aWindowConstraints.gridx = 0;
3040
+// aWindowConstraints.gridy = 0;
3041
+// aWindowConstraints.gridwidth = 1;
3042
+// // aConstraints.gridheight = 3;
3043
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3044
+// aWindowConstraints.weightx = 0;
3045
+// aWindowConstraints.weighty = 1;
3046
+// bigThree.add(scenePanel, aWindowConstraints);
3047
+// aWindowConstraints.weightx = 1;
3048
+// aWindowConstraints.gridwidth = 3;
3049
+// // aWindowConstraints.gridheight = 3;
3050
+// aWindowConstraints.gridx = 1;
3051
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3052
+// bigThree.add(centralPanel, aWindowConstraints);
3053
+// aWindowConstraints.weightx = 0;
3054
+// aWindowConstraints.gridx = 4;
3055
+// aWindowConstraints.gridwidth = 1;
3056
+// // aWindowConstraints.gridheight = 3;
3057
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3058
+// //bigThree.add(XYZPanel, aConstraints);
3059
+// bigThree.validate();
3060
+// scenePanel.setVisible(true);
3061
+// centralPanel.setVisible(true);
3062
+// XYZPanel.setVisible(false);
3063
+ bigThree.ClearUI();
3064
+ bigThree.add(scenePanel);
3065
+ bigThree.add(centralPanel);
3066
+ bigThree.FlushUI();
3067
+
3068
+ cameraView.requestFocusInWindow();
27013069 } else
2702
- if (event.getSource() == sevenButton)
3070
+ if (source == sevenButton)
27033071 {
27043072 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();
3073
+
3074
+// bigThree.remove(scenePanel);
3075
+// bigThree.remove(centralPanel);
3076
+// bigThree.remove(XYZPanel);
3077
+// aWindowConstraints.gridx = 0;
3078
+// aWindowConstraints.gridy = 0;
3079
+// aWindowConstraints.gridwidth = 1;
3080
+// // aWindowConstraints.gridheight = 3;
3081
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3082
+// aWindowConstraints.weightx = 0;
3083
+// aWindowConstraints.weighty = 1;
3084
+// bigThree.add(scenePanel, aWindowConstraints);
3085
+// aWindowConstraints.weightx = 1;
3086
+// aWindowConstraints.gridwidth = 3;
3087
+// // aWindowConstraints.gridheight = 3;
3088
+// aWindowConstraints.gridx = 1;
3089
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3090
+// bigThree.add(centralPanel, aWindowConstraints);
3091
+// aWindowConstraints.weightx = 0;
3092
+// aWindowConstraints.gridx = 4;
3093
+// aWindowConstraints.gridwidth = 1;
3094
+// // aConstraints.gridheight = 3;
3095
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3096
+// bigThree.add(XYZPanel, aWindowConstraints);
3097
+// bigThree.validate();
3098
+// scenePanel.setVisible(true);
3099
+// centralPanel.setVisible(true);
3100
+// XYZPanel.setVisible(true);
3101
+ bigThree.ClearUI();
3102
+ bigThree.add(scenePanel);
3103
+ bigThree.add(centralPanel);
3104
+ bigThree.add(XYZPanel);
3105
+ bigThree.FlushUI();
3106
+
3107
+ cameraView.requestFocusInWindow();
27293108 } else
2730
- if (event.getSource() == rootButton)
3109
+ if (source == rootButton)
27313110 {
27323111 Object3D obj;
27333112 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2737,9 +3116,10 @@
27373116 EditObject(obj);
27383117 }
27393118
3119
+ cameraView.requestFocusInWindow();
27403120 refreshContents(true);
27413121 } else
2742
- if (event.getSource() == closeButton)
3122
+ if (source == closeButton)
27433123 {
27443124 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27453125 cRadio ab;
....@@ -2758,13 +3138,15 @@
27583138 break;
27593139 }
27603140 }
3141
+
3142
+ cameraView.requestFocusInWindow();
27613143 refreshContents(true);
27623144 } else
2763
- if (event.getSource() == editItem || event.getSource() == editButton)
3145
+ if (source == editItem || source == editButton)
27643146 {
27653147 EditSelection(false);
27663148 } else
2767
- if (event.getSource() == uneditButton)
3149
+ if (source == uneditButton)
27683150 {
27693151 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27703152 {
....@@ -2774,14 +3156,14 @@
27743156 child.CloseUI();
27753157 listUI.remove(child);
27763158
2777
- child.editWindow = null; // ???????????
3159
+ //child.editWindow = null; // ???????????
27783160 }
2779
- objEditor.ctrlPanel.revalidate();
3161
+ objEditor.ctrlPanel.FlushUI();
27803162 //objEditor.jTree.clearSelection();
27813163 //objEditor.ResetSliders();
27823164 refreshContents(true);
27833165 } else
2784
- if (event.getSource() == clearPanelButton)
3166
+ if (source == clearPanelButton)
27853167 {
27863168 assert(copy == group);
27873169 //copy.ClearUI();
....@@ -2792,7 +3174,7 @@
27923174 listUI.clear();
27933175 refreshContents(true);
27943176 } else
2795
- if (event.getSource() == allParamsButton)
3177
+ if (source == allParamsButton)
27963178 {
27973179 assert(copy == group);
27983180
....@@ -2813,19 +3195,19 @@
28133195
28143196 refreshContents(true);
28153197 } else
2816
- if (event.getSource() == unselectButton)
3198
+ if (source == unselectButton)
28173199 {
28183200 objEditor.jTree.clearSelection();
28193201 // ?? oct 2012 GrafreeD.clipboard.clear();
28203202 objEditor.ResetSliders();
28213203 refreshContents(true);
28223204 } else
2823
- if(event.getSource() instanceof cRadio)
3205
+ if(source instanceof cRadio)
28243206 {
28253207 group.parent = keepparent;
28263208 group.attributes = 0;
28273209 //group.editWindow = null;
2828
- /*cRadio*/ radio = (cRadio)event.getSource();
3210
+ /*cRadio*/ radio = (cRadio)source;
28293211 Object3D obj = radio.GetObject();
28303212 System.out.println("Edit " + obj);
28313213 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2845,7 +3227,7 @@
28453227 }
28463228
28473229 copy = group;
2848
- //CameraPane.theRenderer.object = group;
3230
+ //Globals.theRenderer.object = group;
28493231 if(!useclient)
28503232 {
28513233 cameraView.renderCamera = radio.camera;
....@@ -2854,12 +3236,16 @@
28543236 cameraView.cameras[cameraView.cameracount] = radio.camera;
28553237 cameraView.targetLookAt.set(radio.camera.lookAt);
28563238 cameraView.object = group;
2857
- cameraView.lighttouched = true;
3239
+ //cameraView.lighttouched = true;
3240
+ Globals.lighttouched = true;
28583241 topView.object = group;
28593242 frontView.object = group;
28603243 sideView.object = group;
28613244 }
2862
- group.editWindow = this;
3245
+
3246
+// fix "+" issue
3247
+ //group.editWindow = this;
3248
+
28633249 /*
28643250 currentLayout = radio.layout;
28653251 if (currentLayout == null)
....@@ -2871,8 +3257,23 @@
28713257 //group.parent = null; // ROOT
28723258 //group.attributes = -1;
28733259 ResetModel();
3260
+
3261
+ cameraView.requestFocusInWindow();
28743262 refreshContents(true);
2875
- }
3263
+ } else if (event.getSource() == editCameraItem)
3264
+ {
3265
+ cameraView.ProtectCamera();
3266
+ cameraView.repaint();
3267
+ return;
3268
+ } else if (event.getSource() == revertCameraItem)
3269
+ {
3270
+ cameraView.RevertCamera();
3271
+ cameraView.repaint();
3272
+ return;
3273
+ // } else if (event.getSource() == textureButton)
3274
+ // {
3275
+ // return; // true;
3276
+ }
28763277 else
28773278 {
28783279 //return super.action(event, arg);
....@@ -2881,7 +3282,6 @@
28813282 }
28823283
28833284 boolean useclient = false;
2884
- cRadio radio;
28853285
28863286 void ToggleRoot()
28873287 {
....@@ -2890,7 +3290,7 @@
28903290 if (useclient)
28913291 {
28923292 cameraView.object = client;
2893
- cameraView.lighttouched = true;
3293
+ Globals.lighttouched = true;
28943294 //topView.object = client;
28953295 //frontView.object = client;
28963296 //sideView.object = client;
....@@ -2898,7 +3298,7 @@
28983298 else
28993299 {
29003300 cameraView.object = group;
2901
- cameraView.lighttouched = true;
3301
+ Globals.lighttouched = true;
29023302 //topView.object = group;
29033303 //frontView.object = group;
29043304 //sideView.object = group;
....@@ -2933,6 +3333,28 @@
29333333 refreshContents();
29343334 }
29353335
3336
+ void TransformChildren()
3337
+ {
3338
+ Object3D obj;
3339
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3340
+ {
3341
+ obj = (Object3D)e.nextElement();
3342
+ obj.KeepTextureMatrices();
3343
+ obj.TransformChildren();
3344
+ obj.RestoreTextureMatrices();
3345
+
3346
+// if (obj.parent == null)
3347
+// {
3348
+// System.out.println("NULL PARENT!");
3349
+// new Exception().printStackTrace();
3350
+// }
3351
+// else
3352
+// TouchTransform(obj);
3353
+// //obj.parent.Touch();
3354
+ }
3355
+
3356
+ refreshContents();
3357
+ }
29363358
29373359 void ResetTransform()
29383360 {
....@@ -3045,7 +3467,7 @@
30453467 refreshContents();
30463468 }
30473469
3048
- void ResetCentroid()
3470
+ void ResetCentroid(boolean full)
30493471 {
30503472 Object3D obj;
30513473 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3060,12 +3482,16 @@
30603482 LA.matIdentity(Object3D.mat);
30613483 obj.getBounds(minima, maxima, false);
30623484 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3063
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3485
+ if (full)
3486
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30643487 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30653488 obj.TransformMesh(Object3D.mat);
3489
+
30663490 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3067
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3491
+ if (full)
3492
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30683493 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3494
+
30693495 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30703496 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30713497 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3094,7 +3520,8 @@
30943520
30953521 int size = obj.MemorySize();
30963522
3097
- System.err.println((size/1024) + " KB is the size of " + obj);
3523
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3524
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30983525 }
30993526 }
31003527 catch (Exception e)
....@@ -3131,9 +3558,9 @@
31313558 obj = (Object3D)e.nextElement();
31323559
31333560 System.out.println("Object is: " + obj);
3134
- GrafreeD.AnalyzeObject(obj);
3561
+ Grafreed.AnalyzeObject(obj);
31353562 System.out.println("Boundary rep: " + obj.bRep);
3136
- GrafreeD.AnalyzeObject(obj.bRep);
3563
+ Grafreed.AnalyzeObject(obj.bRep);
31373564
31383565 // System.err.println((size/1024) + " KB is the size of " + obj);
31393566 }
....@@ -3175,6 +3602,20 @@
31753602 void GenNormals(boolean crease)
31763603 {
31773604 group.GenNormalsS(crease);
3605
+
3606
+ refreshContents();
3607
+ }
3608
+
3609
+ void GenNormalsMESH()
3610
+ {
3611
+ group.GenNormalsMeshS();
3612
+
3613
+ refreshContents();
3614
+ }
3615
+
3616
+ void GenNormalsMINE()
3617
+ {
3618
+ group.selection.GenNormalsMINE();
31783619
31793620 refreshContents();
31803621 }
....@@ -3340,8 +3781,8 @@
33403781
33413782 void ParseVertices()
33423783 {
3343
- boolean epsequal = GrafreeD.epsequal;
3344
- GrafreeD.epsequal = true;
3784
+ boolean epsequal = Grafreed.epsequal;
3785
+ Grafreed.epsequal = true;
33453786
33463787 for (int i=0; i<group.selection.size(); i++)
33473788 {
....@@ -3366,7 +3807,7 @@
33663807 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33673808 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33683809
3369
- g.add(GrafreeD.clipboard);
3810
+ g.add(Grafreed.clipboard);
33703811
33713812 buffer.add(g);
33723813 }
....@@ -3381,7 +3822,7 @@
33813822 makeSomething(buffer, i==group.selection.size()-1);
33823823 }
33833824
3384
- GrafreeD.epsequal = epsequal;
3825
+ Grafreed.epsequal = epsequal;
33853826
33863827 refreshContents();
33873828 }
....@@ -3399,7 +3840,16 @@
33993840 String pigment = Object3D.GetPigment(tex);
34003841 //String bump = Object3D.GetBump(tex);
34013842
3402
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
3843
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3844
+
3845
+ try
3846
+ {
3847
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3848
+ }
3849
+ catch (Exception e)
3850
+ {
3851
+ System.err.println("FAIL: " + node);
3852
+ }
34033853
34043854 double s = v.s;
34053855
....@@ -3447,12 +3897,26 @@
34473897
34483898 void Align()
34493899 {
3900
+ if (group.selection.size() == 0)
3901
+ return;
3902
+
3903
+ cVector bbmin = new cVector();
3904
+ cVector bbmax = new cVector();
3905
+
3906
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
3907
+
3908
+ double dx = bbmax.x - bbmin.x;
3909
+ double dy = bbmax.y - bbmin.y;
3910
+ double dz = bbmax.z - bbmin.z;
3911
+
3912
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
3913
+
34503914 for (int i=0; i<group.selection.size(); i++)
34513915 {
34523916 Object3D obj = group.selection.get(i);
34533917
3454
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3455
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
3918
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
3919
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34563920 }
34573921
34583922 refreshContents();
....@@ -3473,11 +3937,11 @@
34733937
34743938 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34753939
3476
- boolean random = CameraPane.RANDOM;
3477
- CameraPane.RANDOM = false; // parse all random nodes
3940
+ boolean random = CameraPane.SWITCH;
3941
+ CameraPane.SWITCH = false; // parse all random nodes
34783942 lowres.linkVerticesThis(null);
34793943 lowres.linkVerticesThis(sn);
3480
- CameraPane.RANDOM = random;
3944
+ CameraPane.SWITCH = random;
34813945
34823946 System.err.flush();
34833947
....@@ -3517,7 +3981,7 @@
35173981 return;
35183982
35193983 Object3D poses = group.selection.get(0);
3520
- Object3D ref = GrafreeD.clipboard.get(0);
3984
+ Object3D ref = Grafreed.clipboard.get(0);
35213985
35223986 Object3D newgroup = new Object3D("Po:" + poses.name);
35233987
....@@ -3686,7 +4150,7 @@
36864150 group.selection.RelinkToSupport(); // july 2014
36874151 System.out.println("DONE.");
36884152 refreshContents();
3689
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4153
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
36904154 }
36914155
36924156 void ReduceMesh(boolean reduction34)
....@@ -3711,9 +4175,9 @@
37114175
37124176 void ClipMesh()
37134177 {
3714
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4178
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37154179 {
3716
- Object3D content = GrafreeD.clipboard.get(0);
4180
+ Object3D content = Grafreed.clipboard.get(0);
37174181
37184182 if (content instanceof cGroup && ((cGroup)content).transientlink )
37194183 content = ((cGroup)content).get(0);
....@@ -3722,7 +4186,7 @@
37224186 // {
37234187 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37244188 // }
3725
- group.selection.ClipMesh(GrafreeD.clipboard);
4189
+ group.selection.ClipMesh(Grafreed.clipboard);
37264190 }
37274191 // group.selection.ClipMesh(GrafreeD.clipboard);
37284192 System.out.println("DONE.");
....@@ -3769,6 +4233,18 @@
37694233 void MarkLeaves(boolean hide)
37704234 {
37714235 group.selection.MarkLeaves(hide);
4236
+ refreshContents();
4237
+ }
4238
+
4239
+ void RewindLeaves(boolean hide)
4240
+ {
4241
+ group.selection.RewindLeaves(hide);
4242
+ refreshContents();
4243
+ }
4244
+
4245
+ void RandomLeaves(boolean hide)
4246
+ {
4247
+ group.selection.RandomLeaves(hide);
37724248 refreshContents();
37734249 }
37744250
....@@ -3857,7 +4333,7 @@
38574333 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38584334
38594335 Object3D elem = (Object3D)group.selection.elementAt(i);
3860
- if(elem != group)
4336
+ if(elem != group || !newWindow)
38614337 {
38624338 // if (!(elem instanceof Composite))
38634339 // newWindow = false;
....@@ -3947,7 +4423,6 @@
39474423 //case 702: // Event.LIST_DESELECT
39484424 group.deselectAll();
39494425 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3950
- objEditor.ClearInfo(); // .GetMaterial());
39514426 if (tps != null)
39524427 {
39534428 for (int i=0; i < tps.length; i++)
....@@ -3956,31 +4431,30 @@
39564431
39574432 //if (child.parent != null)
39584433 //child.parent.addSelectee(child);
4434
+ objEditor.SetMaterial(child);
39594435 group.addSelectee(child);
3960
- objEditor.SetMaterial(child); // .GetMaterial());
3961
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3962
- System.err.println("info : " + child.GetPath());
39634436 }
39644437 }
3965
- else
3966
- {
3967
- objEditor.SetMaterial(group); // .GetMaterial());
3968
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3969
- System.err.println("info : " + group.GetPath());
3970
- }
4438
+// else
4439
+// {
4440
+// objEditor.SetMaterial(group); // .GetMaterial());
4441
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4442
+// System.err.println("info : " + group.GetPath());
4443
+// }
39714444
3972
- objEditor.SetText(); // jan 2014
3973
-
3974
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4445
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
39754446 CameraPane.flash = true;
39764447
3977
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4448
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39784449 // a camera
39794450 {
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;
4451
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4452
+ {
4453
+ CameraPane.camerachangeframe = 0; // don't refuse it
4454
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4455
+ }
4456
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4457
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
39844458 }
39854459
39864460 refreshContents();
....@@ -3991,6 +4465,26 @@
39914465
39924466 freezemodel = false;
39934467 }
4468
+
4469
+ void refreshContents(boolean cp)
4470
+ {
4471
+ if (!Globals.MOUSEDRAGGED)
4472
+ {
4473
+ objEditor.ClearInfo(); // .GetMaterial());
4474
+
4475
+ for (int i=0; i < group.selection.Size(); i++)
4476
+ {
4477
+ Object3D child = (Object3D) group.selection.get(i);
4478
+
4479
+ objEditor.AddInfo(child, this, true);
4480
+ System.err.println("info : " + child.GetPath());
4481
+ }
4482
+
4483
+ objEditor.SetText(); // jan 2014
4484
+ }
4485
+
4486
+ super.refreshContents(cp);
4487
+ }
39944488
39954489 void linkSomething(Object3D thing)
39964490 {
....@@ -4062,16 +4556,18 @@
40624556 {
40634557 if (group.selection.isEmpty())
40644558 return;
4065
- GrafreeD.clipboardIsTempGroup = false;
4559
+
4560
+ Grafreed.clipboardIsTempGroup = false;
40664561 Composite tGroup = null;
40674562 if (group.selection.size() > 0) // 1)
40684563 {
40694564 tGroup = new cGroup();
4070
- GrafreeD.clipboardIsTempGroup = true;
4565
+ Grafreed.clipboardIsTempGroup = true;
40714566 }
40724567
40734568 if (cut)
40744569 {
4570
+ Save();
40754571 //int indices[] = jList.getSelectedIndices();
40764572 //for (int i = indices.length - 1; i >= 0; i--)
40774573 //jList.remove(indices[i]);
....@@ -4107,16 +4603,16 @@
41074603 //System.out.println("cut " + child);
41084604 //System.out.println("parent = " + child.parent);
41094605 // tmp.addChild(child);
4110
- if (GrafreeD.clipboardIsTempGroup)
4606
+ if (Grafreed.clipboardIsTempGroup)
41114607 tGroup.add/*Child*/(tmp);
41124608 else
4113
- GrafreeD.clipboard = tmp;
4609
+ Grafreed.clipboard = tmp;
41144610 }
41154611 else
4116
- if (GrafreeD.clipboardIsTempGroup)
4612
+ if (Grafreed.clipboardIsTempGroup)
41174613 tGroup.add/*Child*/(child);
41184614 else
4119
- GrafreeD.clipboard = child;
4615
+ Grafreed.clipboard = child;
41204616 }
41214617
41224618 //ResetModel();
....@@ -4148,21 +4644,23 @@
41484644 //System.out.println("cut " + elem);
41494645 //System.out.println("parent = " + elem.parent);
41504646 // tmp.addChild(elem);
4151
- if (GrafreeD.clipboardIsTempGroup)
4647
+ if (Grafreed.clipboardIsTempGroup)
41524648 tGroup.add/*Child*/(tmp);
41534649 else
4154
- GrafreeD.clipboard = tmp;
4650
+ Grafreed.clipboard = tmp;
41554651 }
41564652 else
4157
- if (GrafreeD.clipboardIsTempGroup)
4653
+ if (Grafreed.clipboardIsTempGroup)
41584654 tGroup.add/*Child*/(child);
41594655 else
4160
- GrafreeD.clipboard = child;
4656
+ Grafreed.clipboard = child;
41614657 }
41624658
41634659 }
4164
- if (GrafreeD.clipboardIsTempGroup)
4165
- GrafreeD.clipboard = tGroup;
4660
+
4661
+ if (Grafreed.clipboardIsTempGroup)
4662
+ Grafreed.clipboard = tGroup;
4663
+
41664664 if (cut)
41674665 {
41684666 ResetModel();
....@@ -4176,7 +4674,7 @@
41764674 // return;
41774675 boolean first = true;
41784676
4179
- if (GrafreeD.clipboardIsTempGroup)
4677
+ if (Grafreed.clipboardIsTempGroup)
41804678 {
41814679 Composite temp;
41824680
....@@ -4187,7 +4685,7 @@
41874685 temp = (Composite)Applet3D.clipboard.deepCopy();
41884686 */
41894687 Object3D elem;
4190
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4688
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41914689 {
41924690 Object3D child = (Object3D)e.nextElement();
41934691
....@@ -4221,21 +4719,21 @@
42214719 //Object3D cb = Applet3D.clipboard;
42224720 //temp.addChild(cb);
42234721 //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());
4722
+ assert(Grafreed.clipboard.parent == null);
4723
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4724
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4725
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4726
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42294727 else
4230
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4231
- GrafreeD.clipboard.get(0).parent = keepparent;
4728
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4729
+ Grafreed.clipboard.get(0).parent = keepparent;
42324730 }
42334731
42344732 ResetModel();
42354733 refreshContents();
42364734 }
42374735
4238
- void pasteInto(boolean copyit)
4736
+ void pasteInto(boolean copyit, boolean clone)
42394737 {
42404738 // if (GrafreeD.clipboard == null)
42414739 // return;
....@@ -4264,15 +4762,22 @@
42644762 if (copyit)
42654763 {
42664764 // paste(false);
4267
- CloneClipboard(false); // sept 2014
4765
+ if (clone)
4766
+ {
4767
+ CloneClipboard(false); // sept 2014
4768
+ }
4769
+ else
4770
+ {
4771
+ paste(false);
4772
+ }
42684773 }
42694774 else
42704775 {
42714776 boolean first = true;
42724777
4273
- if (GrafreeD.clipboardIsTempGroup)
4778
+ if (Grafreed.clipboardIsTempGroup)
42744779 {
4275
- Composite temp = (Composite)GrafreeD.clipboard;
4780
+ Composite temp = (Composite)Grafreed.clipboard;
42764781 Object3D copy;
42774782 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42784783 {
....@@ -4282,7 +4787,7 @@
42824787 }
42834788 } else
42844789 {
4285
- linkSomething(GrafreeD.clipboard); //.get(0));
4790
+ linkSomething(Grafreed.clipboard); //.get(0));
42864791 }
42874792 }
42884793 }
....@@ -4474,6 +4979,26 @@
44744979 makeSomething(csg);
44754980 }
44764981
4982
+ void Ungroup(Object3D g)
4983
+ {
4984
+ if (g instanceof HiddenObject)
4985
+ {
4986
+ HiddenObject h = (HiddenObject) g;
4987
+
4988
+ for (int i=0; i<h.ActualSize(); i++)
4989
+ {
4990
+ objEditor.makeSomething(h.get(i), false);
4991
+ }
4992
+ }
4993
+ else
4994
+ {
4995
+ for (int i=0; i<g.Size(); i++)
4996
+ {
4997
+ objEditor.makeSomething(g.get(i), false);
4998
+ }
4999
+ }
5000
+ }
5001
+
44775002 void ungroup()
44785003 {
44795004 /*
....@@ -4667,21 +5192,6 @@
46675192 }
46685193 */
46695194
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
-
46855195 /*
46865196 public void Callback(Object obj)
46875197 {
....@@ -4705,26 +5215,9 @@
47055215 }
47065216 */
47075217
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
-
47255218 String GetFile(String dialogName)
47265219 {
4727
- if (GrafreeD.standAlone)
5220
+ if (Grafreed.standAlone)
47285221 {
47295222 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47305223 browser.show();
....@@ -4788,10 +5281,18 @@
47885281 cButton flashSelectionButton;
47895282 cButton editButton;
47905283 cButton uneditButton;
5284
+ JCheckBox allParamsButton;
47915285 cButton clearpanelButton;
4792
- cButton allParamsButton;
47935286 cButton unselectButton;
47945287
5288
+ cButton minButton;
5289
+ cButton maxButton;
5290
+ cButton fullButton;
5291
+ cButton undoButton;
5292
+ cButton redoButton;
5293
+ cButton saveButton;
5294
+ cButton oneStepButton;
5295
+
47955296 cButton screenfitButton;
47965297 cButton screenfitpointButton;
47975298 cButton snapobjectButton;
....@@ -4802,14 +5303,6 @@
48025303 cButton closeButton;
48035304
48045305 cButton setsupportButton;
4805
-
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;
48135306
48145307 //
48155308 //Composite
....@@ -4822,6 +5315,8 @@
48225315 private MenuItem lookFromItem;
48235316 private MenuItem switchItem;
48245317 private MenuItem cutItem;
5318
+ private MenuItem undoItem;
5319
+ private MenuItem redoItem;
48255320 private MenuItem duplicateItem;
48265321 private MenuItem cloneItem;
48275322 private MenuItem cloneSupportItem;
....@@ -4833,8 +5328,9 @@
48335328 private MenuItem resetsupportItem;
48345329 private MenuItem resetreferencesItem;
48355330 private MenuItem linkverticesItem;
5331
+ private MenuItem relinkverticesItem;
48365332 private MenuItem setMasterItem;
4837
- private MenuItem resetMeshItem;
5333
+ private MenuItem resetAllItem;
48385334 private MenuItem stepAllItem;
48395335 private MenuItem revertMeshItem;
48405336 private MenuItem poseMeshItem;
....@@ -4845,6 +5341,7 @@
48455341 private MenuItem mergeGeometriesItem;
48465342 private MenuItem copyItem;
48475343 private MenuItem pasteItem;
5344
+ private MenuItem pasteIntoItem;
48485345 private MenuItem pasteLinkItem;
48495346 private MenuItem pasteCloneItem;
48505347 private MenuItem pasteExpandItem;
....@@ -4854,6 +5351,7 @@
48545351 private MenuItem genNormalsMESHItem;
48555352 private MenuItem genNormalsCADItem;
48565353 private MenuItem genNormalsORGANItem;
5354
+ private MenuItem genNormalsMINEItem;
48575355 private MenuItem stripifyItem;
48585356 private MenuItem unstripifyItem;
48595357 private MenuItem trimItem;
....@@ -4882,6 +5380,10 @@
48825380 private MenuItem showleavesItem;
48835381 private MenuItem markleavesItem;
48845382 private MenuItem unmarkleavesItem;
5383
+ private MenuItem rewindleavesItem;
5384
+ private MenuItem unrewindleavesItem;
5385
+ private MenuItem randomleavesItem;
5386
+ private MenuItem unrandomleavesItem;
48855387
48865388 private MenuItem flipVItem;
48875389 private MenuItem unflipVItem;
....@@ -4893,8 +5395,11 @@
48935395 private MenuItem panoTexturesItem;
48945396
48955397 private MenuItem resetCentroidItem;
4896
- private MenuItem transformgeometryItem;
5398
+ private MenuItem resetCentroidXZItem;
48975399 private MenuItem resetTransformItem;
5400
+ private MenuItem transformGeometryItem;
5401
+ private MenuItem transformChildrenItem;
5402
+ private MenuItem hideItem;
48985403 private MenuItem grabItem;
48995404 private MenuItem backItem;
49005405 private MenuItem frontItem;
....@@ -4915,6 +5420,7 @@
49155420
49165421 private MenuItem resetParentItem;
49175422 private MenuItem repairParentItem;
5423
+ private MenuItem repairShadowItem;
49185424 private MenuItem sortbysizeItem;
49195425 private MenuItem sortbynameItem;
49205426
....@@ -4935,10 +5441,11 @@
49355441 private MenuItem coneItem;
49365442 private MenuItem torusItem;
49375443 private MenuItem superItem;
5444
+ private MenuItem kleinItem;
49385445 private MenuItem blobItem;
49395446 private MenuItem latheItem;
49405447 private MenuItem bezierItem;
4941
- private MenuItem checkerItem;
5448
+ private MenuItem overlayItem;
49425449 private MenuItem meshItem;
49435450 // private MenuItem meshGroupItem;
49445451 private MenuItem springItem;
....@@ -4947,6 +5454,7 @@
49475454 private MenuItem csgItem;
49485455 private MenuItem templateItem;
49495456 private MenuItem textureItem;
5457
+ private MenuItem billboardItem;
49505458 private MenuItem shadowXItem;
49515459 private MenuItem shadowYItem;
49525460 private MenuItem shadowZItem;
....@@ -4959,11 +5467,6 @@
49595467 private MenuItem doubleItem;
49605468 private MenuItem tripleItem;
49615469
4962
- private MenuItem importGFDItem;
4963
- private MenuItem importVRMLX3DItem;
4964
- private MenuItem import3DSItem;
4965
- private MenuItem importOBJItem;
4966
-
49675470 private MenuItem computeAOItem;
49685471 private MenuItem recompileItem;
49695472 private MenuItem editScriptItem;
....@@ -4973,4 +5476,8 @@
49735476 private MenuItem analyzeItem;
49745477 private MenuItem dumpItem;
49755478 //boolean freezemodel = false;
5479
+
5480
+ Menu cameraMenu;
5481
+ MenuItem editCameraItem;
5482
+ MenuItem revertCameraItem;
49765483 }