Normand Briere
2019-06-21 15123b19e7bc8da2869429b07f0fbaa0598e945e
GroupEditor.java
....@@ -12,6 +12,7 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
1718 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
....@@ -73,7 +74,7 @@
7374 this.copy = this.group = copy;
7475 //selectees = this.group.selectees;
7576
76
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7778 SetupUI2(objEditor);
7879 objEditor.SetupUI(true);
7980 SetupViews(objEditor);
....@@ -83,7 +84,7 @@
8384
8485 void CloneSelection(boolean supports)
8586 {
86
- // Object3D keep = GraphreeD.clipboard;
87
+ // Object3D keep = GrafreeD.clipboard;
8788 //Object3D obj;
8889 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
8990 {
....@@ -97,14 +98,14 @@
9798
9899 void CloneClipboard(boolean supports)
99100 {
100
- assert(GraphreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
102
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GraphreeD.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(GraphreeD.clipboard, false));
107
- GraphreeD.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)GraphreeD.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,130 @@
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
+ menu.add("-");
180
+
181
+ menu.add("-");
182
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
183
+ pasteIntoItem.addActionListener(this);
184
+ pasteLinkItem = menu.add(new MenuItem("Paste link"));
185
+ pasteLinkItem.addActionListener(this);
186
+ pasteCloneItem = menu.add(new MenuItem("Paste clone"));
187
+ pasteCloneItem.addActionListener(this);
188
+// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
189
+// pasteExpandItem.addActionListener(this);
190
+ menu.add("-");
191
+ clearItem = menu.add(new MenuItem("Clear"));
192
+ clearItem.addActionListener(this);
193
+
194
+ if (Globals.ADVANCED)
195
+ {
196
+ // Deletes the cameras...
197
+ clearAllItem = menu.add(new MenuItem("Clear All"));
198
+ clearAllItem.addActionListener(this);
199
+ }
200
+
201
+ menuBar.add(cameraMenu = new Menu("View"));
202
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
203
+ //zBufferItem.addActionListener(this);
204
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205
+ //normalLensItem.addActionListener(this);
206
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
+ revertCameraItem.addActionListener(this);
208
+
209
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
+ toggleFullScreenItem.addItemListener(this);
211
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
+ cameraMenu.add("-");
213
+
214
+ cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
215
+ toggleTextureItem.addItemListener(this);
216
+ toggleTextureItem.setState(CameraPane.textureon);
217
+
218
+ cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
219
+ toggleSwitchItem.addItemListener(this);
220
+ toggleSwitchItem.setState(CameraPane.SWITCH);
221
+
222
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
223
+ toggleHandleItem.addItemListener(this);
224
+ toggleHandleItem.setState(CameraPane.HANDLES);
225
+
226
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
227
+ togglePaintItem.addItemListener(this);
228
+ togglePaintItem.setState(CameraPane.PAINTMODE);
229
+
230
+ if (Globals.ADVANCED)
231
+ {
232
+ cameraMenu.add("-");
233
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
234
+ toggleLiveItem.addItemListener(this);
235
+ toggleLiveItem.setState(Globals.isLIVE());
236
+
237
+ cameraMenu.add(stepItem = new MenuItem("Step"));
238
+ stepItem.addActionListener(this);
239
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
240
+ // toggleDLItem.addItemListener(this);
241
+ // toggleDLItem.setState(false);
242
+
243
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
244
+ toggleRenderItem.addItemListener(this);
245
+ toggleRenderItem.setState(!CameraPane.frozen);
246
+
247
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248
+ toggleDebugItem.addItemListener(this);
249
+ toggleDebugItem.setState(CameraPane.DEBUG);
250
+
251
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252
+ toggleFrustumItem.addItemListener(this);
253
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
254
+
255
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
256
+ toggleFootContactItem.addItemListener(this);
257
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
258
+
259
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
260
+ toggleTimelineItem.addItemListener(this);
261
+ }
262
+
263
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
264
+// toggleRootItem.addItemListener(this);
265
+// toggleRootItem.setState(false);
266
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
267
+// animationItem.addItemListener(this);
268
+// animationItem.setState(CameraPane.ANIMATION);
269
+ cameraMenu.add("-");
270
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
271
+ editCameraItem.addActionListener(this);
272
+
273
+ if (Globals.ADVANCED)
274
+ {
152275 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153276 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154277 //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
....@@ -160,45 +283,17 @@
160283 lookAtItem.addActionListener(this);
161284 //lookFromItem.addActinoListener(this);
162285 //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
-
286
+ }
287
+
192288 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);
289
+ if (Globals.ADVANCED)
290
+ {
197291 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198292 revertMeshItem.addActionListener(this);
199293 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200294 resetreferencesItem.addActionListener(this);
201295 menu.add("-");
296
+ }
202297 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203298 overwriteGeoItem.addActionListener(this);
204299 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,48 +305,68 @@
210305 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211306 overwriteUVItem.addActionListener(this);
212307 menu.add("-");
308
+ if (Globals.ADVANCED)
309
+ {
213310 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214311 generateMeshItem.addActionListener(this);
215312 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216313 poseMeshItem.addActionListener(this);
217314 menu.add("-");
315
+ }
218316 resetsupportItem = menu.add(new MenuItem("Reset support"));
219317 resetsupportItem.addActionListener(this);
220318 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221319 linkverticesItem.addActionListener(this);
320
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
321
+ relinkverticesItem.addActionListener(this);
322
+
323
+ if (Globals.ADVANCED)
324
+ {
222325 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223326 setMasterItem.addActionListener(this);
327
+ }
224328
225329 oe.menuBar.add(menu = new Menu("Group"));
226330 grabItem = menu.add(new MenuItem("Grab"));
227331 grabItem.addActionListener(this);
228
- frontItem = menu.add(new MenuItem("Front"));
229
- frontItem.addActionListener(this);
230332 backItem = menu.add(new MenuItem("Back"));
231333 backItem.addActionListener(this);
334
+ frontItem = menu.add(new MenuItem("Front"));
335
+ frontItem.addActionListener(this);
232336 compositeItem = menu.add(new MenuItem("Composite"));
233337 compositeItem.addActionListener(this);
338
+ hideItem = menu.add(new MenuItem("Hidden Group"));
339
+ hideItem.addActionListener(this);
340
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
341
+ ungroupItem.addActionListener(this);
234342 menu.add("-");
235
- randomItem = menu.add(new MenuItem("Random"));
343
+ randomItem = menu.add(new MenuItem("Switch node"));
236344 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);
241345 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
242346 switchGeoItem.addActionListener(this);
243347 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
244348 switchTransfoItem.addActionListener(this);
245
- morphItem = menu.add(new MenuItem("Morph"));
349
+ morphItem = menu.add(new MenuItem("Morph Group"));
246350 morphItem.addActionListener(this);
351
+
352
+ if (Globals.ADVANCED)
353
+ {
354
+ menu.add("-");
355
+ physicsItem = menu.add(new MenuItem("Physics"));
356
+ physicsItem.addActionListener(this);
357
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
358
+ frameselectorItem.addActionListener(this);
247359 scriptNodeItem = menu.add(new MenuItem("Script Node"));
248360 scriptNodeItem.addActionListener(this);
249361 cameraItem = menu.add(new MenuItem("Camera"));
250362 cameraItem.addActionListener(this);
363
+ }
251364
252365 oe.menuBar.add(menu = new Menu("Object"));
253366 textureItem = menu.add(new MenuItem("Texture"));
254367 textureItem.addActionListener(this);
368
+ billboardItem = menu.add(new MenuItem("Billboard"));
369
+ billboardItem.addActionListener(this);
255370 csgItem = menu.add(new MenuItem("CSG"));
256371 csgItem.addActionListener(this);
257372 shadowXItem = menu.add(new MenuItem("Shadow X"));
....@@ -260,23 +375,29 @@
260375 shadowYItem.addActionListener(this);
261376 shadowZItem = menu.add(new MenuItem("Shadow Z"));
262377 shadowZItem.addActionListener(this);
378
+ if (Globals.ADVANCED)
379
+ {
380
+ menu.add("-");
263381 linkerItem = menu.add(new MenuItem("Linker"));
264382 linkerItem.addActionListener(this);
265
- templateItem = menu.add(new MenuItem("Template"));
266
- templateItem.addActionListener(this);
267383 attributeItem = menu.add(new MenuItem("Attribute"));
268384 attributeItem.addActionListener(this);
385
+ templateItem = menu.add(new MenuItem("Template"));
386
+ templateItem.addActionListener(this);
269387 pointflowItem = menu.add(new MenuItem("Point Flow"));
270388 pointflowItem.addActionListener(this);
389
+ }
271390 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274391 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275392 resetTransformItem.addActionListener(this);
276393 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277394 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.addActionListener(this);
395
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
396
+ resetCentroidXZItem.addActionListener(this);
397
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
398
+ transformGeometryItem.addActionListener(this);
399
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
400
+ transformChildrenItem.addActionListener(this);
280401
281402 oe.menuBar.add(menu = new Menu("Geometry"));
282403 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -285,6 +406,13 @@
285406 genNormalsORGANItem.addActionListener(this);
286407 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
287408 genNormalsCADItem.addActionListener(this);
409
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
410
+ genNormalsMESHItem.addActionListener(this);
411
+ if (Globals.ADVANCED)
412
+ {
413
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
414
+ genNormalsMINEItem.addActionListener(this);
415
+ }
288416 stripifyItem = menu.add(new MenuItem("Stripify"));
289417 stripifyItem.addActionListener(this);
290418 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -306,23 +434,34 @@
306434 reduce34MeshItem.addActionListener(this);
307435 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308436 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311437 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312438 clipMeshItem.addActionListener(this);
439
+
440
+ if (Globals.ADVANCED)
441
+ {
442
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
443
+ smoothMeshItem.addActionListener(this);
444
+ }
313445
314446 oe.menuBar.add(menu = new Menu("Attributes"));
315447 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
316448 clearMaterialsItem.addActionListener(this);
449
+ resetAllItem = menu.add(new MenuItem("Reset All"));
450
+ resetAllItem.addActionListener(this);
451
+ stepAllItem = menu.add(new MenuItem("Step All"));
452
+ stepAllItem.addActionListener(this);
317453 menu.add("-");
318454 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
319455 liveleavesItem.addActionListener(this);
320456 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
321457 unliveleavesItem.addActionListener(this);
458
+ if (Globals.ADVANCED)
459
+ {
322460 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
323461 supportleavesItem.addActionListener(this);
324462 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
325463 unsupportleavesItem.addActionListener(this);
464
+ }
326465 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
327466 hideleavesItem.addActionListener(this);
328467 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -331,6 +470,14 @@
331470 markleavesItem.addActionListener(this);
332471 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
333472 unmarkleavesItem.addActionListener(this);
473
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
474
+ rewindleavesItem.addActionListener(this);
475
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
476
+ unrewindleavesItem.addActionListener(this);
477
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
478
+ randomleavesItem.addActionListener(this);
479
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
480
+ unrandomleavesItem.addActionListener(this);
334481 menu.add("-");
335482 flipVItem = menu.add(new MenuItem("Flip V"));
336483 flipVItem.addActionListener(this);
....@@ -366,29 +513,22 @@
366513 sortbynameItem = menu.add(new MenuItem("Sort by name"));
367514 sortbynameItem.addActionListener(this);
368515 menu.add("-");
516
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
517
+ shareGeometriesItem.addActionListener(this);
518
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
519
+ mergeGeometriesItem.addActionListener(this);
520
+ if (Globals.ADVANCED)
521
+ {
522
+ // Pretty much the same as duplicate and clone.
369523 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
370524 extractGeometriesItem.addActionListener(this);
371525 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
372526 cloneGeometriesItem.addActionListener(this);
373
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
374
- shareGeometriesItem.addActionListener(this);
375
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
376
- mergeGeometriesItem.addActionListener(this);
527
+ }
377528
378529 oe.menuBar.add(menu = new Menu("Insert"));
379530 buildCreateMenu(menu);
380531
381
-
382
- oe.menuBar.add(menu = new Menu("Include"));
383
- importGFDItem = menu.add(new MenuItem("GraphreeD Object..."));
384
- importGFDItem.addActionListener(this);
385
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
386
- importVRMLX3DItem.addActionListener(this);
387
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
388
- importOBJItem.addActionListener(this);
389
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
390
- import3DSItem.addActionListener(this);
391
-
392532 oe.menuBar.add(menu = new Menu("Tools"));
393533 buildToolsMenu(menu);
394534 }
....@@ -423,150 +563,110 @@
423563 oe.radioPanel.add(dummyButton);
424564 oe.buttonGroup.add(dummyButton);
425565 */
426
- aConstraints.gridy += 1;
427
- oe.aConstraints.gridwidth = 1;
428
- oe.aConstraints.gridx = 0;
566
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
429567
430
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
568
+ oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569
+ undoButton.setToolTipText("Undo changes");
570
+ undoButton.addActionListener(this);
571
+
572
+ oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573
+ redoButton.setToolTipText("Redo changes");
574
+ redoButton.addActionListener(this);
575
+
576
+ oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577
+ saveButton.setToolTipText("Save changes");
578
+ saveButton.addActionListener(this);
579
+
580
+ oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
581
+ liveCB.setToolTipText("Enable animation");
431582 liveCB.addItemListener(this);
432583
433
- oe.aConstraints.gridx += 1;
434
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
435
- supportCB.addItemListener(this);
436
-
437
- // oe.aConstraints.gridx += 1;
438
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
439
- // localCB.addItemListener(this);
440
-
441
- oe.aConstraints.gridx += 1;
442
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
443
- crowdCB.addItemListener(this);
444
-
445
- oe.aConstraints.gridx += 1;
446
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
447
- smoothCB.addItemListener(this);
448
-
449
- oe.aConstraints.gridx += 1;
450
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
584
+ oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
+ oneStepButton.setToolTipText("Animate one step forward");
586
+ oneStepButton.addActionListener(this);
587
+
588
+ oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
589
+ fastCB.setToolTipText("Fast mode");
451590 fastCB.addItemListener(this);
452
- oe.aConstraints.gridx += 1;
453
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
454
- slowCB.addItemListener(this);
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
457
- boxCB.addItemListener(this);
458
-
459
-// oe.aConstraints.gridx += 1;
460
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
461
-// speakerMocapCB.addItemListener(this);
462
-
463
- if (false)
464
- {
465
- // handled in scripts
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
468
- speakerCameraCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
472
- speakerFocusCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
476
- smoothfocusCB.addItemListener(this);
477
- }
478
-
479
-//oe.aConstraints.gridx += 1;
480
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
481
-// debugCB.addItemListener(this);
482
-
483
- oe.aConstraints.gridx += 1;
484
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
485
- oeilCB.addItemListener(this);
486
-
487
- oe.aConstraints.gridx += 1;
488
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
489
- lookAtCB.addItemListener(this);
490
-
491
- oe.aConstraints.gridx += 1;
492
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
591
+
592
+ oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
593
+ trackCB.setToolTipText("Enable tracking");
493594 trackCB.addItemListener(this);
494595
495
- oe.aConstraints.gridx += 1;
496
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
596
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ screenfitButton.setToolTipText("Screen fit");
497598 screenfitButton.addActionListener(this);
498
- oe.aConstraints.gridx += 1;
599
+
499600 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
500601 // screenfitpointButton.addActionListener(this);
501
-// oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
503
- snapobjectButton.addActionListener(this);
504
- oe.aConstraints.gridx += 1;
505602
506
- //aConstraints.gridx = 0;
507
- //aConstraints.gridy += 1;
508
- oe.aConstraints.weighty = 0;
509
- oe.aConstraints.gridwidth = 1;
510
-
511
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
603
+ if (Globals.ADVANCED)
604
+ {
605
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
+ snapobjectButton.addActionListener(this);
607
+ snapobjectButton.setToolTipText("Snap Object");
608
+ }
609
+
610
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ flashSelectionButton.setToolTipText("Show selection");
512612 flashSelectionButton.addActionListener(this);
513
- oe.aConstraints.gridx += 1;
514
- oe.aConstraints.weighty = 0;
515
- oe.aConstraints.gridwidth = 1;
516613
517
- //
518
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
614
+ oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
615
+
616
+ oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617
+ twoButton.setToolTipText("Show center view only");
519618 twoButton.addActionListener(this);
520
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521620 fourButton.addActionListener(this);
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
621
+ fourButton.setToolTipText("Show left panel only");
622
+ oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
623
+ sixButton.setToolTipText("2-column layout left");
523624 sixButton.addActionListener(this);
524
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
625
+ oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
+ threeButton.setToolTipText("2-column layout right");
525627 threeButton.addActionListener(this);
526
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
628
+ oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ sevenButton.setToolTipText("3-column layout");
527630 sevenButton.addActionListener(this);
528631 //
529632
530
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
633
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ rootButton.setToolTipText("Edit selection in new tab");
531635 rootButton.addActionListener(this);
532
- oe.aConstraints.gridx += 1;
533
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
636
+
637
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
+ closeButton.setToolTipText("Close tab");
534639 closeButton.addActionListener(this);
535640 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
536641 //clearButton.addActionListener(this);
537
- oe.aConstraints.gridx += 1;
538642
539
- oe.aConstraints.gridx = 1; //
540
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
643
+ cGridBag commandsPanel = new cGridBag();
644
+
645
+ commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646
+ editButton.setToolTipText("Edit selection");
541647 editButton.addActionListener(this);
542
- oe.aConstraints.gridx += 1;
543
- oe.aConstraints.weighty = 0;
544
- oe.aConstraints.gridwidth = 1;
545648
546
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
649
+ commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
+ uneditButton.setToolTipText("Unedit selection");
547651 uneditButton.addActionListener(this);
548652
549
- oe.aConstraints.gridx += 1;
550
- oe.aConstraints.weighty = 0;
551
- oe.aConstraints.gridwidth = 1;
552
-
553
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
554
- clearPanelButton.addActionListener(this);
555
-
556
- oe.aConstraints.gridx += 1;
557
- oe.aConstraints.weighty = 0;
558
- oe.aConstraints.gridwidth = 1;
559
-
560
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
653
+ commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
654
+ allParamsButton.setToolTipText("Edit all params");
561655 allParamsButton.addActionListener(this);
562656
563
- oe.aConstraints.gridx += 1;
564
- oe.aConstraints.weighty = 0;
565
- oe.aConstraints.gridwidth = 1;
566
-
567
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
657
+ commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
658
+ clearPanelButton.setToolTipText("Clear edit panel");
659
+ clearPanelButton.addActionListener(this);
660
+
661
+ commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ unselectButton.setToolTipText("Unselect");
568663 unselectButton.addActionListener(this);
569664
665
+ commandsPanel.preferredHeight = 1;
666
+
667
+ oe.treePanel.add(commandsPanel);
668
+ oe.treePanel.Return();
669
+
570670 // oe.aConstraints.gridx += 1;
571671 // oe.aConstraints.weighty = 0;
572672 // oe.aConstraints.gridwidth = 1;
....@@ -578,40 +678,37 @@
578678 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
579679 // gcButton.addActionListener(this);
580680
581
- oe.aConstraints.gridx = 0;
582
- oe.aConstraints.gridy += 1;
583
-
584
- //ctrlPanel.add(objList = new List(5, true));
585
- oe.aConstraints.gridwidth = 100;
586
- // oe.aConstraints.gridheight = 100;
587
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
588
- oe.aConstraints.gridheight = 1;
589
- oe.aConstraints.weighty = 0.5;
590
- oe.aConstraints.gridx = 0;
591
- JScrollPane jSP;
681
+ cGridBag jSPPanel = new cGridBag();
682
+
683
+ JScrollPane jSP;
592684 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
593
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
685
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
594686 ResetModel();
595
- oe.aConstraints.weighty = 0.5;
596
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
597
- oe.aConstraints.gridy += 1;
598
- oe.aConstraints.gridwidth = 1;
687
+
688
+ oe.treePanel.add(jSPPanel);
689
+ oe.treePanel.Return();
599690
600
- oe.aConstraints.weighty = 0;
601
- oe.aConstraints.gridwidth = 2;
602
-
603
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
691
+ cGridBag copyOptionsPanel = new cGridBag();
692
+
693
+ copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
694
+ colorCB.setToolTipText("Copy color when dropped");
604695 colorCB.addItemListener(this);
605
- oe.aConstraints.gridx += 2;
606
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
696
+
697
+ copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
698
+ materialCB.setToolTipText("Copy material when dropped");
607699 materialCB.addItemListener(this);
608
- oe.aConstraints.gridx += 2;
609
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
700
+
701
+ copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
702
+ textureCB.setToolTipText("Copy texture when dropped");
610703 textureCB.addItemListener(this);
611704
612
- oe.aConstraints.gridx = 0;
613
- oe.aConstraints.gridy += 1;
705
+ copyOptionsPanel.preferredHeight = 1;
706
+ oe.treePanel.add(copyOptionsPanel);
707
+ oe.treePanel.Return();
614708
709
+// mainPanel.setDividerLocation(0.5); //1.0);
710
+// mainPanel.setResizeWeight(0.5);
711
+
615712 //jList.addListSelectionListener(this);
616713 oe.jTree.addTreeSelectionListener(this);
617714 //jTree.setRootVisible(false);
....@@ -633,18 +730,91 @@
633730 radio.layout = sevenButton;
634731 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
635732 }
733
+
734
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
735
+ {
736
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
737
+ boxCB.setToolTipText("Display bounding boxes");
738
+ boxCB.addItemListener(this);
739
+
740
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
741
+ zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
742
+ zoomBoxCB.addItemListener(this);
743
+
744
+ if (true) // Globals.ADVANCED)
745
+ {
746
+ panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
747
+ supportCB.setToolTipText("Enable rigging");
748
+ supportCB.addItemListener(this);
749
+
750
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
751
+ // localCB.addItemListener(this);
752
+
753
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
754
+ crowdCB.setToolTipText("Used for crowds");
755
+ crowdCB.addItemListener(this);
756
+
757
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
758
+ smoothCB.setToolTipText("Snapping delay");
759
+ smoothCB.addItemListener(this);
760
+
761
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
762
+ slowCB.setToolTipText("Smooth interpolation");
763
+ slowCB.addItemListener(this);
764
+
765
+// constraints.gridy += 1;
766
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
767
+// speakerMocapCB.addItemListener(this);
768
+
769
+ if (false)
770
+ {
771
+ // handled in scripts
772
+ //constraints.gridy += 1;
773
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
774
+ speakerCameraCB.addItemListener(this);
775
+
776
+ //constraints.gridy += 1;
777
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
778
+ speakerFocusCB.addItemListener(this);
779
+
780
+ //constraints.gridy += 1;
781
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
782
+ smoothfocusCB.addItemListener(this);
783
+ }
784
+
785
+//constraints.gridx += 1;
786
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
787
+// debugCB.addItemListener(this);
788
+
789
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
790
+ oeilCB.addItemListener(this);
791
+
792
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
793
+ lookAtCB.setToolTipText("Look-at target");
794
+ lookAtCB.addItemListener(this);
795
+
796
+ }
797
+
798
+ cGridBag fill = new cGridBag();
799
+
800
+ fill.preferredHeight = 200;
801
+
802
+ panel.add(fill);
803
+
804
+ }
636805
637806 void EditObject(Object3D obj)
638807 {
639
- cRadio dummyButton = new cRadio(obj.name);
640
- dummyButton.SetObject(obj);
641
- dummyButton.layout = sevenButton;
642
- dummyButton.SetCamera(cameraView.renderCamera, false);
643
- dummyButton.addActionListener(this);
644
- radioPanel.add(dummyButton);
645
- buttonGroup.add(dummyButton);
646
- dummyButton.doClick();
808
+ cRadio radioButton = new cRadio(obj.name);
809
+ radioButton.SetObject(obj);
810
+ radioButton.layout = sevenButton;
811
+ radioButton.SetCamera(cameraView.renderCamera, false);
812
+ radioButton.addActionListener(this);
813
+ radioPanel.add(radioButton);
814
+ buttonGroup.add(radioButton);
815
+ radioButton.doClick();
647816 }
817
+
648818 void SetupViews(ObjEditor oe)
649819 {
650820 oe.SetupViews();
....@@ -663,6 +833,7 @@
663833 JCheckBox fastCB;
664834 JCheckBox slowCB;
665835 JCheckBox boxCB;
836
+ JCheckBox zoomBoxCB;
666837 JCheckBox trackCB;
667838 JCheckBox smoothfocusCB;
668839 // JCheckBox speakerMocapCB;
....@@ -705,10 +876,10 @@
705876 dropAttributes |= Object3D.TEXTURE;
706877 else
707878 dropAttributes &= ~Object3D.TEXTURE;
708
- }
709
- else if(e.getSource() == liveCB)
879
+ } else if(e.getSource() == liveCB)
710880 {
711881 cameraView.ToggleLive();
882
+ refreshContents(false);
712883 }
713884 else if(e.getSource() == supportCB)
714885 {
....@@ -743,6 +914,10 @@
743914 Recompile();
744915 cameraView.repaint();
745916 // refreshContents();
917
+ }
918
+ else if(e.getSource() == zoomBoxCB)
919
+ {
920
+ cameraView.ToggleZoomBoxMode();
746921 }
747922 else if(e.getSource() == smoothfocusCB)
748923 {
....@@ -857,7 +1032,9 @@
8571032 // objEditor.DropFile((java.io.File[]) object, true);
8581033 // return;
8591034 // }
860
- if (string.charAt(0) == '/')
1035
+
1036
+ // File path for Mac and Windows
1037
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8611038 {
8621039 // file(s)
8631040 String[] names = string.split("\n");
....@@ -884,7 +1061,7 @@
8841061
8851062 flashIt = false;
8861063 CameraPane pane = (CameraPane) target;
887
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1064
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8881065 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8891066
8901067 if (group.selection.size() == 1)
....@@ -911,11 +1088,11 @@
9111088 {
9121089 loadClipboard(true);
9131090 objEditor.jTree.setSelectionPath(destinationPath);
914
- pasteInto(false);
1091
+ pasteInto(false, false);
9151092 } else {
9161093 loadClipboard(false);
9171094 objEditor.jTree.setSelectionPath(destinationPath);
918
- pasteInto(false); // true); // ???
1095
+ pasteInto(false, false); // true); // ???
9191096 }
9201097 }
9211098 public void dropActionChanged(DropTargetDragEvent dtde)
....@@ -1033,29 +1210,37 @@
10331210 torusItem.addActionListener(this);
10341211 superItem = menu.add(new MenuItem("Superellipsoid"));
10351212 superItem.addActionListener(this);
1213
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1214
+ kleinItem.addActionListener(this);
10361215 particleItem = menu.add(new MenuItem("Particle system"));
10371216 particleItem.addActionListener(this);
1217
+ if (Globals.ADVANCED)
1218
+ {
10381219 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10391220 ragdollItem.addActionListener(this);
10401221 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10411222 ragdoll2Item.addActionListener(this);
1223
+ }
10421224 menu.add("-");
1043
- meshItem = menu.add(new MenuItem("Mesh"));
1225
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10441226 meshItem.addActionListener(this);
10451227 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10461228 // meshGroupItem.addActionListener(this);
1229
+ if (Globals.ADVANCED)
1230
+ {
10471231 springItem = menu.add(new MenuItem("Spring"));
10481232 springItem.addActionListener(this);
10491233 flagItem = menu.add(new MenuItem("Flag"));
10501234 flagItem.addActionListener(this);
1051
- bezierItem = menu.add(new MenuItem("Patch"));
1052
- bezierItem.addActionListener(this);
1053
- checkerItem = menu.add(new MenuItem("Checker"));
1054
- checkerItem.addActionListener(this);
10551235 blobItem = menu.add(new MenuItem("Blob"));
10561236 blobItem.addActionListener(this);
10571237 latheItem = menu.add(new MenuItem("Lathe"));
10581238 latheItem.addActionListener(this);
1239
+ }
1240
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1241
+ bezierItem.addActionListener(this);
1242
+ overlayItem = menu.add(new MenuItem("Overlay"));
1243
+ overlayItem.addActionListener(this);
10591244 lightItem = menu.add(new MenuItem("Light"));
10601245 lightItem.addActionListener(this);
10611246 menu.add("-");
....@@ -1065,39 +1250,44 @@
10651250 loopItem.addActionListener(this);
10661251 doubleItem = menu.add(new MenuItem("Fork"));
10671252 doubleItem.addActionListener(this);
1253
+ if (Globals.ADVANCED)
1254
+ {
10681255 tripleItem = menu.add(new MenuItem("Trident"));
10691256 tripleItem.addActionListener(this);
1257
+ }
10701258 }
10711259
10721260 void buildToolsMenu(Menu menu)
10731261 {
10741262 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10751263 animationItem.addItemListener(this);
1076
- animationItem.setState(CameraPane.ANIMATION);
1264
+ animationItem.setState(Globals.ANIMATION);
10771265
10781266 menu.add("-");
10791267 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10801268 parseverticesItem.addActionListener(this);
10811269 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10821270 textureFieldItem.addActionListener(this);
1083
- alignItem = menu.add(new MenuItem("Align"));
1271
+ alignItem = menu.add(new MenuItem("Align Objects"));
10841272 alignItem.addActionListener(this);
1085
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1086
- mirrorItem.addActionListener(this);
10871273 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10881274 reduceMorphItem.addActionListener(this);
10891275 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10901276 reduce34MorphItem.addActionListener(this);
1091
-
1277
+ menu.add("-");
10921278 menu.add(computeAOItem = new MenuItem("Compute AO"));
10931279 computeAOItem.addActionListener(this);
1094
- menu.add("-");
10951280
1281
+ if (Globals.ADVANCED)
1282
+ {
1283
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1284
+ mirrorItem.addActionListener(this);
1285
+ menu.add("-");
10961286 menu.add(memoryItem = new MenuItem("Memory Usage"));
10971287 memoryItem.addActionListener(this);
10981288 menu.add(analyzeItem = new MenuItem("Analyze"));
10991289 analyzeItem.addActionListener(this);
1100
- menu.add(dumpItem = new MenuItem("Dump"));
1290
+ menu.add(dumpItem = new MenuItem("Print"));
11011291 dumpItem.addActionListener(this);
11021292 // menu.add(pathItem = new MenuItem("From-to path"));
11031293 // pathItem.addActionListener(this);
....@@ -1106,6 +1296,8 @@
11061296 resetParentItem.addActionListener(this);
11071297 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11081298 repairParentItem.addActionListener(this);
1299
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1300
+ repairShadowItem.addActionListener(this);
11091301 menu.add(invariantsItem = new MenuItem("Invariants"));
11101302 invariantsItem.addActionListener(this);
11111303 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1113,6 +1305,7 @@
11131305 menu.add("-");
11141306 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11151307 editScriptItem.addActionListener(this);
1308
+ }
11161309 }
11171310
11181311 void ScreenFit()
....@@ -1441,9 +1634,9 @@
14411634
14421635 void Overwrite(int mask)
14431636 {
1444
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1637
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14451638 {
1446
- Object3D content = GraphreeD.clipboard.get(0);
1639
+ Object3D content = Grafreed.clipboard.get(0);
14471640
14481641 if (content instanceof cGroup && ((cGroup)content).transientlink )
14491642 content = ((cGroup)content).get(0);
....@@ -1466,6 +1659,7 @@
14661659 //
14671660 public void actionPerformed(ActionEvent event) // , Object arg)
14681661 {
1662
+ Object source = event.getSource();
14691663 /*
14701664 if (event.getSource() == nameField)
14711665 {
....@@ -1477,11 +1671,11 @@
14771671 }
14781672 else
14791673 */
1480
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1674
+ if (source == lookAtItem || source == lookFromItem)
14811675 {
14821676 ScreenFit();
14831677 } else
1484
- if (event.getSource() == switchItem)
1678
+ if (source == switchItem)
14851679 {
14861680 cVector v1 = new cVector();
14871681 cVector v2 = new cVector();
....@@ -1490,11 +1684,11 @@
14901684 objEditor.cameraView.renderCamera.setAim(v2, v1);
14911685 objEditor.cameraView.repaint();
14921686 } else
1493
- if (event.getSource() == rectoidItem)
1687
+ if (source == rectoidItem)
14941688 {
14951689 makeSomething(new Box());
14961690 } else
1497
- if (event.getSource() == particleItem)
1691
+ if (source == particleItem)
14981692 {
14991693 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15001694 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1515,9 +1709,9 @@
15151709 applyExample(particleGeom, "SMOKE");
15161710 makeSomething(particleGeom);
15171711 } else
1518
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1712
+ if (source == ragdollItem || source == ragdoll2Item)
15191713 {
1520
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1714
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15211715
15221716 ragdoll.toParent = LA.newMatrix();
15231717 ragdoll.fromParent = LA.newMatrix();
....@@ -1535,7 +1729,7 @@
15351729 } else
15361730 /*
15371731 */
1538
- if (event.getSource() == heightFieldItem)
1732
+ if (source == heightFieldItem)
15391733 {
15401734 Object3D obj = new Object3D();
15411735
....@@ -1573,27 +1767,31 @@
15731767
15741768 makeSomething(obj);
15751769 } else
1576
- if (event.getSource() == gridItem)
1770
+ if (source == gridItem)
15771771 {
15781772 makeSomething(new Grid());
15791773 } else
1580
- if (event.getSource() == ellipsoidItem)
1774
+ if (source == ellipsoidItem)
15811775 {
15821776 makeSomething(new Sphere());
15831777 } else
1584
- if (event.getSource() == coneItem)
1778
+ if (source == coneItem)
15851779 {
15861780 makeSomething(new Cone());
15871781 } else
1588
- if (event.getSource() == torusItem)
1782
+ if (source == torusItem)
15891783 {
15901784 makeSomething(new Torus());
15911785 } else
1592
- if (event.getSource() == superItem)
1786
+ if (source == superItem)
15931787 {
15941788 makeSomething(new Superellipsoid());
15951789 } else
1596
- if (event.getSource() == blobItem)
1790
+ if (source == kleinItem)
1791
+ {
1792
+ makeSomething(new Klein());
1793
+ } else
1794
+ if (source == blobItem)
15971795 {
15981796 Blob blob = new Blob();
15991797 BlobComponent comp = new BlobComponent();
....@@ -1601,15 +1799,15 @@
16011799 //blob.retile();
16021800 makeSomething(blob);
16031801 } else
1604
- if (event.getSource() == latheItem)
1802
+ if (source == latheItem)
16051803 {
16061804 makeSomething(new Lathe());
16071805 } else
1608
- if (event.getSource() == bezierItem)
1806
+ if (source == bezierItem)
16091807 {
16101808 makeSomething(new BezierSurface());
16111809 } else
1612
- if (event.getSource() == checkerItem)
1810
+ if (source == overlayItem)
16131811 {
16141812 /*
16151813 Object3D obj = new BezierSurface(5,8);
....@@ -1624,7 +1822,7 @@
16241822 */
16251823 makeSomething(new Checker());
16261824 } else
1627
- if (event.getSource() == meshItem)
1825
+ if (source == meshItem)
16281826 {
16291827 Object3D itemtomake = new Object3D();
16301828 Object3D child;
....@@ -1645,35 +1843,35 @@
16451843 makeSomething(child);
16461844 }
16471845 } else
1648
- if (event.getSource() == springItem)
1846
+ if (source == springItem)
16491847 {
16501848 cSpring s = new cSpring();
16511849 s.setup();
16521850 makeSomething(s);
16531851 } else
1654
- if (event.getSource() == flagItem)
1852
+ if (source == flagItem)
16551853 {
16561854 cSpring s = new cFlag();
16571855 s.setup();
16581856 makeSomething(s);
16591857 } else
1660
- if (event.getSource() == lightItem)
1858
+ if (source == lightItem)
16611859 {
16621860 makeSomething(new Light());
16631861 } else
1664
- if (event.getSource() == csgItem)
1862
+ if (source == csgItem)
16651863 {
16661864 group(new CSG());
16671865 } else
1668
- if (event.getSource() == templateItem)
1866
+ if (source == templateItem)
16691867 {
16701868 group(new cTemplate());
16711869 } else
1672
- if (event.getSource() == attributeItem)
1870
+ if (source == attributeItem)
16731871 {
16741872 makeSomething(new Attribute());
16751873 } else
1676
- if (event.getSource() == pointflowItem)
1874
+ if (source == pointflowItem)
16771875 {
16781876 makeSomething(new PointFlow());
16791877 } else
....@@ -1685,7 +1883,7 @@
16851883 } else
16861884 */
16871885
1688
- if (event.getSource() == superLoopItem)
1886
+ if (source == superLoopItem)
16891887 {
16901888 Composite g = new cGroup();
16911889 for (int i=0; i<15; i++)
....@@ -1707,7 +1905,7 @@
17071905
17081906 group(g);
17091907 } else
1710
- if (event.getSource() == loopItem)
1908
+ if (source == loopItem)
17111909 {
17121910 Composite csg = new GroupLeaf();
17131911 csg.count = 5;
....@@ -1716,7 +1914,7 @@
17161914 csg.addChild(child);
17171915 child.addChild(csg);
17181916 } else
1719
- if (event.getSource() == doubleItem)
1917
+ if (source == doubleItem)
17201918 {
17211919 Composite csg = new GroupLeaf();
17221920 csg.count = 5;
....@@ -1728,7 +1926,7 @@
17281926 csg.addChild(child);
17291927 child.addChild(csg);
17301928 } else
1731
- if (event.getSource() == tripleItem)
1929
+ if (source == tripleItem)
17321930 {
17331931 Composite csg = new GroupLeaf();
17341932 csg.count = 4;
....@@ -1743,71 +1941,71 @@
17431941 csg.addChild(child);
17441942 child.addChild(csg);
17451943 } else
1746
-
1747
- if (event.getSource() == importGFDItem)
1944
+ if (source == computeAOItem)
17481945 {
1749
- ImportGFD();
1946
+ Globals.drawMode = CameraPane.OCCLUSION;
1947
+ Globals.theRenderer.repaint();
17501948 } else
1751
- if (event.getSource() == importVRMLX3DItem)
1752
- {
1753
- ImportVRMLX3D();
1754
- } else
1755
- if (event.getSource() == import3DSItem)
1756
- {
1757
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1758
- } else
1759
- if (event.getSource() == importOBJItem)
1760
- {
1761
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1762
- } else
1763
- if (event.getSource() == computeAOItem)
1764
- {
1765
- CameraPane.drawMode = CameraPane.OCCLUSION;
1766
- CameraPane.theRenderer.repaint();
1767
- } else
1768
- if (event.getSource() == recompileItem)
1949
+ if (source == recompileItem)
17691950 {
17701951 Recompile();
17711952 refreshContents();
17721953 } else
1773
- if (event.getSource() == editScriptItem)
1954
+ if (source == editScriptItem)
17741955 {
17751956 OpenDialog();
17761957 refreshContents();
17771958 } else
1778
- if (event.getSource() == invariantsItem)
1959
+ if (source == invariantsItem)
17791960 {
17801961 System.out.println("Invariants:");
1781
- GraphreeD.theApplet3D.universe.invariants();
1962
+ Grafreed.grafreeD.universe.invariants();
17821963 } else
1783
- if (event.getSource() == memoryItem)
1964
+ if (source == memoryItem)
17841965 {
17851966 //System.out.println("Invariants:");
17861967 PrintMemory();
17871968 } else
1788
- if (event.getSource() == pathItem)
1969
+ if (source == pathItem)
17891970 {
17901971 PrintPath();
17911972 } else
1792
- if (event.getSource() == analyzeItem)
1973
+ if (source == analyzeItem)
17931974 {
17941975 AnalyzeObject();
17951976 } else
1796
- if (event.getSource() == dumpItem)
1977
+ if (source == dumpItem)
17971978 {
17981979 DumpObject();
17991980 } else
1800
- if (event.getSource() == screenfitButton)
1981
+ if (source == undoButton)
1982
+ {
1983
+ Undo();
1984
+ } else
1985
+ if (source == redoButton)
1986
+ {
1987
+ Redo();
1988
+ } else
1989
+ if (source == saveButton)
1990
+ {
1991
+ Save();
1992
+ } else
1993
+ if (source == oneStepButton)
1994
+ {
1995
+ Globals.ONESTEP = true;
1996
+ cameraView.repaint();
1997
+ } else
1998
+ if (source == screenfitButton)
18011999 {
18022000 //Reload(lastConverter, lastFilename, true);
18032001 ScreenFit();
18042002 } else
1805
- if (event.getSource() == screenfitpointButton)
2003
+ if (source == screenfitpointButton)
18062004 {
18072005 //Reload(lastConverter, lastFilename, true);
18082006 ScreenFitPoint();
18092007 } else
1810
- if (event.getSource() == snapobjectButton)
2008
+ if (source == snapobjectButton)
18112009 {
18122010 //Reload(lastConverter, lastFilename, true);
18132011 SnapObject();
....@@ -1818,13 +2016,13 @@
18182016 // Recompile();
18192017 // refreshContents();
18202018 // } else
1821
- if (event.getSource() == gcButton)
2019
+ if (source == gcButton)
18222020 {
18232021 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18242022 System.gc();
18252023 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262024 } else
1827
- if (event.getSource() == editLeafItem)
2025
+ if (source == editLeafItem)
18282026 {
18292027 Object3D obj;
18302028 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1838,65 +2036,78 @@
18382036 }
18392037 refreshContents(true);
18402038 } else
1841
- if (event.getSource() == openWindowItem)
2039
+ if (source == openWindowItem)
18422040 {
18432041 EditSelection(true);
18442042 } else
1845
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2043
+ if (source == cutItem || source == clearButton)
18462044 {
18472045 loadClipboard(true);
18482046 } else
1849
- if (event.getSource() == duplicateItem)
2047
+ if (source == undoItem)
18502048 {
1851
- Object3D keep = GraphreeD.clipboard;
2049
+ Undo();
2050
+ } else
2051
+ if (source == redoItem)
2052
+ {
2053
+ Redo();
2054
+ } else
2055
+ if (source == duplicateItem)
2056
+ {
2057
+ Object3D keep = Grafreed.clipboard;
18522058 loadClipboard(false);
18532059 paste(false);
1854
- GraphreeD.clipboard = keep;
2060
+ Grafreed.clipboard = keep;
18552061 } else
1856
- if (event.getSource() == cloneItem)
2062
+ if (source == cloneItem)
18572063 {
18582064 CloneSelection(false);
18592065 } else
1860
- if (event.getSource() == cloneSupportItem)
2066
+ if (source == cloneSupportItem)
18612067 {
18622068 CloneSelection(true);
18632069 } else
1864
- if (event.getSource() == copyItem)
2070
+ if (source == copyItem)
18652071 {
18662072 loadClipboard(false);
18672073 } else
1868
- if (event.getSource() == pasteItem)
2074
+ if (source == pasteItem)
18692075 {
18702076 paste(false);
18712077 } else
1872
- if (event.getSource() == pasteLinkItem)
2078
+ if (source == pasteIntoItem)
18732079 {
1874
- pasteInto(false);
2080
+ pasteInto(true, false);
18752081 } else
1876
- if (event.getSource() == pasteCloneItem)
2082
+ if (source == pasteLinkItem)
18772083 {
1878
- pasteInto(true);
2084
+ pasteInto(false, false);
18792085 } else
1880
- if (event.getSource() == pasteExpandItem)
2086
+ if (source == pasteCloneItem)
2087
+ {
2088
+ pasteInto(true, true);
2089
+ } else
2090
+ if (source == pasteExpandItem)
18812091 {
18822092 paste(true);
18832093 } else
1884
- if (event.getSource() == synchronizeItem)
2094
+ if (source == synchronizeItem)
18852095 {
18862096 Overwrite(Object3D.TRANSFORM);
18872097 } else
1888
- if (event.getSource() == overwriteNameItem)
2098
+ if (source == overwriteNameItem)
18892099 {
18902100 Overwrite(Object3D.NAME);
18912101 } else
1892
- if (event.getSource() == overwriteUVItem)
2102
+ if (source == overwriteUVItem)
18932103 {
18942104 Overwrite(Object3D.UV);
18952105 } else
1896
- if (event.getSource() == overwriteMatItem)
2106
+ if (source == overwriteMatItem)
18972107 {
2108
+ /* july 2015
18982109 if ((dropAttributes & Object3D.TEXTURE) == 0)
1899
- Overwrite(Object3D.MATERIAL);
2110
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
19002111 else
19012112 {
19022113 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1908,13 +2119,16 @@
19082119 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
19092120 }
19102121 }
2122
+ */
2123
+
2124
+ Overwrite(dropAttributes);
19112125 }
1912
- if (event.getSource() == overwriteGeoItem)
2126
+ if (source == overwriteGeoItem)
19132127 {
19142128 Overwrite(Object3D.GEOMETRY);
1915
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2129
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
19162130 // {
1917
-// Object3D content = GraphreeD.clipboard.get(0);
2131
+// Object3D content = GrafreeD.clipboard.get(0);
19182132 //
19192133 // if (content instanceof cGroup && ((cGroup)content).transientlink )
19202134 // content = ((cGroup)content).get(0);
....@@ -1926,7 +2140,7 @@
19262140 // refreshContents();
19272141 // }
19282142 } else
1929
- if (event.getSource() == generateMeshItem)
2143
+ if (source == generateMeshItem)
19302144 {
19312145 //if (group.selection.size() == 1)
19322146 // for (int i=0; i<group.selection.size(); i++)
....@@ -1937,7 +2151,7 @@
19372151 ResetModel();
19382152 refreshContents();
19392153 } else
1940
- if (event.getSource() == extractGeometriesItem)
2154
+ if (source == extractGeometriesItem)
19412155 {
19422156 boolean one = false;
19432157
....@@ -1964,7 +2178,7 @@
19642178 ResetModel();
19652179 refreshContents();
19662180 } else
1967
- if (event.getSource() == cloneGeometriesItem)
2181
+ if (source == cloneGeometriesItem)
19682182 {
19692183 boolean one = false;
19702184
....@@ -1990,32 +2204,37 @@
19902204 ResetModel();
19912205 refreshContents();
19922206 } else
1993
- if (event.getSource() == shareGeometriesItem)
2207
+ if (source == shareGeometriesItem)
19942208 {
19952209 boolean one = false;
19962210
19972211 if (group.selection.size() == 1)
19982212 one = true;
19992213
2214
+ Object3D merge = null;
2215
+
20002216 Object3D content = new cGroup();
20012217
20022218 for (int i=0; i<group.selection.size(); i++)
20032219 {
2004
- Object3D sel = new Merge(group.selection.get(i));
2220
+ merge = new Merge(group.selection.get(i));
20052221
20062222 if (one)
2007
- makeSomething(sel, false);
2223
+ makeSomething(merge, false);
20082224 else
2009
- content.addChild(sel);
2225
+ content.addChild(merge);
20102226 }
20112227
20122228 if (!one)
2013
- makeSomething(content, false);
2014
-
2015
- ResetModel();
2016
- refreshContents();
2229
+ makeSomething(content, true);
2230
+ else
2231
+ {
2232
+ ResetModel();
2233
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2234
+ refreshContents();
2235
+ }
20172236 } else
2018
- if (event.getSource() == mergeGeometriesItem)
2237
+ if (source == mergeGeometriesItem)
20192238 {
20202239 boolean one = false;
20212240
....@@ -2045,11 +2264,11 @@
20452264 ResetModel();
20462265 refreshContents();
20472266 } else
2048
- if (event.getSource() == linkverticesItem)
2267
+ if (source == linkverticesItem)
20492268 {
2050
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2269
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20512270 // {
2052
-// Object3D content = GraphreeD.clipboard.get(0);
2271
+// Object3D content = GrafreeD.clipboard.get(0);
20532272 //
20542273 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20552274 // content = ((cGroup)content).get(0);
....@@ -2058,39 +2277,48 @@
20582277 // group.selection.get(0).setMasterThis(content); // should be identity
20592278 // refreshContents();
20602279 // }
2061
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2280
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20622281 {
2063
- Object3D content = GraphreeD.clipboard.get(0);
2282
+ Object3D content = Grafreed.clipboard.get(0);
20642283
20652284 if (content instanceof cGroup && ((cGroup)content).transientlink )
20662285 content = ((cGroup)content).get(0);
20672286
2068
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2287
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20692288 for (int i=0; i<group.selection.size(); i++)
20702289 {
2071
- boolean random = CameraPane.RANDOM;
2072
- CameraPane.RANDOM = false; // parse all random nodes
2290
+ boolean random = CameraPane.SWITCH;
2291
+ CameraPane.SWITCH = false; // parse all random nodes
20732292 group.selection.get(i).linkVerticesThis(content);
20742293 // group.selection.get(i).setMasterThis(content); // should be identity
2075
- CameraPane.RANDOM = random;
2294
+ CameraPane.SWITCH = random;
20762295 }
2077
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2296
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20782297 refreshContents();
20792298 }
20802299 } else
2081
- if (event.getSource() == resetsupportItem)
2300
+ if (source == resetsupportItem)
20822301 {
20832302 for (int i=0; i<group.selection.size(); i++)
20842303 {
2085
- boolean random = CameraPane.RANDOM;
2086
- CameraPane.RANDOM = false; // parse all random nodes
2304
+ boolean random = CameraPane.SWITCH;
2305
+ CameraPane.SWITCH = false; // parse all random nodes
20872306 group.selection.get(i).linkVerticesThis(null);
2088
- CameraPane.RANDOM = random;
2307
+ CameraPane.SWITCH = random;
20892308 }
20902309
20912310 refreshContents();
20922311 } else
2093
- if (event.getSource() == resetreferencesItem)
2312
+ if (source == relinkverticesItem)
2313
+ {
2314
+ boolean random = CameraPane.SWITCH;
2315
+ CameraPane.SWITCH = false; // parse all random nodes
2316
+ group.selection.RelinkToSupport();
2317
+ CameraPane.SWITCH = random;
2318
+
2319
+ refreshContents();
2320
+ } else
2321
+ if (source == resetreferencesItem)
20942322 {
20952323 for (int i=0; i<group.selection.size(); i++)
20962324 {
....@@ -2099,11 +2327,11 @@
20992327
21002328 refreshContents();
21012329 } else
2102
- if (event.getSource() == setMasterItem)
2330
+ if (source == setMasterItem)
21032331 {
2104
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2332
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21052333 {
2106
- Object3D content = GraphreeD.clipboard.get(0);
2334
+ Object3D content = Grafreed.clipboard.get(0);
21072335
21082336 if (content instanceof cGroup && ((cGroup)content).transientlink )
21092337 content = ((cGroup)content).get(0);
....@@ -2112,13 +2340,13 @@
21122340 refreshContents();
21132341 }
21142342 } else
2115
- if (event.getSource() == poseMeshItem)
2343
+ if (source == poseMeshItem)
21162344 {
21172345 if (group.selection.size() == 1)
21182346 {
2119
- if (GraphreeD.clipboard.size() == 1)
2347
+ if (Grafreed.clipboard.size() == 1)
21202348 {
2121
- Object3D content = GraphreeD.clipboard.get(0);
2349
+ Object3D content = Grafreed.clipboard.get(0);
21222350
21232351 if (content instanceof cGroup && ((cGroup)content).transientlink )
21242352 content = ((cGroup)content).get(0);
....@@ -2131,19 +2359,19 @@
21312359 }
21322360
21332361 } else
2134
- if (event.getSource() == revertMeshItem)
2362
+ if (source == revertMeshItem)
21352363 {
21362364 RevertMeshes();
21372365 } else
2138
- if (event.getSource() == resetMeshItem)
2366
+ if (source == resetAllItem)
21392367 {
21402368 ResetAll();
21412369 } else
2142
- if (event.getSource() == stepAllItem)
2370
+ if (source == stepAllItem)
21432371 {
21442372 StepAll();
21452373 } else
2146
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2374
+ if (source == clearItem) // || event.getSource() == clearButton)
21472375 {
21482376 //int indices[] = jList.getSelectedIndices();
21492377 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2151,42 +2379,46 @@
21512379
21522380 ClearSelection(false);
21532381 } else
2154
- if (event.getSource() == clearAllItem)
2382
+ if (source == clearAllItem)
21552383 {
21562384 ClearSelection(true);
21572385 } else
2158
- if (event.getSource() == grabItem)
2386
+ if (source == grabItem)
21592387 {
21602388 group(new cGroup(), true);
21612389 } else
2162
- if (event.getSource() == frontItem)
2390
+ if (source == hideItem)
2391
+ {
2392
+ group(new HiddenObject());
2393
+ } else
2394
+ if (source == frontItem)
21632395 {
21642396 front();
21652397 } else
2166
- if (event.getSource() == backItem)
2398
+ if (source == backItem)
21672399 {
21682400 back();
21692401 } else
2170
- if (event.getSource() == cameraItem)
2402
+ if (source == cameraItem)
21712403 {
21722404 makeSomething(new Camera());
21732405 } else
2174
- if (event.getSource() == compositeItem)
2406
+ if (source == compositeItem)
21752407 {
21762408 group(new Composite());
21772409 } else
2178
- if (event.getSource() == randomItem)
2410
+ if (source == randomItem)
21792411 {
21802412 RandomNode random = new RandomNode();
21812413 group(random);
21822414 if (random.size() > 0)
2183
- random.name = random.get(0).name + "Rnd";
2415
+ random.name = random.get(0).name + "Switch";
21842416 } else
2185
- if (event.getSource() == physicsItem)
2417
+ if (source == physicsItem)
21862418 {
21872419 group(new PhysicsNode());
21882420 } else
2189
- if (event.getSource() == frameselectorItem)
2421
+ if (source == frameselectorItem)
21902422 {
21912423 for (int i=0; i<group.selection.size(); i++)
21922424 {
....@@ -2198,7 +2430,7 @@
21982430 ResetModel();
21992431 refreshContents();
22002432 } else
2201
- if (event.getSource() == switchGeoItem)
2433
+ if (source == switchGeoItem)
22022434 {
22032435 for (int i=0; i<group.selection.size(); i++)
22042436 {
....@@ -2210,7 +2442,7 @@
22102442 ResetModel();
22112443 refreshContents();
22122444 } else
2213
- if (event.getSource() == switchTransfoItem)
2445
+ if (source == switchTransfoItem)
22142446 {
22152447 for (int i=0; i<group.selection.size(); i++)
22162448 {
....@@ -2222,7 +2454,7 @@
22222454 ResetModel();
22232455 refreshContents();
22242456 } else
2225
- if (event.getSource() == morphItem)
2457
+ if (source == morphItem)
22262458 {
22272459 for (int i=0; i<group.selection.size(); i++)
22282460 {
....@@ -2234,7 +2466,7 @@
22342466 ResetModel();
22352467 refreshContents();
22362468 } else
2237
- if (event.getSource() == scriptNodeItem)
2469
+ if (source == scriptNodeItem)
22382470 {
22392471 boolean atleastone = false;
22402472
....@@ -2273,195 +2505,239 @@
22732505 }
22742506 }
22752507 } else
2276
- if (event.getSource() == linkerItem)
2508
+ if (source == linkerItem)
22772509 {
22782510 group(new cLinker());
22792511 } else
2280
- if (event.getSource() == textureItem)
2512
+ if (source == textureItem)
22812513 {
22822514 group(new TextureNode());
22832515 } else
2284
- if (event.getSource() == shadowXItem)
2516
+ if (source == billboardItem)
2517
+ {
2518
+ group(new BillboardNode());
2519
+ } else
2520
+ if (source == shadowXItem)
22852521 {
22862522 CastShadow(0);
22872523 } else
2288
- if (event.getSource() == shadowYItem)
2524
+ if (source == shadowYItem)
22892525 {
22902526 CastShadow(1);
22912527 } else
2292
- if (event.getSource() == shadowZItem)
2528
+ if (source == shadowZItem)
22932529 {
22942530 CastShadow(2);
22952531 } else
2296
- if (event.getSource() == ungroupItem)
2532
+ if (source == ungroupItem)
22972533 {
2298
- ungroup();
2534
+ //ungroup();
2535
+ for (int i=0; i<group.selection.size(); i++)
2536
+ {
2537
+ Ungroup(group.selection.get(i));
2538
+ }
2539
+
2540
+ ClearSelection(false);
2541
+
2542
+ refreshContents();
22992543 } else
2300
- if (event.getSource() == genUVItem)
2544
+ if (source == genUVItem)
23012545 {
23022546 GenUV();
23032547 } else
2304
- if (event.getSource() == genNormalsCADItem)
2548
+ if (source == genNormalsCADItem)
23052549 {
23062550 GenNormals(true);
23072551 } else
2308
- if (event.getSource() == genNormalsORGANItem)
2552
+ if (source == genNormalsMESHItem)
2553
+ {
2554
+ GenNormalsMESH();
2555
+ } else
2556
+ if (source == genNormalsORGANItem)
23092557 {
23102558 GenNormals(false);
23112559 } else
2312
- if (event.getSource() == stripifyItem)
2560
+ if (source == genNormalsMINEItem)
2561
+ {
2562
+ GenNormalsMINE();
2563
+ } else
2564
+ if (source == stripifyItem)
23132565 {
23142566 Stripify();
23152567 } else
2316
- if (event.getSource() == unstripifyItem)
2568
+ if (source == unstripifyItem)
23172569 {
23182570 Unstripify();
23192571 } else
2320
- if (event.getSource() == trimItem)
2572
+ if (source == trimItem)
23212573 {
23222574 Trim();
23232575 } else
2324
- if (event.getSource() == untrimItem)
2576
+ if (source == untrimItem)
23252577 {
23262578 Untrim();
23272579 } else
2328
- if (event.getSource() == clearColorsItem)
2580
+ if (source == clearColorsItem)
23292581 {
23302582 ClearColors();
23312583 } else
2332
- if (event.getSource() == clearMaterialsItem)
2584
+ if (source == clearMaterialsItem)
23332585 {
23342586 ClearMaterials();
23352587 } else
2336
- if (event.getSource() == liveleavesItem)
2588
+ if (source == liveleavesItem)
23372589 {
23382590 LiveLeaves(true);
23392591 } else
2340
- if (event.getSource() == unliveleavesItem)
2592
+ if (source == unliveleavesItem)
23412593 {
23422594 LiveLeaves(false);
23432595 } else
2344
- if (event.getSource() == supportleavesItem)
2596
+ if (source == supportleavesItem)
23452597 {
23462598 SupportLeaves(true);
23472599 } else
2348
- if (event.getSource() == unsupportleavesItem)
2600
+ if (source == unsupportleavesItem)
23492601 {
23502602 SupportLeaves(false);
23512603 } else
2352
- if (event.getSource() == hideleavesItem)
2604
+ if (source == hideleavesItem)
23532605 {
23542606 HideLeaves(true);
23552607 } else
2356
- if (event.getSource() == showleavesItem)
2608
+ if (source == showleavesItem)
23572609 {
23582610 HideLeaves(false);
23592611 } else
2360
- if (event.getSource() == markleavesItem)
2612
+ if (source == markleavesItem)
23612613 {
23622614 MarkLeaves(true);
23632615 } else
2364
- if (event.getSource() == unmarkleavesItem)
2616
+ if (source == unmarkleavesItem)
23652617 {
23662618 MarkLeaves(false);
23672619 } else
2368
- if (event.getSource() == flipVItem)
2620
+ if (source == rewindleavesItem)
2621
+ {
2622
+ RewindLeaves(true);
2623
+ } else
2624
+ if (source == unrewindleavesItem)
2625
+ {
2626
+ RewindLeaves(false);
2627
+ } else
2628
+ if (source == randomleavesItem)
2629
+ {
2630
+ RandomLeaves(true);
2631
+ } else
2632
+ if (source == unrandomleavesItem)
2633
+ {
2634
+ RandomLeaves(false);
2635
+ } else
2636
+ if (source == flipVItem)
23692637 {
23702638 FlipV(true);
23712639 } else
2372
- if (event.getSource() == unflipVItem)
2640
+ if (source == unflipVItem)
23732641 {
23742642 FlipV(false);
23752643 } else
2376
- if (event.getSource() == lowTexturesItem)
2644
+ if (source == lowTexturesItem)
23772645 {
23782646 SetTexRes(0);
23792647 } else
2380
- if (event.getSource() == normalTexturesItem)
2648
+ if (source == normalTexturesItem)
23812649 {
23822650 SetTexRes(1);
23832651 } else
2384
- if (event.getSource() == highTexturesItem)
2652
+ if (source == highTexturesItem)
23852653 {
23862654 SetTexRes(2);
23872655 } else
2388
- if (event.getSource() == veryhighTexturesItem)
2656
+ if (source == veryhighTexturesItem)
23892657 {
23902658 SetTexRes(3);
23912659 } else
2392
- if (event.getSource() == maxTexturesItem)
2660
+ if (source == maxTexturesItem)
23932661 {
23942662 SetTexRes(4);
23952663 } else
2396
- if (event.getSource() == panoTexturesItem)
2664
+ if (source == panoTexturesItem)
23972665 {
23982666 SetTexRes(5);
23992667 } else
2400
- if (event.getSource() == reverseNormalsItem)
2668
+ if (source == reverseNormalsItem)
24012669 {
24022670 ReverseNormals();
24032671 } else
2404
- if (event.getSource() == parseverticesItem)
2672
+ if (source == parseverticesItem)
24052673 {
24062674 ParseVertices();
24072675 } else
2408
- if (event.getSource() == textureFieldItem)
2676
+ if (source == textureFieldItem)
24092677 {
24102678 TextureVertices();
24112679 } else
2412
- if (event.getSource() == alignItem)
2680
+ if (source == alignItem)
24132681 {
24142682 Align();
24152683 } else
2416
- if (event.getSource() == mirrorItem)
2684
+ if (source == mirrorItem)
24172685 {
24182686 MirrorPoses();
24192687 } else
2420
- if (event.getSource() == reduceMorphItem)
2688
+ if (source == reduceMorphItem)
24212689 {
24222690 MeshReduction(false);
24232691 } else
2424
- if (event.getSource() == reduce34MorphItem)
2692
+ if (source == reduce34MorphItem)
24252693 {
24262694 MeshReduction(true);
24272695 } else
2428
- if (event.getSource() == reverseTrianglesItem)
2696
+ if (source == reverseTrianglesItem)
24292697 {
24302698 ReverseTriangles();
24312699 } else
2432
- if (event.getSource() == reduceMeshItem)
2700
+ if (source == reduceMeshItem)
24332701 {
24342702 ReduceMesh(false);
24352703 } else
2436
- if (event.getSource() == reduce34MeshItem)
2704
+ if (source == reduce34MeshItem)
24372705 {
24382706 ReduceMesh(true);
24392707 } else
2440
- if (event.getSource() == increaseMeshItem)
2708
+ if (source == increaseMeshItem)
24412709 {
24422710 IncreaseMesh();
24432711 } else
2444
- if (event.getSource() == clipMeshItem)
2712
+ if (source == clipMeshItem)
24452713 {
24462714 ClipMesh();
24472715 } else
2448
- if (event.getSource() == smoothMeshItem)
2716
+ if (source == smoothMeshItem)
24492717 {
24502718 SmoothMesh();
24512719 } else
2452
- if (event.getSource() == transformgeometryItem)
2720
+ if (source == transformGeometryItem)
24532721 {
24542722 TransformGeometry();
24552723 } else
2456
- if (event.getSource() == resetTransformItem)
2724
+ if (source == transformChildrenItem)
2725
+ {
2726
+ TransformChildren();
2727
+ } else
2728
+ if (source == resetTransformItem)
24572729 {
24582730 ResetTransform();
24592731 } else
2460
- if (event.getSource() == resetCentroidItem)
2732
+ if (source == resetCentroidItem)
24612733 {
2462
- ResetCentroid();
2734
+ ResetCentroid(true);
24632735 } else
2464
- if (event.getSource() == resetParentItem)
2736
+ if (source == resetCentroidXZItem)
2737
+ {
2738
+ ResetCentroid(false);
2739
+ } else
2740
+ if (source == resetParentItem)
24652741 {
24662742 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24672743 {
....@@ -2471,7 +2747,7 @@
24712747
24722748 refreshContents();
24732749 } else
2474
- if (event.getSource() == repairParentItem)
2750
+ if (source == repairParentItem)
24752751 {
24762752 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24772753 {
....@@ -2485,7 +2761,21 @@
24852761
24862762 refreshContents();
24872763 } else
2488
- if (event.getSource() == sortbysizeItem)
2764
+ if (source == repairShadowItem)
2765
+ {
2766
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
2767
+ {
2768
+ Object3D obj = (Object3D)e.nextElement();
2769
+ obj.RepairShadow();
2770
+// for (int i=0; i<obj.size(); i++)
2771
+// {
2772
+// obj.get(i).parent = obj;
2773
+// }
2774
+ }
2775
+
2776
+ refreshContents();
2777
+ } else
2778
+ if (source == sortbysizeItem)
24892779 {
24902780 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24912781 {
....@@ -2497,7 +2787,7 @@
24972787 ResetModel();
24982788 refreshContents();
24992789 } else
2500
- if (event.getSource() == sortbynameItem)
2790
+ if (source == sortbynameItem)
25012791 {
25022792 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25032793 {
....@@ -2509,7 +2799,7 @@
25092799 ResetModel();
25102800 refreshContents();
25112801 } else
2512
- if (event.getSource() == attachPigmentItem)
2802
+ if (source == attachPigmentItem)
25132803 {
25142804 String texture = GetFile("Attach pigment");
25152805 Object3D obj;
....@@ -2521,7 +2811,7 @@
25212811
25222812 refreshContents();
25232813 } else
2524
- if (event.getSource() == detachPigmentItem)
2814
+ if (source == detachPigmentItem)
25252815 {
25262816 Object3D obj;
25272817 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2532,7 +2822,7 @@
25322822
25332823 refreshContents();
25342824 } else
2535
- if (event.getSource() == attachBumpItem)
2825
+ if (source == attachBumpItem)
25362826 {
25372827 String texture = GetFile("Attach bump");
25382828 Object3D obj;
....@@ -2544,7 +2834,7 @@
25442834
25452835 refreshContents();
25462836 } else
2547
- if (event.getSource() == detachBumpItem)
2837
+ if (source == detachBumpItem)
25482838 {
25492839 Object3D obj;
25502840 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2555,7 +2845,7 @@
25552845
25562846 refreshContents();
25572847 } else
2558
- if (event.getSource() == pigmentBumpItem)
2848
+ if (source == pigmentBumpItem)
25592849 {
25602850 Object3D obj;
25612851 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2566,158 +2856,195 @@
25662856
25672857 refreshContents();
25682858 } else
2569
- if (event.getSource() == flashSelectionButton)
2859
+ if (source == flashSelectionButton)
25702860 {
25712861 CameraPane.flash = true;
25722862 refreshContents();
25732863 } else
2574
- if (event.getSource() == oneButton)
2864
+ if (source == oneButton)
25752865 {
25762866 } else
2577
- if (event.getSource() == twoButton)
2867
+ if (source == twoButton)
25782868 {
25792869 radio.layout = twoButton;
25802870 // bug
25812871 //gridPanel.setDividerLocation(1.0);
25822872 //bigPanel.setDividerLocation(0.0);
2583
- bigThree.remove(jtp);
2584
- bigThree.remove(cameraPanel);
2585
- bigThree.remove(XYZPanel);
2586
- aWindowConstraints.gridx = 0;
2587
- aWindowConstraints.gridy = 0;
2588
- aWindowConstraints.gridwidth = 1;
2589
- // aConstraints.gridheight = 3;
2590
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2591
- aWindowConstraints.weightx = 0;
2592
- aWindowConstraints.weighty = 1;
2593
- //bigThree.add(jtp, aWindowConstraints);
2594
- aWindowConstraints.weightx = 1;
2595
- aWindowConstraints.gridwidth = 3;
2596
- // aConstraints.gridheight = 3;
2597
- aWindowConstraints.gridx = 1;
2598
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2599
- bigThree.add(cameraPanel, aWindowConstraints);
2600
- aWindowConstraints.weightx = 0;
2601
- aWindowConstraints.gridx = 4;
2602
- aWindowConstraints.gridwidth = 1;
2603
- // aConstraints.gridheight = 3;
2604
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2605
- //bigThree.add(XYZPanel, aWindowConstraints);
2606
- bigThree.revalidate();
2873
+// bigThree.remove(scenePanel);
2874
+// bigThree.remove(centralPanel);
2875
+// bigThree.remove(XYZPanel);
2876
+// aWindowConstraints.gridx = 0;
2877
+// aWindowConstraints.gridy = 0;
2878
+// aWindowConstraints.gridwidth = 1;
2879
+// // aConstraints.gridheight = 3;
2880
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2881
+// aWindowConstraints.weightx = 0;
2882
+// aWindowConstraints.weighty = 1;
2883
+// //bigThree.add(jtp, aWindowConstraints);
2884
+// aWindowConstraints.weightx = 1;
2885
+// aWindowConstraints.gridwidth = 3;
2886
+// // aConstraints.gridheight = 3;
2887
+// aWindowConstraints.gridx = 1;
2888
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2889
+// bigThree.add(centralPanel, aWindowConstraints);
2890
+// aWindowConstraints.weightx = 0;
2891
+// aWindowConstraints.gridx = 4;
2892
+// aWindowConstraints.gridwidth = 1;
2893
+// // aConstraints.gridheight = 3;
2894
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2895
+// //bigThree.add(XYZPanel, aWindowConstraints);
2896
+// scenePanel.setVisible(false);
2897
+// centralPanel.setVisible(true);
2898
+// XYZPanel.setVisible(false);
2899
+ bigThree.ClearUI();
2900
+ bigThree.add(centralPanel);
2901
+ bigThree.FlushUI();
26072902 } else
2608
- if (event.getSource() == threeButton)
2903
+ if (source == threeButton)
26092904 {
26102905 radio.layout = threeButton;
2611
- bigThree.remove(jtp);
2612
- bigThree.remove(cameraPanel);
2613
- bigThree.remove(XYZPanel);
2614
- aWindowConstraints.gridx = 0;
2615
- aWindowConstraints.gridy = 0;
2616
- aWindowConstraints.gridwidth = 1;
2617
- // aConstraints.gridheight = 3;
2618
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2619
- aWindowConstraints.weightx = 0;
2620
- aWindowConstraints.weighty = 1;
2621
- //bigThree.add(jtp, aWindowConstraints);
2622
- aWindowConstraints.weightx = 1;
2623
- aWindowConstraints.gridwidth = 3;
2624
- // aConstraints.gridheight = 3;
2625
- aWindowConstraints.gridx = 1;
2626
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2627
- bigThree.add(cameraPanel, aWindowConstraints);
2628
- aWindowConstraints.weightx = 0;
2629
- aWindowConstraints.gridx = 4;
2630
- aWindowConstraints.gridwidth = 1;
2631
- // aConstraints.gridheight = 3;
2632
- aConstraints.fill = GridBagConstraints.VERTICAL;
2633
- bigThree.add(XYZPanel, aWindowConstraints);
2634
- bigThree.revalidate();
2906
+
2907
+// bigThree.remove(scenePanel);
2908
+// bigThree.remove(centralPanel);
2909
+// bigThree.remove(XYZPanel);
2910
+// aWindowConstraints.gridx = 0;
2911
+// aWindowConstraints.gridy = 0;
2912
+// aWindowConstraints.gridwidth = 1;
2913
+// // aConstraints.gridheight = 3;
2914
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2915
+// aWindowConstraints.weightx = 0;
2916
+// aWindowConstraints.weighty = 1;
2917
+// //bigThree.add(jtp, aWindowConstraints);
2918
+// aWindowConstraints.weightx = 1;
2919
+// aWindowConstraints.gridwidth = 3;
2920
+// // aConstraints.gridheight = 3;
2921
+// aWindowConstraints.gridx = 1;
2922
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2923
+// bigThree.add(centralPanel, aWindowConstraints);
2924
+// aWindowConstraints.weightx = 0;
2925
+// aWindowConstraints.gridx = 4;
2926
+// aWindowConstraints.gridwidth = 1;
2927
+// // aConstraints.gridheight = 3;
2928
+// aConstraints.fill = GridBagConstraints.VERTICAL;
2929
+// bigThree.add(XYZPanel, aWindowConstraints);
2930
+// bigThree.validate();
2931
+// scenePanel.setVisible(false);
2932
+// centralPanel.setVisible(true);
2933
+// XYZPanel.setVisible(true);
2934
+ bigThree.ClearUI();
2935
+ bigThree.add(centralPanel);
2936
+ bigThree.add(XYZPanel);
2937
+ bigThree.FlushUI();
26352938 } else
2636
- if (event.getSource() == fourButton)
2939
+ if (source == fourButton)
26372940 {
26382941 radio.layout = fourButton;
2639
- bigThree.remove(jtp);
2640
- bigThree.remove(cameraPanel);
2641
- bigThree.remove(XYZPanel);
2642
- aWindowConstraints.gridx = 0;
2643
- aWindowConstraints.gridy = 0;
2644
- aWindowConstraints.gridwidth = 1;
2645
- // aWindowConstraints.gridheight = 3;
2646
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2647
- aWindowConstraints.weightx = 1;
2648
- aWindowConstraints.weighty = 1;
2649
- bigThree.add(jtp, aWindowConstraints);
2650
- aWindowConstraints.weightx = 1;
2651
- aWindowConstraints.gridwidth = 3;
2652
- // aConstraints.gridheight = 3;
2653
- aWindowConstraints.gridx = 1;
2654
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2655
- //bigThree.add(cameraPanel, aWindowConstraints);
2656
- aWindowConstraints.weightx = 0;
2657
- aWindowConstraints.gridx = 4;
2658
- aWindowConstraints.gridwidth = 1;
2659
- // aWindowConstraints.gridheight = 3;
2660
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2661
- //bigThree.add(XYZPanel, aWindowConstraints);
2662
- bigThree.revalidate();
2942
+
2943
+// bigThree.remove(scenePanel);
2944
+// bigThree.remove(centralPanel);
2945
+// bigThree.remove(XYZPanel);
2946
+// aWindowConstraints.gridx = 0;
2947
+// aWindowConstraints.gridy = 0;
2948
+// aWindowConstraints.gridwidth = 1;
2949
+// // aWindowConstraints.gridheight = 3;
2950
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2951
+// aWindowConstraints.weightx = 1;
2952
+// aWindowConstraints.weighty = 1;
2953
+// bigThree.add(scenePanel, aWindowConstraints);
2954
+// aWindowConstraints.weightx = 1;
2955
+// aWindowConstraints.gridwidth = 3;
2956
+// // aConstraints.gridheight = 3;
2957
+// aWindowConstraints.gridx = 1;
2958
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2959
+// //bigThree.add(cameraPanel, aWindowConstraints);
2960
+// aWindowConstraints.weightx = 0;
2961
+// aWindowConstraints.gridx = 4;
2962
+// aWindowConstraints.gridwidth = 1;
2963
+// // aWindowConstraints.gridheight = 3;
2964
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2965
+// //bigThree.add(XYZPanel, aWindowConstraints);
2966
+// bigThree.validate();
2967
+// scenePanel.setVisible(true);
2968
+// centralPanel.setVisible(false);
2969
+// XYZPanel.setVisible(false);
2970
+ bigThree.ClearUI();
2971
+ bigThree.add(scenePanel);
2972
+ bigThree.FlushUI();
26632973 } else
2664
- if (event.getSource() == sixButton)
2974
+ if (source == sixButton)
26652975 {
26662976 radio.layout = sixButton;
2667
- bigThree.remove(jtp);
2668
- bigThree.remove(cameraPanel);
2669
- bigThree.remove(XYZPanel);
2670
- aWindowConstraints.gridx = 0;
2671
- aWindowConstraints.gridy = 0;
2672
- aWindowConstraints.gridwidth = 1;
2673
- // aConstraints.gridheight = 3;
2674
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2675
- aWindowConstraints.weightx = 0;
2676
- aWindowConstraints.weighty = 1;
2677
- bigThree.add(jtp, aWindowConstraints);
2678
- aWindowConstraints.weightx = 1;
2679
- aWindowConstraints.gridwidth = 3;
2680
- // aWindowConstraints.gridheight = 3;
2681
- aWindowConstraints.gridx = 1;
2682
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2683
- bigThree.add(cameraPanel, aWindowConstraints);
2684
- aWindowConstraints.weightx = 0;
2685
- aWindowConstraints.gridx = 4;
2686
- aWindowConstraints.gridwidth = 1;
2687
- // aWindowConstraints.gridheight = 3;
2688
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2689
- //bigThree.add(XYZPanel, aConstraints);
2690
- bigThree.revalidate();
2977
+
2978
+// bigThree.remove(scenePanel);
2979
+// bigThree.remove(centralPanel);
2980
+// bigThree.remove(XYZPanel);
2981
+// aWindowConstraints.gridx = 0;
2982
+// aWindowConstraints.gridy = 0;
2983
+// aWindowConstraints.gridwidth = 1;
2984
+// // aConstraints.gridheight = 3;
2985
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2986
+// aWindowConstraints.weightx = 0;
2987
+// aWindowConstraints.weighty = 1;
2988
+// bigThree.add(scenePanel, aWindowConstraints);
2989
+// aWindowConstraints.weightx = 1;
2990
+// aWindowConstraints.gridwidth = 3;
2991
+// // aWindowConstraints.gridheight = 3;
2992
+// aWindowConstraints.gridx = 1;
2993
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2994
+// bigThree.add(centralPanel, aWindowConstraints);
2995
+// aWindowConstraints.weightx = 0;
2996
+// aWindowConstraints.gridx = 4;
2997
+// aWindowConstraints.gridwidth = 1;
2998
+// // aWindowConstraints.gridheight = 3;
2999
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3000
+// //bigThree.add(XYZPanel, aConstraints);
3001
+// bigThree.validate();
3002
+// scenePanel.setVisible(true);
3003
+// centralPanel.setVisible(true);
3004
+// XYZPanel.setVisible(false);
3005
+ bigThree.ClearUI();
3006
+ bigThree.add(scenePanel);
3007
+ bigThree.add(centralPanel);
3008
+ bigThree.FlushUI();
26913009 } else
2692
- if (event.getSource() == sevenButton)
3010
+ if (source == sevenButton)
26933011 {
26943012 radio.layout = sevenButton;
2695
- bigThree.remove(jtp);
2696
- bigThree.remove(cameraPanel);
2697
- bigThree.remove(XYZPanel);
2698
- aWindowConstraints.gridx = 0;
2699
- aWindowConstraints.gridy = 0;
2700
- aWindowConstraints.gridwidth = 1;
2701
- // aWindowConstraints.gridheight = 3;
2702
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2703
- aWindowConstraints.weightx = 0;
2704
- aWindowConstraints.weighty = 1;
2705
- bigThree.add(jtp, aWindowConstraints);
2706
- aWindowConstraints.weightx = 1;
2707
- aWindowConstraints.gridwidth = 3;
2708
- // aWindowConstraints.gridheight = 3;
2709
- aWindowConstraints.gridx = 1;
2710
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2711
- bigThree.add(cameraPanel, aWindowConstraints);
2712
- aWindowConstraints.weightx = 0;
2713
- aWindowConstraints.gridx = 4;
2714
- aWindowConstraints.gridwidth = 1;
2715
- // aConstraints.gridheight = 3;
2716
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2717
- bigThree.add(XYZPanel, aWindowConstraints);
2718
- bigThree.revalidate();
3013
+
3014
+// bigThree.remove(scenePanel);
3015
+// bigThree.remove(centralPanel);
3016
+// bigThree.remove(XYZPanel);
3017
+// aWindowConstraints.gridx = 0;
3018
+// aWindowConstraints.gridy = 0;
3019
+// aWindowConstraints.gridwidth = 1;
3020
+// // aWindowConstraints.gridheight = 3;
3021
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3022
+// aWindowConstraints.weightx = 0;
3023
+// aWindowConstraints.weighty = 1;
3024
+// bigThree.add(scenePanel, aWindowConstraints);
3025
+// aWindowConstraints.weightx = 1;
3026
+// aWindowConstraints.gridwidth = 3;
3027
+// // aWindowConstraints.gridheight = 3;
3028
+// aWindowConstraints.gridx = 1;
3029
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3030
+// bigThree.add(centralPanel, aWindowConstraints);
3031
+// aWindowConstraints.weightx = 0;
3032
+// aWindowConstraints.gridx = 4;
3033
+// aWindowConstraints.gridwidth = 1;
3034
+// // aConstraints.gridheight = 3;
3035
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3036
+// bigThree.add(XYZPanel, aWindowConstraints);
3037
+// bigThree.validate();
3038
+// scenePanel.setVisible(true);
3039
+// centralPanel.setVisible(true);
3040
+// XYZPanel.setVisible(true);
3041
+ bigThree.ClearUI();
3042
+ bigThree.add(scenePanel);
3043
+ bigThree.add(centralPanel);
3044
+ bigThree.add(XYZPanel);
3045
+ bigThree.FlushUI();
27193046 } else
2720
- if (event.getSource() == rootButton)
3047
+ if (source == rootButton)
27213048 {
27223049 Object3D obj;
27233050 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2729,7 +3056,7 @@
27293056
27303057 refreshContents(true);
27313058 } else
2732
- if (event.getSource() == closeButton)
3059
+ if (source == closeButton)
27333060 {
27343061 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27353062 cRadio ab;
....@@ -2750,11 +3077,11 @@
27503077 }
27513078 refreshContents(true);
27523079 } else
2753
- if (event.getSource() == editItem || event.getSource() == editButton)
3080
+ if (source == editItem || source == editButton)
27543081 {
27553082 EditSelection(false);
27563083 } else
2757
- if (event.getSource() == uneditButton)
3084
+ if (source == uneditButton)
27583085 {
27593086 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27603087 {
....@@ -2764,14 +3091,14 @@
27643091 child.CloseUI();
27653092 listUI.remove(child);
27663093
2767
- child.editWindow = null; // ???????????
3094
+ //child.editWindow = null; // ???????????
27683095 }
2769
- objEditor.ctrlPanel.revalidate();
3096
+ objEditor.ctrlPanel.FlushUI();
27703097 //objEditor.jTree.clearSelection();
27713098 //objEditor.ResetSliders();
27723099 refreshContents(true);
27733100 } else
2774
- if (event.getSource() == clearPanelButton)
3101
+ if (source == clearPanelButton)
27753102 {
27763103 assert(copy == group);
27773104 //copy.ClearUI();
....@@ -2782,7 +3109,7 @@
27823109 listUI.clear();
27833110 refreshContents(true);
27843111 } else
2785
- if (event.getSource() == allParamsButton)
3112
+ if (source == allParamsButton)
27863113 {
27873114 assert(copy == group);
27883115
....@@ -2803,19 +3130,19 @@
28033130
28043131 refreshContents(true);
28053132 } else
2806
- if (event.getSource() == unselectButton)
3133
+ if (source == unselectButton)
28073134 {
28083135 objEditor.jTree.clearSelection();
2809
- // ?? oct 2012 GraphreeD.clipboard.clear();
3136
+ // ?? oct 2012 GrafreeD.clipboard.clear();
28103137 objEditor.ResetSliders();
28113138 refreshContents(true);
28123139 } else
2813
- if(event.getSource() instanceof cRadio)
3140
+ if(source instanceof cRadio)
28143141 {
28153142 group.parent = keepparent;
28163143 group.attributes = 0;
28173144 //group.editWindow = null;
2818
- /*cRadio*/ radio = (cRadio)event.getSource();
3145
+ /*cRadio*/ radio = (cRadio)source;
28193146 Object3D obj = radio.GetObject();
28203147 System.out.println("Edit " + obj);
28213148 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2835,7 +3162,7 @@
28353162 }
28363163
28373164 copy = group;
2838
- //CameraPane.theRenderer.object = group;
3165
+ //Globals.theRenderer.object = group;
28393166 if(!useclient)
28403167 {
28413168 cameraView.renderCamera = radio.camera;
....@@ -2844,12 +3171,16 @@
28443171 cameraView.cameras[cameraView.cameracount] = radio.camera;
28453172 cameraView.targetLookAt.set(radio.camera.lookAt);
28463173 cameraView.object = group;
2847
- cameraView.lighttouched = true;
3174
+ //cameraView.lighttouched = true;
3175
+ Globals.lighttouched = true;
28483176 topView.object = group;
28493177 frontView.object = group;
28503178 sideView.object = group;
28513179 }
3180
+
3181
+// fix "+" issue
28523182 group.editWindow = this;
3183
+
28533184 /*
28543185 currentLayout = radio.layout;
28553186 if (currentLayout == null)
....@@ -2862,7 +3193,20 @@
28623193 //group.attributes = -1;
28633194 ResetModel();
28643195 refreshContents(true);
2865
- }
3196
+ } else if (event.getSource() == editCameraItem)
3197
+ {
3198
+ cameraView.ProtectCamera();
3199
+ cameraView.repaint();
3200
+ return;
3201
+ } else if (event.getSource() == revertCameraItem)
3202
+ {
3203
+ cameraView.RevertCamera();
3204
+ cameraView.repaint();
3205
+ return;
3206
+ // } else if (event.getSource() == textureButton)
3207
+ // {
3208
+ // return; // true;
3209
+ }
28663210 else
28673211 {
28683212 //return super.action(event, arg);
....@@ -2880,7 +3224,7 @@
28803224 if (useclient)
28813225 {
28823226 cameraView.object = client;
2883
- cameraView.lighttouched = true;
3227
+ Globals.lighttouched = true;
28843228 //topView.object = client;
28853229 //frontView.object = client;
28863230 //sideView.object = client;
....@@ -2888,7 +3232,7 @@
28883232 else
28893233 {
28903234 cameraView.object = group;
2891
- cameraView.lighttouched = true;
3235
+ Globals.lighttouched = true;
28923236 //topView.object = group;
28933237 //frontView.object = group;
28943238 //sideView.object = group;
....@@ -2923,6 +3267,28 @@
29233267 refreshContents();
29243268 }
29253269
3270
+ void TransformChildren()
3271
+ {
3272
+ Object3D obj;
3273
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3274
+ {
3275
+ obj = (Object3D)e.nextElement();
3276
+ obj.KeepTextureMatrices();
3277
+ obj.TransformChildren();
3278
+ obj.RestoreTextureMatrices();
3279
+
3280
+// if (obj.parent == null)
3281
+// {
3282
+// System.out.println("NULL PARENT!");
3283
+// new Exception().printStackTrace();
3284
+// }
3285
+// else
3286
+// TouchTransform(obj);
3287
+// //obj.parent.Touch();
3288
+ }
3289
+
3290
+ refreshContents();
3291
+ }
29263292
29273293 void ResetTransform()
29283294 {
....@@ -3035,7 +3401,7 @@
30353401 refreshContents();
30363402 }
30373403
3038
- void ResetCentroid()
3404
+ void ResetCentroid(boolean full)
30393405 {
30403406 Object3D obj;
30413407 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3050,12 +3416,16 @@
30503416 LA.matIdentity(Object3D.mat);
30513417 obj.getBounds(minima, maxima, false);
30523418 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3053
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3419
+ if (full)
3420
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30543421 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30553422 obj.TransformMesh(Object3D.mat);
3423
+
30563424 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3057
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3425
+ if (full)
3426
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30583427 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3428
+
30593429 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30603430 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30613431 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3084,7 +3454,8 @@
30843454
30853455 int size = obj.MemorySize();
30863456
3087
- System.err.println((size/1024) + " KB is the size of " + obj);
3457
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3458
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30883459 }
30893460 }
30903461 catch (Exception e)
....@@ -3121,9 +3492,9 @@
31213492 obj = (Object3D)e.nextElement();
31223493
31233494 System.out.println("Object is: " + obj);
3124
- GraphreeD.AnalyzeObject(obj);
3495
+ Grafreed.AnalyzeObject(obj);
31253496 System.out.println("Boundary rep: " + obj.bRep);
3126
- GraphreeD.AnalyzeObject(obj.bRep);
3497
+ Grafreed.AnalyzeObject(obj.bRep);
31273498
31283499 // System.err.println((size/1024) + " KB is the size of " + obj);
31293500 }
....@@ -3165,6 +3536,20 @@
31653536 void GenNormals(boolean crease)
31663537 {
31673538 group.GenNormalsS(crease);
3539
+
3540
+ refreshContents();
3541
+ }
3542
+
3543
+ void GenNormalsMESH()
3544
+ {
3545
+ group.GenNormalsMeshS();
3546
+
3547
+ refreshContents();
3548
+ }
3549
+
3550
+ void GenNormalsMINE()
3551
+ {
3552
+ group.selection.GenNormalsMINE();
31683553
31693554 refreshContents();
31703555 }
....@@ -3250,7 +3635,7 @@
32503635 // LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
32513636 // LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32523637 //
3253
-// g.add(GraphreeD.clipboard);
3638
+// g.add(GrafreeD.clipboard);
32543639 //
32553640 // buffer.add(g);
32563641 // }
....@@ -3269,8 +3654,8 @@
32693654 // nodes = new Object3D();
32703655 // vertices = new Vector<Vertex>();
32713656 //
3272
-// boolean epsequal = GraphreeD.epsequal;
3273
-// GraphreeD.epsequal = true;
3657
+// boolean epsequal = GrafreeD.epsequal;
3658
+// GrafreeD.epsequal = true;
32743659 //
32753660 // for (int i=0; i<group.selection.size(); i++)
32763661 // {
....@@ -3311,7 +3696,7 @@
33113696 // LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33123697 // LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33133698 //
3314
-// g.add(GraphreeD.clipboard);
3699
+// g.add(GrafreeD.clipboard);
33153700 //
33163701 // buffer.add(g);
33173702 // }
....@@ -3319,7 +3704,7 @@
33193704 // makeSomething(buffer, i==group.selection.size()-1);
33203705 // }
33213706 //
3322
-// GraphreeD.epsequal = epsequal;
3707
+// GrafreeD.epsequal = epsequal;
33233708 //
33243709 // //buffer = null;
33253710 // temprep = null;
....@@ -3330,8 +3715,8 @@
33303715
33313716 void ParseVertices()
33323717 {
3333
- boolean epsequal = GraphreeD.epsequal;
3334
- GraphreeD.epsequal = true;
3718
+ boolean epsequal = Grafreed.epsequal;
3719
+ Grafreed.epsequal = true;
33353720
33363721 for (int i=0; i<group.selection.size(); i++)
33373722 {
....@@ -3356,7 +3741,7 @@
33563741 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33573742 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33583743
3359
- g.add(GraphreeD.clipboard);
3744
+ g.add(Grafreed.clipboard);
33603745
33613746 buffer.add(g);
33623747 }
....@@ -3371,7 +3756,7 @@
33713756 makeSomething(buffer, i==group.selection.size()-1);
33723757 }
33733758
3374
- GraphreeD.epsequal = epsequal;
3759
+ Grafreed.epsequal = epsequal;
33753760
33763761 refreshContents();
33773762 }
....@@ -3389,7 +3774,16 @@
33893774 String pigment = Object3D.GetPigment(tex);
33903775 //String bump = Object3D.GetBump(tex);
33913776
3392
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
3777
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3778
+
3779
+ try
3780
+ {
3781
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3782
+ }
3783
+ catch (Exception e)
3784
+ {
3785
+ System.err.println("FAIL: " + node);
3786
+ }
33933787
33943788 double s = v.s;
33953789
....@@ -3416,7 +3810,7 @@
34163810 scale /= 3;
34173811
34183812 scale /= 0xFF;
3419
- scale /= 4;
3813
+ // c'est quoi ca? scale /= 4;
34203814
34213815 //v.AO = scale;
34223816
....@@ -3437,12 +3831,26 @@
34373831
34383832 void Align()
34393833 {
3834
+ if (group.selection.size() == 0)
3835
+ return;
3836
+
3837
+ cVector bbmin = new cVector();
3838
+ cVector bbmax = new cVector();
3839
+
3840
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
3841
+
3842
+ double dx = bbmax.x - bbmin.x;
3843
+ double dy = bbmax.y - bbmin.y;
3844
+ double dz = bbmax.z - bbmin.z;
3845
+
3846
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
3847
+
34403848 for (int i=0; i<group.selection.size(); i++)
34413849 {
34423850 Object3D obj = group.selection.get(i);
34433851
3444
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3445
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
3852
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
3853
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34463854 }
34473855
34483856 refreshContents();
....@@ -3455,7 +3863,7 @@
34553863 // ref.SaveSupports();
34563864 // Object3D par = ref.parent;
34573865 // ref.parent = null;
3458
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
3866
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
34593867 // ref.parent = par;
34603868 // ref.RestoreSupports();
34613869
....@@ -3463,11 +3871,11 @@
34633871
34643872 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34653873
3466
- boolean random = CameraPane.RANDOM;
3467
- CameraPane.RANDOM = false; // parse all random nodes
3874
+ boolean random = CameraPane.SWITCH;
3875
+ CameraPane.SWITCH = false; // parse all random nodes
34683876 lowres.linkVerticesThis(null);
34693877 lowres.linkVerticesThis(sn);
3470
- CameraPane.RANDOM = random;
3878
+ CameraPane.SWITCH = random;
34713879
34723880 System.err.flush();
34733881
....@@ -3485,7 +3893,7 @@
34853893 // lowres.SaveSupports();
34863894 // par = lowres.parent;
34873895 // lowres.parent = null;
3488
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
3896
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
34893897 Object3D newlow = CloneObject(lowres, false);
34903898 newlow.name = sn.switchobject.get(i).name;
34913899 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3507,7 +3915,7 @@
35073915 return;
35083916
35093917 Object3D poses = group.selection.get(0);
3510
- Object3D ref = GraphreeD.clipboard.get(0);
3918
+ Object3D ref = Grafreed.clipboard.get(0);
35113919
35123920 Object3D newgroup = new Object3D("Po:" + poses.name);
35133921
....@@ -3676,7 +4084,7 @@
36764084 group.selection.RelinkToSupport(); // july 2014
36774085 System.out.println("DONE.");
36784086 refreshContents();
3679
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4087
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
36804088 }
36814089
36824090 void ReduceMesh(boolean reduction34)
....@@ -3701,20 +4109,20 @@
37014109
37024110 void ClipMesh()
37034111 {
3704
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4112
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37054113 {
3706
- Object3D content = GraphreeD.clipboard.get(0);
4114
+ Object3D content = Grafreed.clipboard.get(0);
37074115
37084116 if (content instanceof cGroup && ((cGroup)content).transientlink )
37094117 content = ((cGroup)content).get(0);
37104118
37114119 // for (int i=0; i<group.selection.size(); i++)
37124120 // {
3713
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4121
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37144122 // }
3715
- group.selection.ClipMesh(GraphreeD.clipboard);
4123
+ group.selection.ClipMesh(Grafreed.clipboard);
37164124 }
3717
-// group.selection.ClipMesh(GraphreeD.clipboard);
4125
+// group.selection.ClipMesh(GrafreeD.clipboard);
37184126 System.out.println("DONE.");
37194127 refreshContents();
37204128 }
....@@ -3759,6 +4167,18 @@
37594167 void MarkLeaves(boolean hide)
37604168 {
37614169 group.selection.MarkLeaves(hide);
4170
+ refreshContents();
4171
+ }
4172
+
4173
+ void RewindLeaves(boolean hide)
4174
+ {
4175
+ group.selection.RewindLeaves(hide);
4176
+ refreshContents();
4177
+ }
4178
+
4179
+ void RandomLeaves(boolean hide)
4180
+ {
4181
+ group.selection.RandomLeaves(hide);
37624182 refreshContents();
37634183 }
37644184
....@@ -3847,7 +4267,7 @@
38474267 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38484268
38494269 Object3D elem = (Object3D)group.selection.elementAt(i);
3850
- if(elem != group)
4270
+ if(elem != group || !newWindow)
38514271 {
38524272 // if (!(elem instanceof Composite))
38534273 // newWindow = false;
....@@ -3937,7 +4357,6 @@
39374357 //case 702: // Event.LIST_DESELECT
39384358 group.deselectAll();
39394359 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3940
- objEditor.ClearInfo(); // .GetMaterial());
39414360 if (tps != null)
39424361 {
39434362 for (int i=0; i < tps.length; i++)
....@@ -3946,31 +4365,30 @@
39464365
39474366 //if (child.parent != null)
39484367 //child.parent.addSelectee(child);
4368
+ objEditor.SetMaterial(child);
39494369 group.addSelectee(child);
3950
- objEditor.SetMaterial(child); // .GetMaterial());
3951
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3952
- System.err.println("info : " + child.GetPath());
39534370 }
39544371 }
3955
- else
3956
- {
3957
- objEditor.SetMaterial(group); // .GetMaterial());
3958
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3959
- System.err.println("info : " + group.GetPath());
3960
- }
4372
+// else
4373
+// {
4374
+// objEditor.SetMaterial(group); // .GetMaterial());
4375
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4376
+// System.err.println("info : " + group.GetPath());
4377
+// }
39614378
3962
- objEditor.SetText(); // jan 2014
3963
-
3964
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4379
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
39654380 CameraPane.flash = true;
39664381
3967
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4382
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39684383 // a camera
39694384 {
3970
- CameraPane.camerachangeframe = 0; // don't refuse it
3971
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3972
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3973
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
4385
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4386
+ {
4387
+ CameraPane.camerachangeframe = 0; // don't refuse it
4388
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4389
+ }
4390
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4391
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
39744392 }
39754393
39764394 refreshContents();
....@@ -3981,6 +4399,26 @@
39814399
39824400 freezemodel = false;
39834401 }
4402
+
4403
+ void refreshContents(boolean cp)
4404
+ {
4405
+ if (!Globals.MOUSEDRAGGED)
4406
+ {
4407
+ objEditor.ClearInfo(); // .GetMaterial());
4408
+
4409
+ for (int i=0; i < group.selection.Size(); i++)
4410
+ {
4411
+ Object3D child = (Object3D) group.selection.get(i);
4412
+
4413
+ objEditor.AddInfo(child, this, true);
4414
+ System.err.println("info : " + child.GetPath());
4415
+ }
4416
+
4417
+ objEditor.SetText(); // jan 2014
4418
+ }
4419
+
4420
+ super.refreshContents(cp);
4421
+ }
39844422
39854423 void linkSomething(Object3D thing)
39864424 {
....@@ -4052,16 +4490,18 @@
40524490 {
40534491 if (group.selection.isEmpty())
40544492 return;
4055
- GraphreeD.clipboardIsTempGroup = false;
4493
+
4494
+ Grafreed.clipboardIsTempGroup = false;
40564495 Composite tGroup = null;
40574496 if (group.selection.size() > 0) // 1)
40584497 {
40594498 tGroup = new cGroup();
4060
- GraphreeD.clipboardIsTempGroup = true;
4499
+ Grafreed.clipboardIsTempGroup = true;
40614500 }
40624501
40634502 if (cut)
40644503 {
4504
+ Save();
40654505 //int indices[] = jList.getSelectedIndices();
40664506 //for (int i = indices.length - 1; i >= 0; i--)
40674507 //jList.remove(indices[i]);
....@@ -4097,16 +4537,16 @@
40974537 //System.out.println("cut " + child);
40984538 //System.out.println("parent = " + child.parent);
40994539 // tmp.addChild(child);
4100
- if (GraphreeD.clipboardIsTempGroup)
4540
+ if (Grafreed.clipboardIsTempGroup)
41014541 tGroup.add/*Child*/(tmp);
41024542 else
4103
- GraphreeD.clipboard = tmp;
4543
+ Grafreed.clipboard = tmp;
41044544 }
41054545 else
4106
- if (GraphreeD.clipboardIsTempGroup)
4546
+ if (Grafreed.clipboardIsTempGroup)
41074547 tGroup.add/*Child*/(child);
41084548 else
4109
- GraphreeD.clipboard = child;
4549
+ Grafreed.clipboard = child;
41104550 }
41114551
41124552 //ResetModel();
....@@ -4138,21 +4578,23 @@
41384578 //System.out.println("cut " + elem);
41394579 //System.out.println("parent = " + elem.parent);
41404580 // tmp.addChild(elem);
4141
- if (GraphreeD.clipboardIsTempGroup)
4581
+ if (Grafreed.clipboardIsTempGroup)
41424582 tGroup.add/*Child*/(tmp);
41434583 else
4144
- GraphreeD.clipboard = tmp;
4584
+ Grafreed.clipboard = tmp;
41454585 }
41464586 else
4147
- if (GraphreeD.clipboardIsTempGroup)
4587
+ if (Grafreed.clipboardIsTempGroup)
41484588 tGroup.add/*Child*/(child);
41494589 else
4150
- GraphreeD.clipboard = child;
4590
+ Grafreed.clipboard = child;
41514591 }
41524592
41534593 }
4154
- if (GraphreeD.clipboardIsTempGroup)
4155
- GraphreeD.clipboard = tGroup;
4594
+
4595
+ if (Grafreed.clipboardIsTempGroup)
4596
+ Grafreed.clipboard = tGroup;
4597
+
41564598 if (cut)
41574599 {
41584600 ResetModel();
....@@ -4162,11 +4604,11 @@
41624604
41634605 void paste(boolean expand)
41644606 {
4165
- // if (GraphreeD.clipboard == null)
4607
+ // if (GrafreeD.clipboard == null)
41664608 // return;
41674609 boolean first = true;
41684610
4169
- if (GraphreeD.clipboardIsTempGroup)
4611
+ if (Grafreed.clipboardIsTempGroup)
41704612 {
41714613 Composite temp;
41724614
....@@ -4177,7 +4619,7 @@
41774619 temp = (Composite)Applet3D.clipboard.deepCopy();
41784620 */
41794621 Object3D elem;
4180
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4622
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41814623 {
41824624 Object3D child = (Object3D)e.nextElement();
41834625
....@@ -4191,7 +4633,7 @@
41914633 else
41924634 elem = child.deepCopy(); // ?
41934635 child.parent = keepparent;
4194
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4636
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
41954637 // elem = elem.get(0);
41964638 makeSomething(elem, true); // ?? first);
41974639 //group.addChild(elem);
....@@ -4211,23 +4653,23 @@
42114653 //Object3D cb = Applet3D.clipboard;
42124654 //temp.addChild(cb);
42134655 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4214
- assert(GraphreeD.clipboard.parent == null);
4215
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
4216
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
4217
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
4218
- makeSomething(expand?GraphreeD.clipboard.get(0).copyExpand():GraphreeD.clipboard.get(0).deepCopy());
4656
+ assert(Grafreed.clipboard.parent == null);
4657
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4658
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4659
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4660
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42194661 else
4220
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4221
- GraphreeD.clipboard.get(0).parent = keepparent;
4662
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4663
+ Grafreed.clipboard.get(0).parent = keepparent;
42224664 }
42234665
42244666 ResetModel();
42254667 refreshContents();
42264668 }
42274669
4228
- void pasteInto(boolean copyit)
4670
+ void pasteInto(boolean copyit, boolean clone)
42294671 {
4230
-// if (GraphreeD.clipboard == null)
4672
+// if (GrafreeD.clipboard == null)
42314673 // return;
42324674
42334675 if (group.selection.size() != 1)
....@@ -4254,15 +4696,22 @@
42544696 if (copyit)
42554697 {
42564698 // paste(false);
4257
- CloneClipboard(false); // sept 2014
4699
+ if (clone)
4700
+ {
4701
+ CloneClipboard(false); // sept 2014
4702
+ }
4703
+ else
4704
+ {
4705
+ paste(false);
4706
+ }
42584707 }
42594708 else
42604709 {
42614710 boolean first = true;
42624711
4263
- if (GraphreeD.clipboardIsTempGroup)
4712
+ if (Grafreed.clipboardIsTempGroup)
42644713 {
4265
- Composite temp = (Composite)GraphreeD.clipboard;
4714
+ Composite temp = (Composite)Grafreed.clipboard;
42664715 Object3D copy;
42674716 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42684717 {
....@@ -4272,7 +4721,7 @@
42724721 }
42734722 } else
42744723 {
4275
- linkSomething(GraphreeD.clipboard); //.get(0));
4724
+ linkSomething(Grafreed.clipboard); //.get(0));
42764725 }
42774726 }
42784727 }
....@@ -4464,6 +4913,26 @@
44644913 makeSomething(csg);
44654914 }
44664915
4916
+ void Ungroup(Object3D g)
4917
+ {
4918
+ if (g instanceof HiddenObject)
4919
+ {
4920
+ HiddenObject h = (HiddenObject) g;
4921
+
4922
+ for (int i=0; i<h.ActualSize(); i++)
4923
+ {
4924
+ objEditor.makeSomething(h.get(i), false);
4925
+ }
4926
+ }
4927
+ else
4928
+ {
4929
+ for (int i=0; i<g.Size(); i++)
4930
+ {
4931
+ objEditor.makeSomething(g.get(i), false);
4932
+ }
4933
+ }
4934
+ }
4935
+
44674936 void ungroup()
44684937 {
44694938 /*
....@@ -4657,21 +5126,6 @@
46575126 }
46585127 */
46595128
4660
- void ImportGFD()
4661
- {
4662
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4663
- browser.show();
4664
- String filename = browser.getFile();
4665
- if (filename != null && filename.length() > 0)
4666
- {
4667
- String fullname = browser.getDirectory() + filename;
4668
-
4669
- //Object3D readobj =
4670
- objEditor.ReadGFD(fullname, objEditor);
4671
- //makeSomething(readobj);
4672
- }
4673
- }
4674
-
46755129 /*
46765130 public void Callback(Object obj)
46775131 {
....@@ -4695,26 +5149,9 @@
46955149 }
46965150 */
46975151
4698
- void ImportVRMLX3D()
4699
- {
4700
- if (GraphreeD.standAlone)
4701
- {
4702
- /**/
4703
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4704
- browser.show();
4705
- String filename = browser.getFile();
4706
- if (filename != null && filename.length() > 0)
4707
- {
4708
- String fullname = browser.getDirectory() + filename;
4709
- LoadVRMLX3D(fullname);
4710
- }
4711
- /**/
4712
- }
4713
- }
4714
-
47155152 String GetFile(String dialogName)
47165153 {
4717
- if (GraphreeD.standAlone)
5154
+ if (Grafreed.standAlone)
47185155 {
47195156 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47205157 browser.show();
....@@ -4778,10 +5215,15 @@
47785215 cButton flashSelectionButton;
47795216 cButton editButton;
47805217 cButton uneditButton;
5218
+ JCheckBox allParamsButton;
47815219 cButton clearpanelButton;
4782
- cButton allParamsButton;
47835220 cButton unselectButton;
47845221
5222
+ cButton saveButton;
5223
+ cButton undoButton;
5224
+ cButton redoButton;
5225
+ cButton oneStepButton;
5226
+
47855227 cButton screenfitButton;
47865228 cButton screenfitpointButton;
47875229 cButton snapobjectButton;
....@@ -4812,6 +5254,8 @@
48125254 private MenuItem lookFromItem;
48135255 private MenuItem switchItem;
48145256 private MenuItem cutItem;
5257
+ private MenuItem undoItem;
5258
+ private MenuItem redoItem;
48155259 private MenuItem duplicateItem;
48165260 private MenuItem cloneItem;
48175261 private MenuItem cloneSupportItem;
....@@ -4823,8 +5267,9 @@
48235267 private MenuItem resetsupportItem;
48245268 private MenuItem resetreferencesItem;
48255269 private MenuItem linkverticesItem;
5270
+ private MenuItem relinkverticesItem;
48265271 private MenuItem setMasterItem;
4827
- private MenuItem resetMeshItem;
5272
+ private MenuItem resetAllItem;
48285273 private MenuItem stepAllItem;
48295274 private MenuItem revertMeshItem;
48305275 private MenuItem poseMeshItem;
....@@ -4835,14 +5280,17 @@
48355280 private MenuItem mergeGeometriesItem;
48365281 private MenuItem copyItem;
48375282 private MenuItem pasteItem;
5283
+ private MenuItem pasteIntoItem;
48385284 private MenuItem pasteLinkItem;
48395285 private MenuItem pasteCloneItem;
48405286 private MenuItem pasteExpandItem;
48415287 private MenuItem clearItem;
48425288 private MenuItem clearAllItem;
48435289 private MenuItem genUVItem;
5290
+ private MenuItem genNormalsMESHItem;
48445291 private MenuItem genNormalsCADItem;
48455292 private MenuItem genNormalsORGANItem;
5293
+ private MenuItem genNormalsMINEItem;
48465294 private MenuItem stripifyItem;
48475295 private MenuItem unstripifyItem;
48485296 private MenuItem trimItem;
....@@ -4871,6 +5319,10 @@
48715319 private MenuItem showleavesItem;
48725320 private MenuItem markleavesItem;
48735321 private MenuItem unmarkleavesItem;
5322
+ private MenuItem rewindleavesItem;
5323
+ private MenuItem unrewindleavesItem;
5324
+ private MenuItem randomleavesItem;
5325
+ private MenuItem unrandomleavesItem;
48745326
48755327 private MenuItem flipVItem;
48765328 private MenuItem unflipVItem;
....@@ -4882,8 +5334,11 @@
48825334 private MenuItem panoTexturesItem;
48835335
48845336 private MenuItem resetCentroidItem;
4885
- private MenuItem transformgeometryItem;
5337
+ private MenuItem resetCentroidXZItem;
48865338 private MenuItem resetTransformItem;
5339
+ private MenuItem transformGeometryItem;
5340
+ private MenuItem transformChildrenItem;
5341
+ private MenuItem hideItem;
48875342 private MenuItem grabItem;
48885343 private MenuItem backItem;
48895344 private MenuItem frontItem;
....@@ -4904,6 +5359,7 @@
49045359
49055360 private MenuItem resetParentItem;
49065361 private MenuItem repairParentItem;
5362
+ private MenuItem repairShadowItem;
49075363 private MenuItem sortbysizeItem;
49085364 private MenuItem sortbynameItem;
49095365
....@@ -4924,10 +5380,11 @@
49245380 private MenuItem coneItem;
49255381 private MenuItem torusItem;
49265382 private MenuItem superItem;
5383
+ private MenuItem kleinItem;
49275384 private MenuItem blobItem;
49285385 private MenuItem latheItem;
49295386 private MenuItem bezierItem;
4930
- private MenuItem checkerItem;
5387
+ private MenuItem overlayItem;
49315388 private MenuItem meshItem;
49325389 // private MenuItem meshGroupItem;
49335390 private MenuItem springItem;
....@@ -4936,6 +5393,7 @@
49365393 private MenuItem csgItem;
49375394 private MenuItem templateItem;
49385395 private MenuItem textureItem;
5396
+ private MenuItem billboardItem;
49395397 private MenuItem shadowXItem;
49405398 private MenuItem shadowYItem;
49415399 private MenuItem shadowZItem;
....@@ -4948,11 +5406,6 @@
49485406 private MenuItem doubleItem;
49495407 private MenuItem tripleItem;
49505408
4951
- private MenuItem importGFDItem;
4952
- private MenuItem importVRMLX3DItem;
4953
- private MenuItem import3DSItem;
4954
- private MenuItem importOBJItem;
4955
-
49565409 private MenuItem computeAOItem;
49575410 private MenuItem recompileItem;
49585411 private MenuItem editScriptItem;
....@@ -4962,4 +5415,8 @@
49625415 private MenuItem analyzeItem;
49635416 private MenuItem dumpItem;
49645417 //boolean freezemodel = false;
5418
+
5419
+ Menu cameraMenu;
5420
+ MenuItem editCameraItem;
5421
+ MenuItem revertCameraItem;
49655422 }