Normand Briere
2019-06-09 3ae9b1de47e51e7c150412f2bb14383cb6a5f8f8
GroupEditor.java
....@@ -12,9 +12,10 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
17
-class GroupEditor extends ObjEditor implements iParse, //iCallBack,
18
+class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
1819 ObjectUI,
1920 Runnable,
2021 ActionListener,
....@@ -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
....@@ -149,6 +150,8 @@
149150
150151 void SetupMenu2(ObjEditor oe)
151152 {
153
+ if (Globals.ADVANCED)
154
+ {
152155 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153156 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154157 //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
....@@ -160,17 +163,21 @@
160163 lookAtItem.addActionListener(this);
161164 //lookFromItem.addActinoListener(this);
162165 //switchItem.addActionListener(this);
166
+ }
167
+
163168 Menu menu;
164169 oe.menuBar.add(menu = new Menu("Edit"));
165170 //editItem = menu.add(new MenuItem("Edit"));
166171 //editItem.addActionListener(this);
167172 duplicateItem = menu.add(new MenuItem("Duplicate"));
168173 duplicateItem.addActionListener(this);
169
- menu.add("-");
170174 cloneItem = menu.add(new MenuItem("Clone"));
171175 cloneItem.addActionListener(this);
176
+ if (Globals.ADVANCED)
177
+ {
172178 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173179 cloneSupportItem.addActionListener(this);
180
+ }
174181 menu.add("-");
175182 cutItem = menu.add(new MenuItem("Cut"));
176183 cutItem.addActionListener(this);
....@@ -178,26 +185,37 @@
178185 copyItem.addActionListener(this);
179186 pasteItem = menu.add(new MenuItem("Paste"));
180187 pasteItem.addActionListener(this);
188
+ menu.add("-");
189
+
190
+ menu.add("-");
191
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
192
+ pasteIntoItem.addActionListener(this);
181193 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182194 pasteLinkItem.addActionListener(this);
183195 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184196 pasteCloneItem.addActionListener(this);
185197 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186198 // pasteExpandItem.addActionListener(this);
199
+ menu.add("-");
187200 clearItem = menu.add(new MenuItem("Clear"));
188201 clearItem.addActionListener(this);
202
+
203
+ if (Globals.ADVANCED)
204
+ {
205
+ // Deletes the cameras...
189206 clearAllItem = menu.add(new MenuItem("Clear All"));
190207 clearAllItem.addActionListener(this);
191
- menu.add("-");
192
- resetMeshItem = menu.add(new MenuItem("Reset All"));
193
- resetMeshItem.addActionListener(this);
194
- stepAllItem = menu.add(new MenuItem("Step All"));
195
- stepAllItem.addActionListener(this);
208
+ }
209
+
210
+ oe.menuBar.add(menu = new Menu("Setting"));
211
+ if (Globals.ADVANCED)
212
+ {
196213 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
197214 revertMeshItem.addActionListener(this);
198215 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
199216 resetreferencesItem.addActionListener(this);
200217 menu.add("-");
218
+ }
201219 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
202220 overwriteGeoItem.addActionListener(this);
203221 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -209,47 +227,68 @@
209227 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
210228 overwriteUVItem.addActionListener(this);
211229 menu.add("-");
230
+ if (Globals.ADVANCED)
231
+ {
212232 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
213233 generateMeshItem.addActionListener(this);
214234 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
215235 poseMeshItem.addActionListener(this);
216236 menu.add("-");
237
+ }
217238 resetsupportItem = menu.add(new MenuItem("Reset support"));
218239 resetsupportItem.addActionListener(this);
219240 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220241 linkverticesItem.addActionListener(this);
242
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
243
+ relinkverticesItem.addActionListener(this);
244
+
245
+ if (Globals.ADVANCED)
246
+ {
221247 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222248 setMasterItem.addActionListener(this);
249
+ }
223250
224
- oe.menuBar.add(menu = new Menu("Object"));
251
+ oe.menuBar.add(menu = new Menu("Group"));
225252 grabItem = menu.add(new MenuItem("Grab"));
226253 grabItem.addActionListener(this);
227
- frontItem = menu.add(new MenuItem("Front"));
228
- frontItem.addActionListener(this);
229254 backItem = menu.add(new MenuItem("Back"));
230255 backItem.addActionListener(this);
256
+ frontItem = menu.add(new MenuItem("Front"));
257
+ frontItem.addActionListener(this);
231258 compositeItem = menu.add(new MenuItem("Composite"));
232259 compositeItem.addActionListener(this);
260
+ hideItem = menu.add(new MenuItem("Hidden Group"));
261
+ hideItem.addActionListener(this);
262
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
263
+ ungroupItem.addActionListener(this);
233264 menu.add("-");
234
- randomItem = menu.add(new MenuItem("Random"));
265
+ randomItem = menu.add(new MenuItem("Switch node"));
235266 randomItem.addActionListener(this);
236
- physicsItem = menu.add(new MenuItem("Physics"));
237
- physicsItem.addActionListener(this);
238
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
239
- frameselectorItem.addActionListener(this);
240267 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
241268 switchGeoItem.addActionListener(this);
242269 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
243270 switchTransfoItem.addActionListener(this);
244
- morphItem = menu.add(new MenuItem("Morph"));
271
+ morphItem = menu.add(new MenuItem("Morph Group"));
245272 morphItem.addActionListener(this);
273
+
274
+ if (Globals.ADVANCED)
275
+ {
276
+ menu.add("-");
277
+ physicsItem = menu.add(new MenuItem("Physics"));
278
+ physicsItem.addActionListener(this);
279
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
280
+ frameselectorItem.addActionListener(this);
246281 scriptNodeItem = menu.add(new MenuItem("Script Node"));
247282 scriptNodeItem.addActionListener(this);
248283 cameraItem = menu.add(new MenuItem("Camera"));
249284 cameraItem.addActionListener(this);
250
- menu.add("-");
285
+ }
286
+
287
+ oe.menuBar.add(menu = new Menu("Object"));
251288 textureItem = menu.add(new MenuItem("Texture"));
252289 textureItem.addActionListener(this);
290
+ billboardItem = menu.add(new MenuItem("Billboard"));
291
+ billboardItem.addActionListener(this);
253292 csgItem = menu.add(new MenuItem("CSG"));
254293 csgItem.addActionListener(this);
255294 shadowXItem = menu.add(new MenuItem("Shadow X"));
....@@ -258,23 +297,29 @@
258297 shadowYItem.addActionListener(this);
259298 shadowZItem = menu.add(new MenuItem("Shadow Z"));
260299 shadowZItem.addActionListener(this);
300
+ if (Globals.ADVANCED)
301
+ {
302
+ menu.add("-");
261303 linkerItem = menu.add(new MenuItem("Linker"));
262304 linkerItem.addActionListener(this);
263
- templateItem = menu.add(new MenuItem("Template"));
264
- templateItem.addActionListener(this);
265305 attributeItem = menu.add(new MenuItem("Attribute"));
266306 attributeItem.addActionListener(this);
307
+ templateItem = menu.add(new MenuItem("Template"));
308
+ templateItem.addActionListener(this);
267309 pointflowItem = menu.add(new MenuItem("Point Flow"));
268310 pointflowItem.addActionListener(this);
311
+ }
269312 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272313 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273314 resetTransformItem.addActionListener(this);
274315 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275316 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
317
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
318
+ resetCentroidXZItem.addActionListener(this);
319
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
320
+ transformGeometryItem.addActionListener(this);
321
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
322
+ transformChildrenItem.addActionListener(this);
278323
279324 oe.menuBar.add(menu = new Menu("Geometry"));
280325 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +328,13 @@
283328 genNormalsORGANItem.addActionListener(this);
284329 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285330 genNormalsCADItem.addActionListener(this);
331
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
332
+ genNormalsMESHItem.addActionListener(this);
333
+ if (Globals.ADVANCED)
334
+ {
335
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
336
+ genNormalsMINEItem.addActionListener(this);
337
+ }
286338 stripifyItem = menu.add(new MenuItem("Stripify"));
287339 stripifyItem.addActionListener(this);
288340 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +344,6 @@
292344 untrimItem = menu.add(new MenuItem("Untrim"));
293345 untrimItem.addActionListener(this);
294346 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297347 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298348 clearColorsItem.addActionListener(this);
299349 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -306,19 +356,34 @@
306356 reduce34MeshItem.addActionListener(this);
307357 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308358 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311359 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312360 clipMeshItem.addActionListener(this);
361
+
362
+ if (Globals.ADVANCED)
363
+ {
364
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
365
+ smoothMeshItem.addActionListener(this);
366
+ }
367
+
368
+ oe.menuBar.add(menu = new Menu("Attributes"));
369
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
370
+ clearMaterialsItem.addActionListener(this);
371
+ resetAllItem = menu.add(new MenuItem("Reset All"));
372
+ resetAllItem.addActionListener(this);
373
+ stepAllItem = menu.add(new MenuItem("Step All"));
374
+ stepAllItem.addActionListener(this);
313375 menu.add("-");
314376 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315377 liveleavesItem.addActionListener(this);
316378 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
317379 unliveleavesItem.addActionListener(this);
380
+ if (Globals.ADVANCED)
381
+ {
318382 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
319383 supportleavesItem.addActionListener(this);
320384 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
321385 unsupportleavesItem.addActionListener(this);
386
+ }
322387 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
323388 hideleavesItem.addActionListener(this);
324389 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -332,27 +397,18 @@
332397 flipVItem.addActionListener(this);
333398 unflipVItem = menu.add(new MenuItem("Unflip V"));
334399 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
400
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336401 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
402
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338403 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
404
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340405 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
406
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342407 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
408
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344409 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
410
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346411 panoTexturesItem.addActionListener(this);
347
- menu.add("-");
348
- extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
349
- extractGeometriesItem.addActionListener(this);
350
- cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
351
- cloneGeometriesItem.addActionListener(this);
352
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
353
- shareGeometriesItem.addActionListener(this);
354
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
355
- mergeGeometriesItem.addActionListener(this);
356412
357413 oe.menuBar.add(menu = new Menu("Selection"));
358414 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -370,9 +426,37 @@
370426 sortbysizeItem.addActionListener(this);
371427 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372428 sortbynameItem.addActionListener(this);
429
+ menu.add("-");
430
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
431
+ shareGeometriesItem.addActionListener(this);
432
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
433
+ mergeGeometriesItem.addActionListener(this);
434
+ if (Globals.ADVANCED)
435
+ {
436
+ // Pretty much the same as duplicate and clone.
437
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
438
+ extractGeometriesItem.addActionListener(this);
439
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
440
+ cloneGeometriesItem.addActionListener(this);
441
+ }
442
+
373443 oe.menuBar.add(menu = new Menu("Insert"));
374444 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
445
+
446
+ oe.menuBar.add(menu = new Menu("Include"));
447
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
448
+ importOBJItem.addActionListener(this);
449
+ menu.add("-");
450
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
451
+ import3DSItem.addActionListener(this);
452
+ menu.add("-");
453
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
454
+ importVRMLX3DItem.addActionListener(this);
455
+ menu.add("-");
456
+ importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
457
+ importGFDItem.addActionListener(this);
458
+
459
+ oe.menuBar.add(menu = new Menu("Tools"));
376460 buildToolsMenu(menu);
377461 }
378462
....@@ -406,150 +490,98 @@
406490 oe.radioPanel.add(dummyButton);
407491 oe.buttonGroup.add(dummyButton);
408492 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
493
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
412494
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
495
+ oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
496
+ liveCB.setToolTipText("Enable animation");
414497 liveCB.addItemListener(this);
415498
416
- oe.aConstraints.gridx += 1;
417
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
418
- supportCB.addItemListener(this);
419
-
420
- // oe.aConstraints.gridx += 1;
421
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
422
- // localCB.addItemListener(this);
423
-
424
- oe.aConstraints.gridx += 1;
425
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
426
- crowdCB.addItemListener(this);
427
-
428
- oe.aConstraints.gridx += 1;
429
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
430
- smoothCB.addItemListener(this);
431
-
432
- oe.aConstraints.gridx += 1;
433
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
499
+ oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500
+ oneStepButton.setToolTipText("Animate one step forward");
501
+ oneStepButton.addActionListener(this);
502
+
503
+ oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
504
+ fastCB.setToolTipText("Fast mode");
434505 fastCB.addItemListener(this);
435
- oe.aConstraints.gridx += 1;
436
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
437
- slowCB.addItemListener(this);
438
- oe.aConstraints.gridx += 1;
439
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
440
- boxCB.addItemListener(this);
441
-
442
-// oe.aConstraints.gridx += 1;
443
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
444
-// speakerMocapCB.addItemListener(this);
445
-
446
- if (false)
447
- {
448
- // handled in scripts
449
- oe.aConstraints.gridx += 1;
450
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
451
- speakerCameraCB.addItemListener(this);
452
-
453
- oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
455
- speakerFocusCB.addItemListener(this);
456
-
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
459
- smoothfocusCB.addItemListener(this);
460
- }
461
-
462
-//oe.aConstraints.gridx += 1;
463
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
464
-// debugCB.addItemListener(this);
465
-
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
468
- oeilCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
472
- lookAtCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
506
+
507
+ oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
508
+ trackCB.setToolTipText("Enable tracking");
476509 trackCB.addItemListener(this);
477510
478
- oe.aConstraints.gridx += 1;
479
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
511
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
512
+ screenfitButton.setToolTipText("Screen fit");
480513 screenfitButton.addActionListener(this);
481
- oe.aConstraints.gridx += 1;
514
+
482515 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
483516 // screenfitpointButton.addActionListener(this);
484
-// oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
486
- snapobjectButton.addActionListener(this);
487
- oe.aConstraints.gridx += 1;
488517
489
- //aConstraints.gridx = 0;
490
- //aConstraints.gridy += 1;
491
- oe.aConstraints.weighty = 0;
492
- oe.aConstraints.gridwidth = 1;
493
-
494
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
518
+ if (Globals.ADVANCED)
519
+ {
520
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521
+ snapobjectButton.addActionListener(this);
522
+ snapobjectButton.setToolTipText("Snap Object");
523
+ }
524
+
525
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
+ flashSelectionButton.setToolTipText("Show selection");
495527 flashSelectionButton.addActionListener(this);
496
- oe.aConstraints.gridx += 1;
497
- oe.aConstraints.weighty = 0;
498
- oe.aConstraints.gridwidth = 1;
499528
500
- //
501
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
529
+ oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
530
+
531
+ oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
532
+ twoButton.setToolTipText("Show center view only");
502533 twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
534
+ oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504535 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
536
+ fourButton.setToolTipText("Show left panel only");
537
+ oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538
+ sixButton.setToolTipText("2-column layout left");
506539 sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
540
+ oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541
+ threeButton.setToolTipText("2-column layout right");
508542 threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
543
+ oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544
+ sevenButton.setToolTipText("3-column layout");
510545 sevenButton.addActionListener(this);
511546 //
512547
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
548
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549
+ rootButton.setToolTipText("Edit selection in new tab");
514550 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
551
+
552
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
553
+ closeButton.setToolTipText("Close tab");
517554 closeButton.addActionListener(this);
518555 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
519556 //clearButton.addActionListener(this);
520
- oe.aConstraints.gridx += 1;
521557
522
- oe.aConstraints.gridx = 1; //
523
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
558
+ cGridBag commandsPanel = new cGridBag();
559
+
560
+ commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
+ editButton.setToolTipText("Edit selection");
524562 editButton.addActionListener(this);
525
- oe.aConstraints.gridx += 1;
526
- oe.aConstraints.weighty = 0;
527
- oe.aConstraints.gridwidth = 1;
528563
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
564
+ commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
+ uneditButton.setToolTipText("Unedit selection");
530566 uneditButton.addActionListener(this);
531567
532
- oe.aConstraints.gridx += 1;
533
- oe.aConstraints.weighty = 0;
534
- oe.aConstraints.gridwidth = 1;
535
-
536
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
537
- clearPanelButton.addActionListener(this);
538
-
539
- oe.aConstraints.gridx += 1;
540
- oe.aConstraints.weighty = 0;
541
- oe.aConstraints.gridwidth = 1;
542
-
543
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
568
+ commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569
+ allParamsButton.setToolTipText("Edit all params");
544570 allParamsButton.addActionListener(this);
545571
546
- oe.aConstraints.gridx += 1;
547
- oe.aConstraints.weighty = 0;
548
- oe.aConstraints.gridwidth = 1;
549
-
550
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
572
+ commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573
+ clearPanelButton.setToolTipText("Clear edit panel");
574
+ clearPanelButton.addActionListener(this);
575
+
576
+ commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577
+ unselectButton.setToolTipText("Unselect");
551578 unselectButton.addActionListener(this);
552579
580
+ commandsPanel.preferredHeight = 1;
581
+
582
+ oe.treePanel.add(commandsPanel);
583
+ oe.treePanel.Return();
584
+
553585 // oe.aConstraints.gridx += 1;
554586 // oe.aConstraints.weighty = 0;
555587 // oe.aConstraints.gridwidth = 1;
....@@ -561,40 +593,37 @@
561593 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
562594 // gcButton.addActionListener(this);
563595
564
- oe.aConstraints.gridx = 0;
565
- oe.aConstraints.gridy += 1;
566
-
567
- //ctrlPanel.add(objList = new List(5, true));
568
- oe.aConstraints.gridwidth = 100;
569
- // oe.aConstraints.gridheight = 100;
570
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
571
- oe.aConstraints.gridheight = 1;
572
- oe.aConstraints.weighty = 0.5;
573
- oe.aConstraints.gridx = 0;
574
- JScrollPane jSP;
596
+ cGridBag jSPPanel = new cGridBag();
597
+
598
+ JScrollPane jSP;
575599 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
576
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
600
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
577601 ResetModel();
578
- oe.aConstraints.weighty = 0.5;
579
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
580
- oe.aConstraints.gridy += 1;
581
- oe.aConstraints.gridwidth = 1;
602
+
603
+ oe.treePanel.add(jSPPanel);
604
+ oe.treePanel.Return();
582605
583
- oe.aConstraints.weighty = 0;
584
- oe.aConstraints.gridwidth = 2;
585
-
586
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
606
+ cGridBag copyOptionsPanel = new cGridBag();
607
+
608
+ copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
609
+ colorCB.setToolTipText("Copy color when dropped");
587610 colorCB.addItemListener(this);
588
- oe.aConstraints.gridx += 2;
589
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
611
+
612
+ copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
613
+ materialCB.setToolTipText("Copy material when dropped");
590614 materialCB.addItemListener(this);
591
- oe.aConstraints.gridx += 2;
592
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
615
+
616
+ copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
617
+ textureCB.setToolTipText("Copy texture when dropped");
593618 textureCB.addItemListener(this);
594619
595
- oe.aConstraints.gridx = 0;
596
- oe.aConstraints.gridy += 1;
620
+ copyOptionsPanel.preferredHeight = 1;
621
+ oe.treePanel.add(copyOptionsPanel);
622
+ oe.treePanel.Return();
597623
624
+// mainPanel.setDividerLocation(0.5); //1.0);
625
+// mainPanel.setResizeWeight(0.5);
626
+
598627 //jList.addListSelectionListener(this);
599628 oe.jTree.addTreeSelectionListener(this);
600629 //jTree.setRootVisible(false);
....@@ -616,18 +645,91 @@
616645 radio.layout = sevenButton;
617646 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
618647 }
648
+
649
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
650
+ {
651
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
652
+ boxCB.setToolTipText("Display bounding boxes");
653
+ boxCB.addItemListener(this);
654
+
655
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
656
+ zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
657
+ zoomBoxCB.addItemListener(this);
658
+
659
+ if (true) // Globals.ADVANCED)
660
+ {
661
+ panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
662
+ supportCB.setToolTipText("Enable rigging");
663
+ supportCB.addItemListener(this);
664
+
665
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
666
+ // localCB.addItemListener(this);
667
+
668
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
669
+ crowdCB.setToolTipText("Used for crowds");
670
+ crowdCB.addItemListener(this);
671
+
672
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
673
+ smoothCB.setToolTipText("Snapping delay");
674
+ smoothCB.addItemListener(this);
675
+
676
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
677
+ slowCB.setToolTipText("Smooth interpolation");
678
+ slowCB.addItemListener(this);
679
+
680
+// constraints.gridy += 1;
681
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
682
+// speakerMocapCB.addItemListener(this);
683
+
684
+ if (false)
685
+ {
686
+ // handled in scripts
687
+ //constraints.gridy += 1;
688
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
689
+ speakerCameraCB.addItemListener(this);
690
+
691
+ //constraints.gridy += 1;
692
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
693
+ speakerFocusCB.addItemListener(this);
694
+
695
+ //constraints.gridy += 1;
696
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
697
+ smoothfocusCB.addItemListener(this);
698
+ }
699
+
700
+//constraints.gridx += 1;
701
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
702
+// debugCB.addItemListener(this);
703
+
704
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
705
+ oeilCB.addItemListener(this);
706
+
707
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
708
+ lookAtCB.setToolTipText("Look-at target");
709
+ lookAtCB.addItemListener(this);
710
+
711
+ }
712
+
713
+ cGridBag fill = new cGridBag();
714
+
715
+ fill.preferredHeight = 200;
716
+
717
+ panel.add(fill);
718
+
719
+ }
619720
620721 void EditObject(Object3D obj)
621722 {
622
- cRadio dummyButton = new cRadio(obj.name);
623
- dummyButton.SetObject(obj);
624
- dummyButton.layout = sevenButton;
625
- dummyButton.SetCamera(cameraView.renderCamera, false);
626
- dummyButton.addActionListener(this);
627
- radioPanel.add(dummyButton);
628
- buttonGroup.add(dummyButton);
629
- dummyButton.doClick();
723
+ cRadio radioButton = new cRadio(obj.name);
724
+ radioButton.SetObject(obj);
725
+ radioButton.layout = sevenButton;
726
+ radioButton.SetCamera(cameraView.renderCamera, false);
727
+ radioButton.addActionListener(this);
728
+ radioPanel.add(radioButton);
729
+ buttonGroup.add(radioButton);
730
+ radioButton.doClick();
630731 }
732
+
631733 void SetupViews(ObjEditor oe)
632734 {
633735 oe.SetupViews();
....@@ -646,6 +748,7 @@
646748 JCheckBox fastCB;
647749 JCheckBox slowCB;
648750 JCheckBox boxCB;
751
+ JCheckBox zoomBoxCB;
649752 JCheckBox trackCB;
650753 JCheckBox smoothfocusCB;
651754 // JCheckBox speakerMocapCB;
....@@ -688,8 +791,7 @@
688791 dropAttributes |= Object3D.TEXTURE;
689792 else
690793 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
794
+ } else if(e.getSource() == liveCB)
693795 {
694796 cameraView.ToggleLive();
695797 }
....@@ -726,6 +828,10 @@
726828 Recompile();
727829 cameraView.repaint();
728830 // refreshContents();
831
+ }
832
+ else if(e.getSource() == zoomBoxCB)
833
+ {
834
+ cameraView.ToggleZoomBoxMode();
729835 }
730836 else if(e.getSource() == smoothfocusCB)
731837 {
....@@ -840,7 +946,9 @@
840946 // objEditor.DropFile((java.io.File[]) object, true);
841947 // return;
842948 // }
843
- if (string.charAt(0) == '/')
949
+
950
+ // File path for Mac and Windows
951
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
844952 {
845953 // file(s)
846954 String[] names = string.split("\n");
....@@ -867,7 +975,7 @@
867975
868976 flashIt = false;
869977 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
978
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
871979 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
872980
873981 if (group.selection.size() == 1)
....@@ -894,11 +1002,11 @@
8941002 {
8951003 loadClipboard(true);
8961004 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
1005
+ pasteInto(false, false);
8981006 } else {
8991007 loadClipboard(false);
9001008 objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
1009
+ pasteInto(false, false); // true); // ???
9021010 }
9031011 }
9041012 public void dropActionChanged(DropTargetDragEvent dtde)
....@@ -1002,6 +1110,8 @@
10021110
10031111 void buildCreateMenu(Menu menu)
10041112 {
1113
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1114
+ //heightFieldItem.addActionListener(this);
10051115 gridItem = menu.add(new MenuItem("Grid"));
10061116 gridItem.addActionListener(this);
10071117 rectoidItem = menu.add(new MenuItem("Box"));
....@@ -1014,29 +1124,37 @@
10141124 torusItem.addActionListener(this);
10151125 superItem = menu.add(new MenuItem("Superellipsoid"));
10161126 superItem.addActionListener(this);
1127
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1128
+ kleinItem.addActionListener(this);
10171129 particleItem = menu.add(new MenuItem("Particle system"));
10181130 particleItem.addActionListener(this);
1131
+ if (Globals.ADVANCED)
1132
+ {
10191133 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201134 ragdollItem.addActionListener(this);
10211135 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221136 ragdoll2Item.addActionListener(this);
1137
+ }
10231138 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1139
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251140 meshItem.addActionListener(this);
10261141 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271142 // meshGroupItem.addActionListener(this);
1143
+ if (Globals.ADVANCED)
1144
+ {
10281145 springItem = menu.add(new MenuItem("Spring"));
10291146 springItem.addActionListener(this);
10301147 flagItem = menu.add(new MenuItem("Flag"));
10311148 flagItem.addActionListener(this);
1032
- bezierItem = menu.add(new MenuItem("Patch"));
1033
- bezierItem.addActionListener(this);
1034
- checkerItem = menu.add(new MenuItem("Checker"));
1035
- checkerItem.addActionListener(this);
10361149 blobItem = menu.add(new MenuItem("Blob"));
10371150 blobItem.addActionListener(this);
10381151 latheItem = menu.add(new MenuItem("Lathe"));
10391152 latheItem.addActionListener(this);
1153
+ }
1154
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1155
+ bezierItem.addActionListener(this);
1156
+ overlayItem = menu.add(new MenuItem("Overlay"));
1157
+ overlayItem.addActionListener(this);
10401158 lightItem = menu.add(new MenuItem("Light"));
10411159 lightItem.addActionListener(this);
10421160 menu.add("-");
....@@ -1046,41 +1164,39 @@
10461164 loopItem.addActionListener(this);
10471165 doubleItem = menu.add(new MenuItem("Fork"));
10481166 doubleItem.addActionListener(this);
1167
+ if (Globals.ADVANCED)
1168
+ {
10491169 tripleItem = menu.add(new MenuItem("Trident"));
10501170 tripleItem.addActionListener(this);
1051
- menu.add("-");
1052
- importGFDItem = menu.add(new MenuItem("GraphreeD Object..."));
1053
- importGFDItem.addActionListener(this);
1054
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
1055
- importVRMLX3DItem.addActionListener(this);
1056
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
1057
- importOBJItem.addActionListener(this);
1058
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
1059
- import3DSItem.addActionListener(this);
1171
+ }
10601172 }
10611173
10621174 void buildToolsMenu(Menu menu)
10631175 {
10641176 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651177 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1178
+ animationItem.setState(Globals.ANIMATION);
10671179
10681180 menu.add("-");
10691181 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701182 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1183
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1184
+ textureFieldItem.addActionListener(this);
1185
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721186 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751187 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761188 reduceMorphItem.addActionListener(this);
10771189 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781190 reduce34MorphItem.addActionListener(this);
1079
-
1191
+ menu.add("-");
10801192 menu.add(computeAOItem = new MenuItem("Compute AO"));
10811193 computeAOItem.addActionListener(this);
1082
- menu.add("-");
10831194
1195
+ if (Globals.ADVANCED)
1196
+ {
1197
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1198
+ mirrorItem.addActionListener(this);
1199
+ menu.add("-");
10841200 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851201 memoryItem.addActionListener(this);
10861202 menu.add(analyzeItem = new MenuItem("Analyze"));
....@@ -1094,6 +1210,8 @@
10941210 resetParentItem.addActionListener(this);
10951211 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961212 repairParentItem.addActionListener(this);
1213
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1214
+ repairShadowItem.addActionListener(this);
10971215 menu.add(invariantsItem = new MenuItem("Invariants"));
10981216 invariantsItem.addActionListener(this);
10991217 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1219,7 @@
11011219 menu.add("-");
11021220 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031221 editScriptItem.addActionListener(this);
1222
+ }
11041223 }
11051224
11061225 void ScreenFit()
....@@ -1429,9 +1548,9 @@
14291548
14301549 void Overwrite(int mask)
14311550 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1551
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14331552 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1553
+ Object3D content = Grafreed.clipboard.get(0);
14351554
14361555 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371556 content = ((cGroup)content).get(0);
....@@ -1454,6 +1573,7 @@
14541573 //
14551574 public void actionPerformed(ActionEvent event) // , Object arg)
14561575 {
1576
+ Object source = event.getSource();
14571577 /*
14581578 if (event.getSource() == nameField)
14591579 {
....@@ -1465,11 +1585,11 @@
14651585 }
14661586 else
14671587 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1588
+ if (source == lookAtItem || source == lookFromItem)
14691589 {
14701590 ScreenFit();
14711591 } else
1472
- if (event.getSource() == switchItem)
1592
+ if (source == switchItem)
14731593 {
14741594 cVector v1 = new cVector();
14751595 cVector v2 = new cVector();
....@@ -1478,11 +1598,11 @@
14781598 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791599 objEditor.cameraView.repaint();
14801600 } else
1481
- if (event.getSource() == rectoidItem)
1601
+ if (source == rectoidItem)
14821602 {
14831603 makeSomething(new Box());
14841604 } else
1485
- if (event.getSource() == particleItem)
1605
+ if (source == particleItem)
14861606 {
14871607 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881608 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1623,9 @@
15031623 applyExample(particleGeom, "SMOKE");
15041624 makeSomething(particleGeom);
15051625 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1626
+ if (source == ragdollItem || source == ragdoll2Item)
15071627 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1628
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091629
15101630 ragdoll.toParent = LA.newMatrix();
15111631 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +1641,71 @@
15211641 makeSomething(ragdoll);
15221642 //makeSomething(new VehicleDemo());
15231643 } else
1524
- if (event.getSource() == gridItem)
1644
+ /*
1645
+ */
1646
+ if (source == heightFieldItem)
1647
+ {
1648
+ Object3D obj = new Object3D();
1649
+
1650
+ obj.CreateMaterial();
1651
+ obj.bRep = new BoundaryRep();
1652
+
1653
+ obj.bRep.CreateMesh(new iHeightField()
1654
+ {
1655
+ public double f(double x, double y)
1656
+ {
1657
+ // The Mandelbrot set is represented by coloring
1658
+ // each point (x,y) according to the number of
1659
+ // iterations it takes before the while loop in
1660
+ // this method ends. For points that are actually
1661
+ // in the Mandelbrot set, or very close to it, the
1662
+ // count will reach the maximum value, 80. These
1663
+ // points will be colored purple. All other colors
1664
+ // represent points that are definitely NOT in the set.
1665
+ x -= 600;
1666
+ y -= 500;
1667
+ x /= 200;
1668
+ y /= 200;
1669
+ int count = 0;
1670
+ double zx = x;
1671
+ double zy = y;
1672
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
1673
+ double new_zx = zx*zx - zy*zy + x;
1674
+ zy = 2*zx*zy + y;
1675
+ zx = new_zx;
1676
+ count++;
1677
+ }
1678
+ return count; // Math.sqrt(count);
1679
+ }
1680
+ }, 1000,1000);
1681
+
1682
+ makeSomething(obj);
1683
+ } else
1684
+ if (source == gridItem)
15251685 {
15261686 makeSomething(new Grid());
15271687 } else
1528
- if (event.getSource() == ellipsoidItem)
1688
+ if (source == ellipsoidItem)
15291689 {
15301690 makeSomething(new Sphere());
15311691 } else
1532
- if (event.getSource() == coneItem)
1692
+ if (source == coneItem)
15331693 {
15341694 makeSomething(new Cone());
15351695 } else
1536
- if (event.getSource() == torusItem)
1696
+ if (source == torusItem)
15371697 {
15381698 makeSomething(new Torus());
15391699 } else
1540
- if (event.getSource() == superItem)
1700
+ if (source == superItem)
15411701 {
15421702 makeSomething(new Superellipsoid());
15431703 } else
1544
- if (event.getSource() == blobItem)
1704
+ if (source == kleinItem)
1705
+ {
1706
+ makeSomething(new Klein());
1707
+ } else
1708
+ if (source == blobItem)
15451709 {
15461710 Blob blob = new Blob();
15471711 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +1713,15 @@
15491713 //blob.retile();
15501714 makeSomething(blob);
15511715 } else
1552
- if (event.getSource() == latheItem)
1716
+ if (source == latheItem)
15531717 {
15541718 makeSomething(new Lathe());
15551719 } else
1556
- if (event.getSource() == bezierItem)
1720
+ if (source == bezierItem)
15571721 {
15581722 makeSomething(new BezierSurface());
15591723 } else
1560
- if (event.getSource() == checkerItem)
1724
+ if (source == overlayItem)
15611725 {
15621726 /*
15631727 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +1734,9 @@
15701734 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15711735 LA.matInvert(obj.toParent, obj.fromParent);
15721736 */
1573
- makeSomething(new CheckerIG());
1737
+ makeSomething(new Checker());
15741738 } else
1575
- if (event.getSource() == meshItem)
1739
+ if (source == meshItem)
15761740 {
15771741 Object3D itemtomake = new Object3D();
15781742 Object3D child;
....@@ -1593,35 +1757,35 @@
15931757 makeSomething(child);
15941758 }
15951759 } else
1596
- if (event.getSource() == springItem)
1760
+ if (source == springItem)
15971761 {
15981762 cSpring s = new cSpring();
15991763 s.setup();
16001764 makeSomething(s);
16011765 } else
1602
- if (event.getSource() == flagItem)
1766
+ if (source == flagItem)
16031767 {
16041768 cSpring s = new cFlag();
16051769 s.setup();
16061770 makeSomething(s);
16071771 } else
1608
- if (event.getSource() == lightItem)
1772
+ if (source == lightItem)
16091773 {
16101774 makeSomething(new Light());
16111775 } else
1612
- if (event.getSource() == csgItem)
1776
+ if (source == csgItem)
16131777 {
16141778 group(new CSG());
16151779 } else
1616
- if (event.getSource() == templateItem)
1780
+ if (source == templateItem)
16171781 {
16181782 group(new cTemplate());
16191783 } else
1620
- if (event.getSource() == attributeItem)
1784
+ if (source == attributeItem)
16211785 {
16221786 makeSomething(new Attribute());
16231787 } else
1624
- if (event.getSource() == pointflowItem)
1788
+ if (source == pointflowItem)
16251789 {
16261790 makeSomething(new PointFlow());
16271791 } else
....@@ -1633,7 +1797,7 @@
16331797 } else
16341798 */
16351799
1636
- if (event.getSource() == superLoopItem)
1800
+ if (source == superLoopItem)
16371801 {
16381802 Composite g = new cGroup();
16391803 for (int i=0; i<15; i++)
....@@ -1655,7 +1819,7 @@
16551819
16561820 group(g);
16571821 } else
1658
- if (event.getSource() == loopItem)
1822
+ if (source == loopItem)
16591823 {
16601824 Composite csg = new GroupLeaf();
16611825 csg.count = 5;
....@@ -1664,7 +1828,7 @@
16641828 csg.addChild(child);
16651829 child.addChild(csg);
16661830 } else
1667
- if (event.getSource() == doubleItem)
1831
+ if (source == doubleItem)
16681832 {
16691833 Composite csg = new GroupLeaf();
16701834 csg.count = 5;
....@@ -1676,7 +1840,7 @@
16761840 csg.addChild(child);
16771841 child.addChild(csg);
16781842 } else
1679
- if (event.getSource() == tripleItem)
1843
+ if (source == tripleItem)
16801844 {
16811845 Composite csg = new GroupLeaf();
16821846 csg.count = 4;
....@@ -1692,70 +1856,83 @@
16921856 child.addChild(csg);
16931857 } else
16941858
1695
- if (event.getSource() == importGFDItem)
1859
+ if (source == importGFDItem)
16961860 {
16971861 ImportGFD();
16981862 } else
1699
- if (event.getSource() == importVRMLX3DItem)
1863
+ if (source == importVRMLX3DItem)
17001864 {
17011865 ImportVRMLX3D();
17021866 } else
1703
- if (event.getSource() == import3DSItem)
1867
+ if (source == import3DSItem)
17041868 {
17051869 objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
17061870 } else
1707
- if (event.getSource() == importOBJItem)
1871
+ if (source == importOBJItem)
17081872 {
1709
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1873
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1874
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1875
+ browser.setVisible(true);
1876
+ String filename = browser.getFile();
1877
+ if (filename != null && filename.length() > 0)
1878
+ {
1879
+ String fullname = browser.getDirectory() + filename;
1880
+ makeSomething(ReadOBJ(fullname), true);
1881
+ }
17101882 } else
1711
- if (event.getSource() == computeAOItem)
1883
+ if (source == computeAOItem)
17121884 {
1713
- CameraPane.drawMode = CameraPane.OCCLUSION;
1714
- CameraPane.theRenderer.repaint();
1885
+ Globals.drawMode = CameraPane.OCCLUSION;
1886
+ Globals.theRenderer.repaint();
17151887 } else
1716
- if (event.getSource() == recompileItem)
1888
+ if (source == recompileItem)
17171889 {
17181890 Recompile();
17191891 refreshContents();
17201892 } else
1721
- if (event.getSource() == editScriptItem)
1893
+ if (source == editScriptItem)
17221894 {
17231895 OpenDialog();
17241896 refreshContents();
17251897 } else
1726
- if (event.getSource() == invariantsItem)
1898
+ if (source == invariantsItem)
17271899 {
17281900 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
1901
+ Grafreed.grafreeD.universe.invariants();
17301902 } else
1731
- if (event.getSource() == memoryItem)
1903
+ if (source == memoryItem)
17321904 {
17331905 //System.out.println("Invariants:");
17341906 PrintMemory();
17351907 } else
1736
- if (event.getSource() == pathItem)
1908
+ if (source == pathItem)
17371909 {
17381910 PrintPath();
17391911 } else
1740
- if (event.getSource() == analyzeItem)
1912
+ if (source == analyzeItem)
17411913 {
17421914 AnalyzeObject();
17431915 } else
1744
- if (event.getSource() == dumpItem)
1916
+ if (source == dumpItem)
17451917 {
17461918 DumpObject();
17471919 } else
1748
- if (event.getSource() == screenfitButton)
1920
+ if (source == oneStepButton)
1921
+ {
1922
+ Globals.ONESTEP = true;
1923
+ cameraView.repaint();
1924
+ } else
1925
+ if (source == screenfitButton)
17491926 {
17501927 //Reload(lastConverter, lastFilename, true);
17511928 ScreenFit();
17521929 } else
1753
- if (event.getSource() == screenfitpointButton)
1930
+ if (source == screenfitpointButton)
17541931 {
17551932 //Reload(lastConverter, lastFilename, true);
17561933 ScreenFitPoint();
17571934 } else
1758
- if (event.getSource() == snapobjectButton)
1935
+ if (source == snapobjectButton)
17591936 {
17601937 //Reload(lastConverter, lastFilename, true);
17611938 SnapObject();
....@@ -1766,13 +1943,13 @@
17661943 // Recompile();
17671944 // refreshContents();
17681945 // } else
1769
- if (event.getSource() == gcButton)
1946
+ if (source == gcButton)
17701947 {
17711948 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17721949 System.gc();
17731950 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17741951 } else
1775
- if (event.getSource() == editLeafItem)
1952
+ if (source == editLeafItem)
17761953 {
17771954 Object3D obj;
17781955 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +1963,70 @@
17861963 }
17871964 refreshContents(true);
17881965 } else
1789
- if (event.getSource() == openWindowItem)
1966
+ if (source == openWindowItem)
17901967 {
17911968 EditSelection(true);
17921969 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
1970
+ if (source == cutItem || source == clearButton)
17941971 {
17951972 loadClipboard(true);
17961973 } else
1797
- if (event.getSource() == duplicateItem)
1974
+ if (source == duplicateItem)
17981975 {
1799
- Object3D keep = GraphreeD.clipboard;
1976
+ Object3D keep = Grafreed.clipboard;
18001977 loadClipboard(false);
18011978 paste(false);
1802
- GraphreeD.clipboard = keep;
1979
+ Grafreed.clipboard = keep;
18031980 } else
1804
- if (event.getSource() == cloneItem)
1981
+ if (source == cloneItem)
18051982 {
18061983 CloneSelection(false);
18071984 } else
1808
- if (event.getSource() == cloneSupportItem)
1985
+ if (source == cloneSupportItem)
18091986 {
18101987 CloneSelection(true);
18111988 } else
1812
- if (event.getSource() == copyItem)
1989
+ if (source == copyItem)
18131990 {
18141991 loadClipboard(false);
18151992 } else
1816
- if (event.getSource() == pasteItem)
1993
+ if (source == pasteItem)
18171994 {
18181995 paste(false);
18191996 } else
1820
- if (event.getSource() == pasteLinkItem)
1997
+ if (source == pasteIntoItem)
18211998 {
1822
- pasteInto(false);
1999
+ pasteInto(true, false);
18232000 } else
1824
- if (event.getSource() == pasteCloneItem)
2001
+ if (source == pasteLinkItem)
18252002 {
1826
- pasteInto(true);
2003
+ pasteInto(false, false);
18272004 } else
1828
- if (event.getSource() == pasteExpandItem)
2005
+ if (source == pasteCloneItem)
2006
+ {
2007
+ pasteInto(true, true);
2008
+ } else
2009
+ if (source == pasteExpandItem)
18292010 {
18302011 paste(true);
18312012 } else
1832
- if (event.getSource() == synchronizeItem)
2013
+ if (source == synchronizeItem)
18332014 {
18342015 Overwrite(Object3D.TRANSFORM);
18352016 } else
1836
- if (event.getSource() == overwriteNameItem)
2017
+ if (source == overwriteNameItem)
18372018 {
18382019 Overwrite(Object3D.NAME);
18392020 } else
1840
- if (event.getSource() == overwriteUVItem)
2021
+ if (source == overwriteUVItem)
18412022 {
18422023 Overwrite(Object3D.UV);
18432024 } else
1844
- if (event.getSource() == overwriteMatItem)
2025
+ if (source == overwriteMatItem)
18452026 {
2027
+ /* july 2015
18462028 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2029
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482030 else
18492031 {
18502032 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2038,16 @@
18562038 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572039 }
18582040 }
2041
+ */
2042
+
2043
+ Overwrite(dropAttributes);
18592044 }
1860
- if (event.getSource() == overwriteGeoItem)
2045
+ if (source == overwriteGeoItem)
18612046 {
18622047 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2048
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642049 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2050
+// Object3D content = GrafreeD.clipboard.get(0);
18662051 //
18672052 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682053 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2059,7 @@
18742059 // refreshContents();
18752060 // }
18762061 } else
1877
- if (event.getSource() == generateMeshItem)
2062
+ if (source == generateMeshItem)
18782063 {
18792064 //if (group.selection.size() == 1)
18802065 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2070,7 @@
18852070 ResetModel();
18862071 refreshContents();
18872072 } else
1888
- if (event.getSource() == extractGeometriesItem)
2073
+ if (source == extractGeometriesItem)
18892074 {
18902075 boolean one = false;
18912076
....@@ -1912,7 +2097,7 @@
19122097 ResetModel();
19132098 refreshContents();
19142099 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2100
+ if (source == cloneGeometriesItem)
19162101 {
19172102 boolean one = false;
19182103
....@@ -1938,32 +2123,37 @@
19382123 ResetModel();
19392124 refreshContents();
19402125 } else
1941
- if (event.getSource() == shareGeometriesItem)
2126
+ if (source == shareGeometriesItem)
19422127 {
19432128 boolean one = false;
19442129
19452130 if (group.selection.size() == 1)
19462131 one = true;
19472132
2133
+ Object3D merge = null;
2134
+
19482135 Object3D content = new cGroup();
19492136
19502137 for (int i=0; i<group.selection.size(); i++)
19512138 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2139
+ merge = new Merge(group.selection.get(i));
19532140
19542141 if (one)
1955
- makeSomething(sel, false);
2142
+ makeSomething(merge, false);
19562143 else
1957
- content.addChild(sel);
2144
+ content.addChild(merge);
19582145 }
19592146
19602147 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2148
+ makeSomething(content, true);
2149
+ else
2150
+ {
2151
+ ResetModel();
2152
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2153
+ refreshContents();
2154
+ }
19652155 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2156
+ if (source == mergeGeometriesItem)
19672157 {
19682158 boolean one = false;
19692159
....@@ -1993,11 +2183,11 @@
19932183 ResetModel();
19942184 refreshContents();
19952185 } else
1996
- if (event.getSource() == linkverticesItem)
2186
+ if (source == linkverticesItem)
19972187 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2188
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992189 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2190
+// Object3D content = GrafreeD.clipboard.get(0);
20012191 //
20022192 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032193 // content = ((cGroup)content).get(0);
....@@ -2006,39 +2196,48 @@
20062196 // group.selection.get(0).setMasterThis(content); // should be identity
20072197 // refreshContents();
20082198 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2199
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20102200 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2201
+ Object3D content = Grafreed.clipboard.get(0);
20122202
20132203 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142204 content = ((cGroup)content).get(0);
20152205
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2206
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172207 for (int i=0; i<group.selection.size(); i++)
20182208 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
2209
+ boolean random = CameraPane.SWITCH;
2210
+ CameraPane.SWITCH = false; // parse all random nodes
20212211 group.selection.get(i).linkVerticesThis(content);
20222212 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
2213
+ CameraPane.SWITCH = random;
20242214 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2215
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262216 refreshContents();
20272217 }
20282218 } else
2029
- if (event.getSource() == resetsupportItem)
2219
+ if (source == resetsupportItem)
20302220 {
20312221 for (int i=0; i<group.selection.size(); i++)
20322222 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
2223
+ boolean random = CameraPane.SWITCH;
2224
+ CameraPane.SWITCH = false; // parse all random nodes
20352225 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
2226
+ CameraPane.SWITCH = random;
20372227 }
20382228
20392229 refreshContents();
20402230 } else
2041
- if (event.getSource() == resetreferencesItem)
2231
+ if (source == relinkverticesItem)
2232
+ {
2233
+ boolean random = CameraPane.SWITCH;
2234
+ CameraPane.SWITCH = false; // parse all random nodes
2235
+ group.selection.RelinkToSupport();
2236
+ CameraPane.SWITCH = random;
2237
+
2238
+ refreshContents();
2239
+ } else
2240
+ if (source == resetreferencesItem)
20422241 {
20432242 for (int i=0; i<group.selection.size(); i++)
20442243 {
....@@ -2047,11 +2246,11 @@
20472246
20482247 refreshContents();
20492248 } else
2050
- if (event.getSource() == setMasterItem)
2249
+ if (source == setMasterItem)
20512250 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2251
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20532252 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2253
+ Object3D content = Grafreed.clipboard.get(0);
20552254
20562255 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572256 content = ((cGroup)content).get(0);
....@@ -2060,13 +2259,13 @@
20602259 refreshContents();
20612260 }
20622261 } else
2063
- if (event.getSource() == poseMeshItem)
2262
+ if (source == poseMeshItem)
20642263 {
20652264 if (group.selection.size() == 1)
20662265 {
2067
- if (GraphreeD.clipboard.size() == 1)
2266
+ if (Grafreed.clipboard.size() == 1)
20682267 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2268
+ Object3D content = Grafreed.clipboard.get(0);
20702269
20712270 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722271 content = ((cGroup)content).get(0);
....@@ -2079,19 +2278,19 @@
20792278 }
20802279
20812280 } else
2082
- if (event.getSource() == revertMeshItem)
2281
+ if (source == revertMeshItem)
20832282 {
20842283 RevertMeshes();
20852284 } else
2086
- if (event.getSource() == resetMeshItem)
2285
+ if (source == resetAllItem)
20872286 {
20882287 ResetAll();
20892288 } else
2090
- if (event.getSource() == stepAllItem)
2289
+ if (source == stepAllItem)
20912290 {
20922291 StepAll();
20932292 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2293
+ if (source == clearItem) // || event.getSource() == clearButton)
20952294 {
20962295 //int indices[] = jList.getSelectedIndices();
20972296 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2298,46 @@
20992298
21002299 ClearSelection(false);
21012300 } else
2102
- if (event.getSource() == clearAllItem)
2301
+ if (source == clearAllItem)
21032302 {
21042303 ClearSelection(true);
21052304 } else
2106
- if (event.getSource() == grabItem)
2305
+ if (source == grabItem)
21072306 {
21082307 group(new cGroup(), true);
21092308 } else
2110
- if (event.getSource() == frontItem)
2309
+ if (source == hideItem)
2310
+ {
2311
+ group(new HiddenObject());
2312
+ } else
2313
+ if (source == frontItem)
21112314 {
21122315 front();
21132316 } else
2114
- if (event.getSource() == backItem)
2317
+ if (source == backItem)
21152318 {
21162319 back();
21172320 } else
2118
- if (event.getSource() == cameraItem)
2321
+ if (source == cameraItem)
21192322 {
21202323 makeSomething(new Camera());
21212324 } else
2122
- if (event.getSource() == compositeItem)
2325
+ if (source == compositeItem)
21232326 {
21242327 group(new Composite());
21252328 } else
2126
- if (event.getSource() == randomItem)
2329
+ if (source == randomItem)
21272330 {
21282331 RandomNode random = new RandomNode();
21292332 group(random);
21302333 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
2334
+ random.name = random.get(0).name + "Switch";
21322335 } else
2133
- if (event.getSource() == physicsItem)
2336
+ if (source == physicsItem)
21342337 {
21352338 group(new PhysicsNode());
21362339 } else
2137
- if (event.getSource() == frameselectorItem)
2340
+ if (source == frameselectorItem)
21382341 {
21392342 for (int i=0; i<group.selection.size(); i++)
21402343 {
....@@ -2146,7 +2349,7 @@
21462349 ResetModel();
21472350 refreshContents();
21482351 } else
2149
- if (event.getSource() == switchGeoItem)
2352
+ if (source == switchGeoItem)
21502353 {
21512354 for (int i=0; i<group.selection.size(); i++)
21522355 {
....@@ -2158,7 +2361,7 @@
21582361 ResetModel();
21592362 refreshContents();
21602363 } else
2161
- if (event.getSource() == switchTransfoItem)
2364
+ if (source == switchTransfoItem)
21622365 {
21632366 for (int i=0; i<group.selection.size(); i++)
21642367 {
....@@ -2170,7 +2373,7 @@
21702373 ResetModel();
21712374 refreshContents();
21722375 } else
2173
- if (event.getSource() == morphItem)
2376
+ if (source == morphItem)
21742377 {
21752378 for (int i=0; i<group.selection.size(); i++)
21762379 {
....@@ -2182,7 +2385,7 @@
21822385 ResetModel();
21832386 refreshContents();
21842387 } else
2185
- if (event.getSource() == scriptNodeItem)
2388
+ if (source == scriptNodeItem)
21862389 {
21872390 boolean atleastone = false;
21882391
....@@ -2221,191 +2424,223 @@
22212424 }
22222425 }
22232426 } else
2224
- if (event.getSource() == linkerItem)
2427
+ if (source == linkerItem)
22252428 {
22262429 group(new cLinker());
22272430 } else
2228
- if (event.getSource() == textureItem)
2431
+ if (source == textureItem)
22292432 {
22302433 group(new TextureNode());
22312434 } else
2232
- if (event.getSource() == shadowXItem)
2435
+ if (source == billboardItem)
2436
+ {
2437
+ group(new BillboardNode());
2438
+ } else
2439
+ if (source == shadowXItem)
22332440 {
22342441 CastShadow(0);
22352442 } else
2236
- if (event.getSource() == shadowYItem)
2443
+ if (source == shadowYItem)
22372444 {
22382445 CastShadow(1);
22392446 } else
2240
- if (event.getSource() == shadowZItem)
2447
+ if (source == shadowZItem)
22412448 {
22422449 CastShadow(2);
22432450 } else
2244
- if (event.getSource() == ungroupItem)
2451
+ if (source == ungroupItem)
22452452 {
2246
- ungroup();
2453
+ //ungroup();
2454
+ for (int i=0; i<group.selection.size(); i++)
2455
+ {
2456
+ Ungroup(group.selection.get(i));
2457
+ }
2458
+
2459
+ ClearSelection(false);
2460
+
2461
+ refreshContents();
22472462 } else
2248
- if (event.getSource() == genUVItem)
2463
+ if (source == genUVItem)
22492464 {
22502465 GenUV();
22512466 } else
2252
- if (event.getSource() == genNormalsCADItem)
2467
+ if (source == genNormalsCADItem)
22532468 {
22542469 GenNormals(true);
22552470 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2471
+ if (source == genNormalsMESHItem)
2472
+ {
2473
+ GenNormals(true); // TODO
2474
+ } else
2475
+ if (source == genNormalsORGANItem)
22572476 {
22582477 GenNormals(false);
22592478 } else
2260
- if (event.getSource() == stripifyItem)
2479
+ if (source == genNormalsMINEItem)
2480
+ {
2481
+ GenNormalsMINE();
2482
+ } else
2483
+ if (source == stripifyItem)
22612484 {
22622485 Stripify();
22632486 } else
2264
- if (event.getSource() == unstripifyItem)
2487
+ if (source == unstripifyItem)
22652488 {
22662489 Unstripify();
22672490 } else
2268
- if (event.getSource() == trimItem)
2491
+ if (source == trimItem)
22692492 {
22702493 Trim();
22712494 } else
2272
- if (event.getSource() == untrimItem)
2495
+ if (source == untrimItem)
22732496 {
22742497 Untrim();
22752498 } else
2276
- if (event.getSource() == clearColorsItem)
2499
+ if (source == clearColorsItem)
22772500 {
22782501 ClearColors();
22792502 } else
2280
- if (event.getSource() == clearMaterialsItem)
2503
+ if (source == clearMaterialsItem)
22812504 {
22822505 ClearMaterials();
22832506 } else
2284
- if (event.getSource() == liveleavesItem)
2507
+ if (source == liveleavesItem)
22852508 {
22862509 LiveLeaves(true);
22872510 } else
2288
- if (event.getSource() == unliveleavesItem)
2511
+ if (source == unliveleavesItem)
22892512 {
22902513 LiveLeaves(false);
22912514 } else
2292
- if (event.getSource() == supportleavesItem)
2515
+ if (source == supportleavesItem)
22932516 {
22942517 SupportLeaves(true);
22952518 } else
2296
- if (event.getSource() == unsupportleavesItem)
2519
+ if (source == unsupportleavesItem)
22972520 {
22982521 SupportLeaves(false);
22992522 } else
2300
- if (event.getSource() == hideleavesItem)
2523
+ if (source == hideleavesItem)
23012524 {
23022525 HideLeaves(true);
23032526 } else
2304
- if (event.getSource() == showleavesItem)
2527
+ if (source == showleavesItem)
23052528 {
23062529 HideLeaves(false);
23072530 } else
2308
- if (event.getSource() == markleavesItem)
2531
+ if (source == markleavesItem)
23092532 {
23102533 MarkLeaves(true);
23112534 } else
2312
- if (event.getSource() == unmarkleavesItem)
2535
+ if (source == unmarkleavesItem)
23132536 {
23142537 MarkLeaves(false);
23152538 } else
2316
- if (event.getSource() == flipVItem)
2539
+ if (source == flipVItem)
23172540 {
23182541 FlipV(true);
23192542 } else
2320
- if (event.getSource() == unflipVItem)
2543
+ if (source == unflipVItem)
23212544 {
23222545 FlipV(false);
23232546 } else
2324
- if (event.getSource() == lowTexturesItem)
2547
+ if (source == lowTexturesItem)
23252548 {
23262549 SetTexRes(0);
23272550 } else
2328
- if (event.getSource() == normalTexturesItem)
2551
+ if (source == normalTexturesItem)
23292552 {
23302553 SetTexRes(1);
23312554 } else
2332
- if (event.getSource() == highTexturesItem)
2555
+ if (source == highTexturesItem)
23332556 {
23342557 SetTexRes(2);
23352558 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2559
+ if (source == veryhighTexturesItem)
23372560 {
23382561 SetTexRes(3);
23392562 } else
2340
- if (event.getSource() == maxTexturesItem)
2563
+ if (source == maxTexturesItem)
23412564 {
23422565 SetTexRes(4);
23432566 } else
2344
- if (event.getSource() == panoTexturesItem)
2567
+ if (source == panoTexturesItem)
23452568 {
23462569 SetTexRes(5);
23472570 } else
2348
- if (event.getSource() == reverseNormalsItem)
2571
+ if (source == reverseNormalsItem)
23492572 {
23502573 ReverseNormals();
23512574 } else
2352
- if (event.getSource() == parseverticesItem)
2575
+ if (source == parseverticesItem)
23532576 {
23542577 ParseVertices();
23552578 } else
2356
- if (event.getSource() == alignItem)
2579
+ if (source == textureFieldItem)
2580
+ {
2581
+ TextureVertices();
2582
+ } else
2583
+ if (source == alignItem)
23572584 {
23582585 Align();
23592586 } else
2360
- if (event.getSource() == mirrorItem)
2587
+ if (source == mirrorItem)
23612588 {
23622589 MirrorPoses();
23632590 } else
2364
- if (event.getSource() == reduceMorphItem)
2591
+ if (source == reduceMorphItem)
23652592 {
23662593 MeshReduction(false);
23672594 } else
2368
- if (event.getSource() == reduce34MorphItem)
2595
+ if (source == reduce34MorphItem)
23692596 {
23702597 MeshReduction(true);
23712598 } else
2372
- if (event.getSource() == reverseTrianglesItem)
2599
+ if (source == reverseTrianglesItem)
23732600 {
23742601 ReverseTriangles();
23752602 } else
2376
- if (event.getSource() == reduceMeshItem)
2603
+ if (source == reduceMeshItem)
23772604 {
23782605 ReduceMesh(false);
23792606 } else
2380
- if (event.getSource() == reduce34MeshItem)
2607
+ if (source == reduce34MeshItem)
23812608 {
23822609 ReduceMesh(true);
23832610 } else
2384
- if (event.getSource() == increaseMeshItem)
2611
+ if (source == increaseMeshItem)
23852612 {
23862613 IncreaseMesh();
23872614 } else
2388
- if (event.getSource() == clipMeshItem)
2615
+ if (source == clipMeshItem)
23892616 {
23902617 ClipMesh();
23912618 } else
2392
- if (event.getSource() == smoothMeshItem)
2619
+ if (source == smoothMeshItem)
23932620 {
23942621 SmoothMesh();
23952622 } else
2396
- if (event.getSource() == transformgeometryItem)
2623
+ if (source == transformGeometryItem)
23972624 {
23982625 TransformGeometry();
23992626 } else
2400
- if (event.getSource() == resetTransformItem)
2627
+ if (source == transformChildrenItem)
2628
+ {
2629
+ TransformChildren();
2630
+ } else
2631
+ if (source == resetTransformItem)
24012632 {
24022633 ResetTransform();
24032634 } else
2404
- if (event.getSource() == resetCentroidItem)
2635
+ if (source == resetCentroidItem)
24052636 {
2406
- ResetCentroid();
2637
+ ResetCentroid(true);
24072638 } else
2408
- if (event.getSource() == resetParentItem)
2639
+ if (source == resetCentroidXZItem)
2640
+ {
2641
+ ResetCentroid(false);
2642
+ } else
2643
+ if (source == resetParentItem)
24092644 {
24102645 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24112646 {
....@@ -2415,7 +2650,7 @@
24152650
24162651 refreshContents();
24172652 } else
2418
- if (event.getSource() == repairParentItem)
2653
+ if (source == repairParentItem)
24192654 {
24202655 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24212656 {
....@@ -2429,7 +2664,21 @@
24292664
24302665 refreshContents();
24312666 } else
2432
- if (event.getSource() == sortbysizeItem)
2667
+ if (source == repairShadowItem)
2668
+ {
2669
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
2670
+ {
2671
+ Object3D obj = (Object3D)e.nextElement();
2672
+ obj.RepairShadow();
2673
+// for (int i=0; i<obj.size(); i++)
2674
+// {
2675
+// obj.get(i).parent = obj;
2676
+// }
2677
+ }
2678
+
2679
+ refreshContents();
2680
+ } else
2681
+ if (source == sortbysizeItem)
24332682 {
24342683 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24352684 {
....@@ -2441,7 +2690,7 @@
24412690 ResetModel();
24422691 refreshContents();
24432692 } else
2444
- if (event.getSource() == sortbynameItem)
2693
+ if (source == sortbynameItem)
24452694 {
24462695 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24472696 {
....@@ -2453,7 +2702,7 @@
24532702 ResetModel();
24542703 refreshContents();
24552704 } else
2456
- if (event.getSource() == attachPigmentItem)
2705
+ if (source == attachPigmentItem)
24572706 {
24582707 String texture = GetFile("Attach pigment");
24592708 Object3D obj;
....@@ -2465,7 +2714,7 @@
24652714
24662715 refreshContents();
24672716 } else
2468
- if (event.getSource() == detachPigmentItem)
2717
+ if (source == detachPigmentItem)
24692718 {
24702719 Object3D obj;
24712720 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +2725,7 @@
24762725
24772726 refreshContents();
24782727 } else
2479
- if (event.getSource() == attachBumpItem)
2728
+ if (source == attachBumpItem)
24802729 {
24812730 String texture = GetFile("Attach bump");
24822731 Object3D obj;
....@@ -2488,7 +2737,7 @@
24882737
24892738 refreshContents();
24902739 } else
2491
- if (event.getSource() == detachBumpItem)
2740
+ if (source == detachBumpItem)
24922741 {
24932742 Object3D obj;
24942743 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +2748,7 @@
24992748
25002749 refreshContents();
25012750 } else
2502
- if (event.getSource() == pigmentBumpItem)
2751
+ if (source == pigmentBumpItem)
25032752 {
25042753 Object3D obj;
25052754 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +2759,195 @@
25102759
25112760 refreshContents();
25122761 } else
2513
- if (event.getSource() == flashSelectionButton)
2762
+ if (source == flashSelectionButton)
25142763 {
25152764 CameraPane.flash = true;
25162765 refreshContents();
25172766 } else
2518
- if (event.getSource() == oneButton)
2767
+ if (source == oneButton)
25192768 {
25202769 } else
2521
- if (event.getSource() == twoButton)
2770
+ if (source == twoButton)
25222771 {
25232772 radio.layout = twoButton;
25242773 // bug
25252774 //gridPanel.setDividerLocation(1.0);
25262775 //bigPanel.setDividerLocation(0.0);
2527
- bigThree.remove(jtp);
2528
- bigThree.remove(cameraPanel);
2529
- bigThree.remove(XYZPanel);
2530
- aWindowConstraints.gridx = 0;
2531
- aWindowConstraints.gridy = 0;
2532
- aWindowConstraints.gridwidth = 1;
2533
- // aConstraints.gridheight = 3;
2534
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2535
- aWindowConstraints.weightx = 0;
2536
- aWindowConstraints.weighty = 1;
2537
- //bigThree.add(jtp, aWindowConstraints);
2538
- aWindowConstraints.weightx = 1;
2539
- aWindowConstraints.gridwidth = 3;
2540
- // aConstraints.gridheight = 3;
2541
- aWindowConstraints.gridx = 1;
2542
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2543
- bigThree.add(cameraPanel, aWindowConstraints);
2544
- aWindowConstraints.weightx = 0;
2545
- aWindowConstraints.gridx = 4;
2546
- aWindowConstraints.gridwidth = 1;
2547
- // aConstraints.gridheight = 3;
2548
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2549
- //bigThree.add(XYZPanel, aWindowConstraints);
2550
- bigThree.revalidate();
2776
+// bigThree.remove(scenePanel);
2777
+// bigThree.remove(centralPanel);
2778
+// bigThree.remove(XYZPanel);
2779
+// aWindowConstraints.gridx = 0;
2780
+// aWindowConstraints.gridy = 0;
2781
+// aWindowConstraints.gridwidth = 1;
2782
+// // aConstraints.gridheight = 3;
2783
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2784
+// aWindowConstraints.weightx = 0;
2785
+// aWindowConstraints.weighty = 1;
2786
+// //bigThree.add(jtp, aWindowConstraints);
2787
+// aWindowConstraints.weightx = 1;
2788
+// aWindowConstraints.gridwidth = 3;
2789
+// // aConstraints.gridheight = 3;
2790
+// aWindowConstraints.gridx = 1;
2791
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2792
+// bigThree.add(centralPanel, aWindowConstraints);
2793
+// aWindowConstraints.weightx = 0;
2794
+// aWindowConstraints.gridx = 4;
2795
+// aWindowConstraints.gridwidth = 1;
2796
+// // aConstraints.gridheight = 3;
2797
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2798
+// //bigThree.add(XYZPanel, aWindowConstraints);
2799
+// scenePanel.setVisible(false);
2800
+// centralPanel.setVisible(true);
2801
+// XYZPanel.setVisible(false);
2802
+ bigThree.ClearUI();
2803
+ bigThree.add(centralPanel);
2804
+ bigThree.FlushUI();
25512805 } else
2552
- if (event.getSource() == threeButton)
2806
+ if (source == threeButton)
25532807 {
25542808 radio.layout = threeButton;
2555
- bigThree.remove(jtp);
2556
- bigThree.remove(cameraPanel);
2557
- bigThree.remove(XYZPanel);
2558
- aWindowConstraints.gridx = 0;
2559
- aWindowConstraints.gridy = 0;
2560
- aWindowConstraints.gridwidth = 1;
2561
- // aConstraints.gridheight = 3;
2562
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2563
- aWindowConstraints.weightx = 0;
2564
- aWindowConstraints.weighty = 1;
2565
- //bigThree.add(jtp, aWindowConstraints);
2566
- aWindowConstraints.weightx = 1;
2567
- aWindowConstraints.gridwidth = 3;
2568
- // aConstraints.gridheight = 3;
2569
- aWindowConstraints.gridx = 1;
2570
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2571
- bigThree.add(cameraPanel, aWindowConstraints);
2572
- aWindowConstraints.weightx = 0;
2573
- aWindowConstraints.gridx = 4;
2574
- aWindowConstraints.gridwidth = 1;
2575
- // aConstraints.gridheight = 3;
2576
- aConstraints.fill = GridBagConstraints.VERTICAL;
2577
- bigThree.add(XYZPanel, aWindowConstraints);
2578
- bigThree.revalidate();
2809
+
2810
+// bigThree.remove(scenePanel);
2811
+// bigThree.remove(centralPanel);
2812
+// bigThree.remove(XYZPanel);
2813
+// aWindowConstraints.gridx = 0;
2814
+// aWindowConstraints.gridy = 0;
2815
+// aWindowConstraints.gridwidth = 1;
2816
+// // aConstraints.gridheight = 3;
2817
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2818
+// aWindowConstraints.weightx = 0;
2819
+// aWindowConstraints.weighty = 1;
2820
+// //bigThree.add(jtp, aWindowConstraints);
2821
+// aWindowConstraints.weightx = 1;
2822
+// aWindowConstraints.gridwidth = 3;
2823
+// // aConstraints.gridheight = 3;
2824
+// aWindowConstraints.gridx = 1;
2825
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2826
+// bigThree.add(centralPanel, aWindowConstraints);
2827
+// aWindowConstraints.weightx = 0;
2828
+// aWindowConstraints.gridx = 4;
2829
+// aWindowConstraints.gridwidth = 1;
2830
+// // aConstraints.gridheight = 3;
2831
+// aConstraints.fill = GridBagConstraints.VERTICAL;
2832
+// bigThree.add(XYZPanel, aWindowConstraints);
2833
+// bigThree.validate();
2834
+// scenePanel.setVisible(false);
2835
+// centralPanel.setVisible(true);
2836
+// XYZPanel.setVisible(true);
2837
+ bigThree.ClearUI();
2838
+ bigThree.add(centralPanel);
2839
+ bigThree.add(XYZPanel);
2840
+ bigThree.FlushUI();
25792841 } else
2580
- if (event.getSource() == fourButton)
2842
+ if (source == fourButton)
25812843 {
25822844 radio.layout = fourButton;
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
- // aWindowConstraints.gridheight = 3;
2590
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2591
- aWindowConstraints.weightx = 1;
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
- // aWindowConstraints.gridheight = 3;
2604
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2605
- //bigThree.add(XYZPanel, aWindowConstraints);
2606
- bigThree.revalidate();
2845
+
2846
+// bigThree.remove(scenePanel);
2847
+// bigThree.remove(centralPanel);
2848
+// bigThree.remove(XYZPanel);
2849
+// aWindowConstraints.gridx = 0;
2850
+// aWindowConstraints.gridy = 0;
2851
+// aWindowConstraints.gridwidth = 1;
2852
+// // aWindowConstraints.gridheight = 3;
2853
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2854
+// aWindowConstraints.weightx = 1;
2855
+// aWindowConstraints.weighty = 1;
2856
+// bigThree.add(scenePanel, aWindowConstraints);
2857
+// aWindowConstraints.weightx = 1;
2858
+// aWindowConstraints.gridwidth = 3;
2859
+// // aConstraints.gridheight = 3;
2860
+// aWindowConstraints.gridx = 1;
2861
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2862
+// //bigThree.add(cameraPanel, aWindowConstraints);
2863
+// aWindowConstraints.weightx = 0;
2864
+// aWindowConstraints.gridx = 4;
2865
+// aWindowConstraints.gridwidth = 1;
2866
+// // aWindowConstraints.gridheight = 3;
2867
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2868
+// //bigThree.add(XYZPanel, aWindowConstraints);
2869
+// bigThree.validate();
2870
+// scenePanel.setVisible(true);
2871
+// centralPanel.setVisible(false);
2872
+// XYZPanel.setVisible(false);
2873
+ bigThree.ClearUI();
2874
+ bigThree.add(scenePanel);
2875
+ bigThree.FlushUI();
26072876 } else
2608
- if (event.getSource() == sixButton)
2877
+ if (source == sixButton)
26092878 {
26102879 radio.layout = sixButton;
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
- // aWindowConstraints.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
- // aWindowConstraints.gridheight = 3;
2632
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2633
- //bigThree.add(XYZPanel, aConstraints);
2634
- bigThree.revalidate();
2880
+
2881
+// bigThree.remove(scenePanel);
2882
+// bigThree.remove(centralPanel);
2883
+// bigThree.remove(XYZPanel);
2884
+// aWindowConstraints.gridx = 0;
2885
+// aWindowConstraints.gridy = 0;
2886
+// aWindowConstraints.gridwidth = 1;
2887
+// // aConstraints.gridheight = 3;
2888
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2889
+// aWindowConstraints.weightx = 0;
2890
+// aWindowConstraints.weighty = 1;
2891
+// bigThree.add(scenePanel, aWindowConstraints);
2892
+// aWindowConstraints.weightx = 1;
2893
+// aWindowConstraints.gridwidth = 3;
2894
+// // aWindowConstraints.gridheight = 3;
2895
+// aWindowConstraints.gridx = 1;
2896
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2897
+// bigThree.add(centralPanel, aWindowConstraints);
2898
+// aWindowConstraints.weightx = 0;
2899
+// aWindowConstraints.gridx = 4;
2900
+// aWindowConstraints.gridwidth = 1;
2901
+// // aWindowConstraints.gridheight = 3;
2902
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2903
+// //bigThree.add(XYZPanel, aConstraints);
2904
+// bigThree.validate();
2905
+// scenePanel.setVisible(true);
2906
+// centralPanel.setVisible(true);
2907
+// XYZPanel.setVisible(false);
2908
+ bigThree.ClearUI();
2909
+ bigThree.add(scenePanel);
2910
+ bigThree.add(centralPanel);
2911
+ bigThree.FlushUI();
26352912 } else
2636
- if (event.getSource() == sevenButton)
2913
+ if (source == sevenButton)
26372914 {
26382915 radio.layout = sevenButton;
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.VERTICAL;
2647
- aWindowConstraints.weightx = 0;
2648
- aWindowConstraints.weighty = 1;
2649
- bigThree.add(jtp, aWindowConstraints);
2650
- aWindowConstraints.weightx = 1;
2651
- aWindowConstraints.gridwidth = 3;
2652
- // aWindowConstraints.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
- // aConstraints.gridheight = 3;
2660
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2661
- bigThree.add(XYZPanel, aWindowConstraints);
2662
- bigThree.revalidate();
2916
+
2917
+// bigThree.remove(scenePanel);
2918
+// bigThree.remove(centralPanel);
2919
+// bigThree.remove(XYZPanel);
2920
+// aWindowConstraints.gridx = 0;
2921
+// aWindowConstraints.gridy = 0;
2922
+// aWindowConstraints.gridwidth = 1;
2923
+// // aWindowConstraints.gridheight = 3;
2924
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2925
+// aWindowConstraints.weightx = 0;
2926
+// aWindowConstraints.weighty = 1;
2927
+// bigThree.add(scenePanel, aWindowConstraints);
2928
+// aWindowConstraints.weightx = 1;
2929
+// aWindowConstraints.gridwidth = 3;
2930
+// // aWindowConstraints.gridheight = 3;
2931
+// aWindowConstraints.gridx = 1;
2932
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2933
+// bigThree.add(centralPanel, aWindowConstraints);
2934
+// aWindowConstraints.weightx = 0;
2935
+// aWindowConstraints.gridx = 4;
2936
+// aWindowConstraints.gridwidth = 1;
2937
+// // aConstraints.gridheight = 3;
2938
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2939
+// bigThree.add(XYZPanel, aWindowConstraints);
2940
+// bigThree.validate();
2941
+// scenePanel.setVisible(true);
2942
+// centralPanel.setVisible(true);
2943
+// XYZPanel.setVisible(true);
2944
+ bigThree.ClearUI();
2945
+ bigThree.add(scenePanel);
2946
+ bigThree.add(centralPanel);
2947
+ bigThree.add(XYZPanel);
2948
+ bigThree.FlushUI();
26632949 } else
2664
- if (event.getSource() == rootButton)
2950
+ if (source == rootButton)
26652951 {
26662952 Object3D obj;
26672953 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2673,7 +2959,7 @@
26732959
26742960 refreshContents(true);
26752961 } else
2676
- if (event.getSource() == closeButton)
2962
+ if (source == closeButton)
26772963 {
26782964 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26792965 cRadio ab;
....@@ -2694,11 +2980,11 @@
26942980 }
26952981 refreshContents(true);
26962982 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
2983
+ if (source == editItem || source == editButton)
26982984 {
26992985 EditSelection(false);
27002986 } else
2701
- if (event.getSource() == uneditButton)
2987
+ if (source == uneditButton)
27022988 {
27032989 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27042990 {
....@@ -2710,12 +2996,12 @@
27102996
27112997 child.editWindow = null; // ???????????
27122998 }
2713
- objEditor.ctrlPanel.revalidate();
2999
+ objEditor.ctrlPanel.FlushUI();
27143000 //objEditor.jTree.clearSelection();
27153001 //objEditor.ResetSliders();
27163002 refreshContents(true);
27173003 } else
2718
- if (event.getSource() == clearPanelButton)
3004
+ if (source == clearPanelButton)
27193005 {
27203006 assert(copy == group);
27213007 //copy.ClearUI();
....@@ -2726,7 +3012,7 @@
27263012 listUI.clear();
27273013 refreshContents(true);
27283014 } else
2729
- if (event.getSource() == allParamsButton)
3015
+ if (source == allParamsButton)
27303016 {
27313017 assert(copy == group);
27323018
....@@ -2747,19 +3033,19 @@
27473033
27483034 refreshContents(true);
27493035 } else
2750
- if (event.getSource() == unselectButton)
3036
+ if (source == unselectButton)
27513037 {
27523038 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3039
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543040 objEditor.ResetSliders();
27553041 refreshContents(true);
27563042 } else
2757
- if(event.getSource() instanceof cRadio)
3043
+ if(source instanceof cRadio)
27583044 {
27593045 group.parent = keepparent;
27603046 group.attributes = 0;
27613047 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3048
+ /*cRadio*/ radio = (cRadio)source;
27633049 Object3D obj = radio.GetObject();
27643050 System.out.println("Edit " + obj);
27653051 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +3065,7 @@
27793065 }
27803066
27813067 copy = group;
2782
- //CameraPane.theRenderer.object = group;
3068
+ //Globals.theRenderer.object = group;
27833069 if(!useclient)
27843070 {
27853071 cameraView.renderCamera = radio.camera;
....@@ -2788,12 +3074,15 @@
27883074 cameraView.cameras[cameraView.cameracount] = radio.camera;
27893075 cameraView.targetLookAt.set(radio.camera.lookAt);
27903076 cameraView.object = group;
2791
- cameraView.lighttouched = true;
3077
+ //cameraView.lighttouched = true;
3078
+ Globals.lighttouched = true;
27923079 topView.object = group;
27933080 frontView.object = group;
27943081 sideView.object = group;
27953082 }
2796
- group.editWindow = this;
3083
+
3084
+// fix "+" issue group.editWindow = this;
3085
+
27973086 /*
27983087 currentLayout = radio.layout;
27993088 if (currentLayout == null)
....@@ -2824,7 +3113,7 @@
28243113 if (useclient)
28253114 {
28263115 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3116
+ Globals.lighttouched = true;
28283117 //topView.object = client;
28293118 //frontView.object = client;
28303119 //sideView.object = client;
....@@ -2832,7 +3121,7 @@
28323121 else
28333122 {
28343123 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3124
+ Globals.lighttouched = true;
28363125 //topView.object = group;
28373126 //frontView.object = group;
28383127 //sideView.object = group;
....@@ -2867,6 +3156,28 @@
28673156 refreshContents();
28683157 }
28693158
3159
+ void TransformChildren()
3160
+ {
3161
+ Object3D obj;
3162
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3163
+ {
3164
+ obj = (Object3D)e.nextElement();
3165
+ obj.KeepTextureMatrices();
3166
+ obj.TransformChildren();
3167
+ obj.RestoreTextureMatrices();
3168
+
3169
+// if (obj.parent == null)
3170
+// {
3171
+// System.out.println("NULL PARENT!");
3172
+// new Exception().printStackTrace();
3173
+// }
3174
+// else
3175
+// TouchTransform(obj);
3176
+// //obj.parent.Touch();
3177
+ }
3178
+
3179
+ refreshContents();
3180
+ }
28703181
28713182 void ResetTransform()
28723183 {
....@@ -2979,7 +3290,7 @@
29793290 refreshContents();
29803291 }
29813292
2982
- void ResetCentroid()
3293
+ void ResetCentroid(boolean full)
29833294 {
29843295 Object3D obj;
29853296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +3305,16 @@
29943305 LA.matIdentity(Object3D.mat);
29953306 obj.getBounds(minima, maxima, false);
29963307 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3308
+ if (full)
3309
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29983310 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29993311 obj.TransformMesh(Object3D.mat);
3312
+
30003313 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3314
+ if (full)
3315
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30023316 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3317
+
30033318 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30043319 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30053320 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3065,9 +3380,9 @@
30653380 obj = (Object3D)e.nextElement();
30663381
30673382 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3383
+ Grafreed.AnalyzeObject(obj);
30693384 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3385
+ Grafreed.AnalyzeObject(obj.bRep);
30713386
30723387 // System.err.println((size/1024) + " KB is the size of " + obj);
30733388 }
....@@ -3109,6 +3424,13 @@
31093424 void GenNormals(boolean crease)
31103425 {
31113426 group.GenNormalsS(crease);
3427
+
3428
+ refreshContents();
3429
+ }
3430
+
3431
+ void GenNormalsMINE()
3432
+ {
3433
+ group.selection.GenNormalsMINE();
31123434
31133435 refreshContents();
31143436 }
....@@ -3157,104 +3479,259 @@
31573479
31583480 //Object3D buffer;
31593481 cVector temp = new cVector();
3160
- BoundaryRep temprep;
3161
- Object3D nodes;
3162
- Vector<Vertex> vertices;
3163
-
3164
- public void Vertex(Object3D node, Vertex v)
3165
- {
3166
- vertices.add(v);
3167
- nodes.addElement(node);
3168
-
3169
- if (temprep.GetCache(v) != null)
3170
- {
3171
- temprep.Remove(v);
3172
- }
3173
- else
3174
- {
3175
- temprep.Remember(v);
3176
- }
3177
- }
3178
-
3179
- public void Face(Object3D node, Face f)
3180
- {
3181
-
3182
- }
3183
-
3482
+// BoundaryRep temprep;
3483
+// Object3D nodes;
3484
+// Vector<Vertex> vertices;
3485
+//
3486
+// cGroup buffer;
3487
+//
3488
+// public void Vertex(Object3D node, Vertex v)
3489
+// {
3490
+//// vertices.add(v);
3491
+//// nodes.addElement(node);
3492
+////
3493
+//// if (temprep.GetCache(v) != null)
3494
+//// {
3495
+//// temprep.Remove(v);
3496
+//// } else
3497
+//// {
3498
+//// temprep.Remember(v);
3499
+//// }
3500
+//
3501
+// //Object3D node = nodes.get(index);
3502
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
3503
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3504
+//
3505
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3506
+//
3507
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3508
+//
3509
+// cGroup g = new cGroup();
3510
+//
3511
+// if (g.toParent == null)
3512
+// {
3513
+// g.toParent = LA.newMatrix();
3514
+// g.fromParent = LA.newMatrix();
3515
+// }
3516
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3517
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3518
+//
3519
+// g.add(GrafreeD.clipboard);
3520
+//
3521
+// buffer.add(g);
3522
+// }
3523
+//
3524
+// public void Face(Object3D node, Face f)
3525
+// {
3526
+//
3527
+// }
3528
+//
3529
+// void ParseVerticesOld() // ??
3530
+// {
3531
+// //if (group.selection.size() != 1)
3532
+// // return;
3533
+//
3534
+// temprep = new BoundaryRep();
3535
+// nodes = new Object3D();
3536
+// vertices = new Vector<Vertex>();
3537
+//
3538
+// boolean epsequal = GrafreeD.epsequal;
3539
+// GrafreeD.epsequal = true;
3540
+//
3541
+// for (int i=0; i<group.selection.size(); i++)
3542
+// {
3543
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3544
+//
3545
+// group.selection.get(i).Parse(
3546
+//this );
3547
+//
3548
+// int repsize = temprep.VertexCount();
3549
+// int tablesize = temprep.vertextable.size();
3550
+// int nodesize = nodes.size();
3551
+//
3552
+// assert(vertices.size() == nodes.size());
3553
+//
3554
+// temprep.vertextable.elements();
3555
+//
3556
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
3557
+//
3558
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3559
+// {
3560
+// cGroup g = new cGroup();
3561
+//
3562
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3563
+//
3564
+// Object3D node = nodes.get(index);
3565
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
3566
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3567
+//
3568
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3569
+//
3570
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3571
+//
3572
+// if (g.toParent == null)
3573
+// {
3574
+// g.toParent = LA.newMatrix();
3575
+// g.fromParent = LA.newMatrix();
3576
+// }
3577
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3578
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3579
+//
3580
+// g.add(GrafreeD.clipboard);
3581
+//
3582
+// buffer.add(g);
3583
+// }
3584
+//
3585
+// makeSomething(buffer, i==group.selection.size()-1);
3586
+// }
3587
+//
3588
+// GrafreeD.epsequal = epsequal;
3589
+//
3590
+// //buffer = null;
3591
+// temprep = null;
3592
+// nodes = null;
3593
+//
3594
+// refreshContents();
3595
+// }
3596
+
31843597 void ParseVertices()
31853598 {
3186
- //if (group.selection.size() != 1)
3187
- // return;
3188
-
3189
- temprep = new BoundaryRep();
3190
- nodes = new Object3D();
3191
- vertices = new Vector<Vertex>();
3192
-
3193
- boolean epsequal = GraphreeD.epsequal;
3194
- GraphreeD.epsequal = true;
3599
+ boolean epsequal = Grafreed.epsequal;
3600
+ Grafreed.epsequal = true;
31953601
31963602 for (int i=0; i<group.selection.size(); i++)
31973603 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3604
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31993605
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
3606
+ group.selection.get(i).Parse(
3607
+
3608
+ new iParse()
3609
+ {
3610
+ public void Vertex(Object3D node, Vertex v)
3611
+ {
3612
+ temp.set(v);
3613
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32053614
3206
- assert(vertices.size() == nodes.size());
3207
-
3208
- temprep.vertextable.elements();
3209
-
3210
- java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
3615
+ cGroup g = new cGroup();
32113616
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
3617
+ if (g.toParent == null)
3618
+ {
3619
+ g.toParent = LA.newMatrix();
3620
+ g.fromParent = LA.newMatrix();
3621
+ }
3622
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3623
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32153624
3216
- int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3217
- Object3D node = nodes.get(index);
3218
- temp.set(vertices.get(index)); // temprep.GetVertex(k));
3219
- // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3625
+ g.add(Grafreed.clipboard);
32203626
3221
- LA.xformPos(temp, node.GlobalTransformInv(), temp);
3222
-
3223
- // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3224
-
3225
- if (g.toParent == null)
3226
- {
3227
- g.toParent = LA.newMatrix();
3228
- g.fromParent = LA.newMatrix();
3229
- }
3230
- LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3231
- LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3627
+ buffer.add(g);
3628
+ }
32323629
3233
- g.add(GraphreeD.clipboard);
3630
+ public void Face(Object3D node, Face f)
3631
+ {
32343632
3235
- buffer.add(g);
3236
- }
3633
+ }
3634
+ }
3635
+ );
32373636
32383637 makeSomething(buffer, i==group.selection.size()-1);
32393638 }
32403639
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
3640
+ Grafreed.epsequal = epsequal;
32463641
32473642 refreshContents();
32483643 }
3249
-
3644
+
3645
+ void TextureVertices()
3646
+ {
3647
+ for (int i=0; i<group.selection.size(); i++)
3648
+ {
3649
+ group.selection.get(i).Parse(
3650
+ new iParse()
3651
+ {
3652
+ public void Vertex(Object3D node, Vertex v)
3653
+ {
3654
+ cTexture tex = node.GetTextures();
3655
+ String pigment = Object3D.GetPigment(tex);
3656
+ //String bump = Object3D.GetBump(tex);
3657
+
3658
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3659
+
3660
+ try
3661
+ {
3662
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3663
+ }
3664
+ catch (Exception e)
3665
+ {
3666
+ System.err.println("FAIL: " + node);
3667
+ }
3668
+
3669
+ double s = v.s;
3670
+
3671
+ if (s == 1)
3672
+ s = 0;
3673
+
3674
+ double t = v.t;
3675
+
3676
+ if (t == 1)
3677
+ t = 0;
3678
+
3679
+ int indexs = (int) (texturedata.getWidth() * s);
3680
+ int indext = (int) (texturedata.getHeight() * t);
3681
+
3682
+ int index = indext * texturedata.getWidth() + indexs;
3683
+
3684
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
3685
+
3686
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
3687
+
3688
+ float scale = bytebuf.get(index*slide) & 0xFF;
3689
+ scale += bytebuf.get(index*slide+1) & 0xFF;
3690
+ scale += bytebuf.get(index*slide+2) & 0xFF;
3691
+ scale /= 3;
3692
+
3693
+ scale /= 0xFF;
3694
+ // c'est quoi ca? scale /= 4;
3695
+
3696
+ //v.AO = scale;
3697
+
3698
+ v.x += v.norm.x * scale;
3699
+ v.y += v.norm.y * scale;
3700
+ v.z += v.norm.z * scale;
3701
+ }
3702
+
3703
+ public void Face(Object3D node, Face f)
3704
+ {
3705
+ }
3706
+ }
3707
+ );
3708
+ }
3709
+
3710
+ refreshContents();
3711
+ }
3712
+
32503713 void Align()
32513714 {
3715
+ if (group.selection.size() == 0)
3716
+ return;
3717
+
3718
+ cVector bbmin = new cVector();
3719
+ cVector bbmax = new cVector();
3720
+
3721
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
3722
+
3723
+ double dx = bbmax.x - bbmin.x;
3724
+ double dy = bbmax.y - bbmin.y;
3725
+ double dz = bbmax.z - bbmin.z;
3726
+
3727
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
3728
+
32523729 for (int i=0; i<group.selection.size(); i++)
32533730 {
32543731 Object3D obj = group.selection.get(i);
32553732
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
3733
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
3734
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32583735 }
32593736
32603737 refreshContents();
....@@ -3267,7 +3744,7 @@
32673744 // ref.SaveSupports();
32683745 // Object3D par = ref.parent;
32693746 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
3747
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32713748 // ref.parent = par;
32723749 // ref.RestoreSupports();
32733750
....@@ -3275,11 +3752,11 @@
32753752
32763753 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32773754
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
3755
+ boolean random = CameraPane.SWITCH;
3756
+ CameraPane.SWITCH = false; // parse all random nodes
32803757 lowres.linkVerticesThis(null);
32813758 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
3759
+ CameraPane.SWITCH = random;
32833760
32843761 System.err.flush();
32853762
....@@ -3297,7 +3774,7 @@
32973774 // lowres.SaveSupports();
32983775 // par = lowres.parent;
32993776 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
3777
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33013778 Object3D newlow = CloneObject(lowres, false);
33023779 newlow.name = sn.switchobject.get(i).name;
33033780 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +3796,7 @@
33193796 return;
33203797
33213798 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
3799
+ Object3D ref = Grafreed.clipboard.get(0);
33233800
33243801 Object3D newgroup = new Object3D("Po:" + poses.name);
33253802
....@@ -3488,7 +3965,7 @@
34883965 group.selection.RelinkToSupport(); // july 2014
34893966 System.out.println("DONE.");
34903967 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
3968
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34923969 }
34933970
34943971 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +3990,20 @@
35133990
35143991 void ClipMesh()
35153992 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3993
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35173994 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
3995
+ Object3D content = Grafreed.clipboard.get(0);
35193996
35203997 if (content instanceof cGroup && ((cGroup)content).transientlink )
35213998 content = ((cGroup)content).get(0);
35223999
35234000 // for (int i=0; i<group.selection.size(); i++)
35244001 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4002
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264003 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4004
+ group.selection.ClipMesh(Grafreed.clipboard);
35284005 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4006
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304007 System.out.println("DONE.");
35314008 refreshContents();
35324009 }
....@@ -3659,7 +4136,7 @@
36594136 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36604137
36614138 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
4139
+ if(elem != group || !newWindow)
36634140 {
36644141 // if (!(elem instanceof Composite))
36654142 // newWindow = false;
....@@ -3764,25 +4241,25 @@
37644241 System.err.println("info : " + child.GetPath());
37654242 }
37664243 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
4244
+// else
4245
+// {
4246
+// objEditor.SetMaterial(group); // .GetMaterial());
4247
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4248
+// System.err.println("info : " + group.GetPath());
4249
+// }
37734250
37744251 objEditor.SetText(); // jan 2014
37754252
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4253
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
37774254 CameraPane.flash = true;
37784255
37794256 if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
37804257 // a camera
37814258 {
37824259 CameraPane.camerachangeframe = 0; // don't refuse it
3783
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3784
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3785
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
4260
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4261
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4262
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864263 }
37874264
37884265 refreshContents();
....@@ -3864,12 +4341,12 @@
38644341 {
38654342 if (group.selection.isEmpty())
38664343 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4344
+ Grafreed.clipboardIsTempGroup = false;
38684345 Composite tGroup = null;
38694346 if (group.selection.size() > 0) // 1)
38704347 {
38714348 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4349
+ Grafreed.clipboardIsTempGroup = true;
38734350 }
38744351
38754352 if (cut)
....@@ -3909,16 +4386,16 @@
39094386 //System.out.println("cut " + child);
39104387 //System.out.println("parent = " + child.parent);
39114388 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4389
+ if (Grafreed.clipboardIsTempGroup)
39134390 tGroup.add/*Child*/(tmp);
39144391 else
3915
- GraphreeD.clipboard = tmp;
4392
+ Grafreed.clipboard = tmp;
39164393 }
39174394 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4395
+ if (Grafreed.clipboardIsTempGroup)
39194396 tGroup.add/*Child*/(child);
39204397 else
3921
- GraphreeD.clipboard = child;
4398
+ Grafreed.clipboard = child;
39224399 }
39234400
39244401 //ResetModel();
....@@ -3950,21 +4427,21 @@
39504427 //System.out.println("cut " + elem);
39514428 //System.out.println("parent = " + elem.parent);
39524429 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4430
+ if (Grafreed.clipboardIsTempGroup)
39544431 tGroup.add/*Child*/(tmp);
39554432 else
3956
- GraphreeD.clipboard = tmp;
4433
+ Grafreed.clipboard = tmp;
39574434 }
39584435 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4436
+ if (Grafreed.clipboardIsTempGroup)
39604437 tGroup.add/*Child*/(child);
39614438 else
3962
- GraphreeD.clipboard = child;
4439
+ Grafreed.clipboard = child;
39634440 }
39644441
39654442 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4443
+ if (Grafreed.clipboardIsTempGroup)
4444
+ Grafreed.clipboard = tGroup;
39684445 if (cut)
39694446 {
39704447 ResetModel();
....@@ -3974,11 +4451,11 @@
39744451
39754452 void paste(boolean expand)
39764453 {
3977
- // if (GraphreeD.clipboard == null)
4454
+ // if (GrafreeD.clipboard == null)
39784455 // return;
39794456 boolean first = true;
39804457
3981
- if (GraphreeD.clipboardIsTempGroup)
4458
+ if (Grafreed.clipboardIsTempGroup)
39824459 {
39834460 Composite temp;
39844461
....@@ -3989,7 +4466,7 @@
39894466 temp = (Composite)Applet3D.clipboard.deepCopy();
39904467 */
39914468 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4469
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39934470 {
39944471 Object3D child = (Object3D)e.nextElement();
39954472
....@@ -4003,7 +4480,7 @@
40034480 else
40044481 elem = child.deepCopy(); // ?
40054482 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4483
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40074484 // elem = elem.get(0);
40084485 makeSomething(elem, true); // ?? first);
40094486 //group.addChild(elem);
....@@ -4023,23 +4500,23 @@
40234500 //Object3D cb = Applet3D.clipboard;
40244501 //temp.addChild(cb);
40254502 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4026
- assert(GraphreeD.clipboard.parent == null);
4027
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
4028
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
4029
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
4030
- makeSomething(expand?GraphreeD.clipboard.get(0).copyExpand():GraphreeD.clipboard.get(0).deepCopy());
4503
+ assert(Grafreed.clipboard.parent == null);
4504
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4505
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4506
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4507
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40314508 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
4509
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4510
+ Grafreed.clipboard.get(0).parent = keepparent;
40344511 }
40354512
40364513 ResetModel();
40374514 refreshContents();
40384515 }
40394516
4040
- void pasteInto(boolean copyit)
4517
+ void pasteInto(boolean copyit, boolean clone)
40414518 {
4042
-// if (GraphreeD.clipboard == null)
4519
+// if (GrafreeD.clipboard == null)
40434520 // return;
40444521
40454522 if (group.selection.size() != 1)
....@@ -4066,15 +4543,22 @@
40664543 if (copyit)
40674544 {
40684545 // paste(false);
4069
- CloneClipboard(false); // sept 2014
4546
+ if (clone)
4547
+ {
4548
+ CloneClipboard(false); // sept 2014
4549
+ }
4550
+ else
4551
+ {
4552
+ paste(false);
4553
+ }
40704554 }
40714555 else
40724556 {
40734557 boolean first = true;
40744558
4075
- if (GraphreeD.clipboardIsTempGroup)
4559
+ if (Grafreed.clipboardIsTempGroup)
40764560 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
4561
+ Composite temp = (Composite)Grafreed.clipboard;
40784562 Object3D copy;
40794563 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40804564 {
....@@ -4084,7 +4568,7 @@
40844568 }
40854569 } else
40864570 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
4571
+ linkSomething(Grafreed.clipboard); //.get(0));
40884572 }
40894573 }
40904574 }
....@@ -4276,6 +4760,26 @@
42764760 makeSomething(csg);
42774761 }
42784762
4763
+ void Ungroup(Object3D g)
4764
+ {
4765
+ if (g instanceof HiddenObject)
4766
+ {
4767
+ HiddenObject h = (HiddenObject) g;
4768
+
4769
+ for (int i=0; i<h.ActualSize(); i++)
4770
+ {
4771
+ objEditor.makeSomething(h.get(i), false);
4772
+ }
4773
+ }
4774
+ else
4775
+ {
4776
+ for (int i=0; i<g.Size(); i++)
4777
+ {
4778
+ objEditor.makeSomething(g.get(i), false);
4779
+ }
4780
+ }
4781
+ }
4782
+
42794783 void ungroup()
42804784 {
42814785 /*
....@@ -4471,7 +4975,7 @@
44714975
44724976 void ImportGFD()
44734977 {
4474
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4978
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
44754979 browser.show();
44764980 String filename = browser.getFile();
44774981 if (filename != null && filename.length() > 0)
....@@ -4509,7 +5013,7 @@
45095013
45105014 void ImportVRMLX3D()
45115015 {
4512
- if (GraphreeD.standAlone)
5016
+ if (Grafreed.standAlone)
45135017 {
45145018 /**/
45155019 FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
....@@ -4526,7 +5030,7 @@
45265030
45275031 String GetFile(String dialogName)
45285032 {
4529
- if (GraphreeD.standAlone)
5033
+ if (Grafreed.standAlone)
45305034 {
45315035 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45325036 browser.show();
....@@ -4590,10 +5094,12 @@
45905094 cButton flashSelectionButton;
45915095 cButton editButton;
45925096 cButton uneditButton;
5097
+ JCheckBox allParamsButton;
45935098 cButton clearpanelButton;
4594
- cButton allParamsButton;
45955099 cButton unselectButton;
45965100
5101
+ cButton oneStepButton;
5102
+
45975103 cButton screenfitButton;
45985104 cButton screenfitpointButton;
45995105 cButton snapobjectButton;
....@@ -4635,8 +5141,9 @@
46355141 private MenuItem resetsupportItem;
46365142 private MenuItem resetreferencesItem;
46375143 private MenuItem linkverticesItem;
5144
+ private MenuItem relinkverticesItem;
46385145 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
5146
+ private MenuItem resetAllItem;
46405147 private MenuItem stepAllItem;
46415148 private MenuItem revertMeshItem;
46425149 private MenuItem poseMeshItem;
....@@ -4647,14 +5154,17 @@
46475154 private MenuItem mergeGeometriesItem;
46485155 private MenuItem copyItem;
46495156 private MenuItem pasteItem;
5157
+ private MenuItem pasteIntoItem;
46505158 private MenuItem pasteLinkItem;
46515159 private MenuItem pasteCloneItem;
46525160 private MenuItem pasteExpandItem;
46535161 private MenuItem clearItem;
46545162 private MenuItem clearAllItem;
46555163 private MenuItem genUVItem;
5164
+ private MenuItem genNormalsMESHItem;
46565165 private MenuItem genNormalsCADItem;
46575166 private MenuItem genNormalsORGANItem;
5167
+ private MenuItem genNormalsMINEItem;
46585168 private MenuItem stripifyItem;
46595169 private MenuItem unstripifyItem;
46605170 private MenuItem trimItem;
....@@ -4694,8 +5204,11 @@
46945204 private MenuItem panoTexturesItem;
46955205
46965206 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
5207
+ private MenuItem resetCentroidXZItem;
46985208 private MenuItem resetTransformItem;
5209
+ private MenuItem transformGeometryItem;
5210
+ private MenuItem transformChildrenItem;
5211
+ private MenuItem hideItem;
46995212 private MenuItem grabItem;
47005213 private MenuItem backItem;
47015214 private MenuItem frontItem;
....@@ -4716,6 +5229,7 @@
47165229
47175230 private MenuItem resetParentItem;
47185231 private MenuItem repairParentItem;
5232
+ private MenuItem repairShadowItem;
47195233 private MenuItem sortbysizeItem;
47205234 private MenuItem sortbynameItem;
47215235
....@@ -4728,16 +5242,19 @@
47285242 private MenuItem particleItem;
47295243 private MenuItem ragdollItem;
47305244 private MenuItem ragdoll2Item;
5245
+ private MenuItem heightFieldItem;
5246
+ private MenuItem textureFieldItem;
47315247 private MenuItem gridItem;
47325248 private MenuItem rectoidItem;
47335249 private MenuItem ellipsoidItem;
47345250 private MenuItem coneItem;
47355251 private MenuItem torusItem;
47365252 private MenuItem superItem;
5253
+ private MenuItem kleinItem;
47375254 private MenuItem blobItem;
47385255 private MenuItem latheItem;
47395256 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
5257
+ private MenuItem overlayItem;
47415258 private MenuItem meshItem;
47425259 // private MenuItem meshGroupItem;
47435260 private MenuItem springItem;
....@@ -4746,6 +5263,7 @@
47465263 private MenuItem csgItem;
47475264 private MenuItem templateItem;
47485265 private MenuItem textureItem;
5266
+ private MenuItem billboardItem;
47495267 private MenuItem shadowXItem;
47505268 private MenuItem shadowYItem;
47515269 private MenuItem shadowZItem;