Normand Briere
2019-06-09 cd87df088b1850ba0c90beb6c866c443e4eaf3b9
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,17 +645,89 @@
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 }
631732 void SetupViews(ObjEditor oe)
632733 {
....@@ -646,6 +747,7 @@
646747 JCheckBox fastCB;
647748 JCheckBox slowCB;
648749 JCheckBox boxCB;
750
+ JCheckBox zoomBoxCB;
649751 JCheckBox trackCB;
650752 JCheckBox smoothfocusCB;
651753 // JCheckBox speakerMocapCB;
....@@ -688,8 +790,7 @@
688790 dropAttributes |= Object3D.TEXTURE;
689791 else
690792 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
793
+ } else if(e.getSource() == liveCB)
693794 {
694795 cameraView.ToggleLive();
695796 }
....@@ -726,6 +827,10 @@
726827 Recompile();
727828 cameraView.repaint();
728829 // refreshContents();
830
+ }
831
+ else if(e.getSource() == zoomBoxCB)
832
+ {
833
+ cameraView.ToggleZoomBoxMode();
729834 }
730835 else if(e.getSource() == smoothfocusCB)
731836 {
....@@ -840,7 +945,9 @@
840945 // objEditor.DropFile((java.io.File[]) object, true);
841946 // return;
842947 // }
843
- if (string.charAt(0) == '/')
948
+
949
+ // File path for Mac and Windows
950
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
844951 {
845952 // file(s)
846953 String[] names = string.split("\n");
....@@ -867,7 +974,7 @@
867974
868975 flashIt = false;
869976 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
977
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
871978 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
872979
873980 if (group.selection.size() == 1)
....@@ -894,11 +1001,11 @@
8941001 {
8951002 loadClipboard(true);
8961003 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
1004
+ pasteInto(false, false);
8981005 } else {
8991006 loadClipboard(false);
9001007 objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
1008
+ pasteInto(false, false); // true); // ???
9021009 }
9031010 }
9041011 public void dropActionChanged(DropTargetDragEvent dtde)
....@@ -1002,6 +1109,8 @@
10021109
10031110 void buildCreateMenu(Menu menu)
10041111 {
1112
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1113
+ //heightFieldItem.addActionListener(this);
10051114 gridItem = menu.add(new MenuItem("Grid"));
10061115 gridItem.addActionListener(this);
10071116 rectoidItem = menu.add(new MenuItem("Box"));
....@@ -1014,29 +1123,37 @@
10141123 torusItem.addActionListener(this);
10151124 superItem = menu.add(new MenuItem("Superellipsoid"));
10161125 superItem.addActionListener(this);
1126
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1127
+ kleinItem.addActionListener(this);
10171128 particleItem = menu.add(new MenuItem("Particle system"));
10181129 particleItem.addActionListener(this);
1130
+ if (Globals.ADVANCED)
1131
+ {
10191132 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201133 ragdollItem.addActionListener(this);
10211134 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221135 ragdoll2Item.addActionListener(this);
1136
+ }
10231137 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1138
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251139 meshItem.addActionListener(this);
10261140 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271141 // meshGroupItem.addActionListener(this);
1142
+ if (Globals.ADVANCED)
1143
+ {
10281144 springItem = menu.add(new MenuItem("Spring"));
10291145 springItem.addActionListener(this);
10301146 flagItem = menu.add(new MenuItem("Flag"));
10311147 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);
10361148 blobItem = menu.add(new MenuItem("Blob"));
10371149 blobItem.addActionListener(this);
10381150 latheItem = menu.add(new MenuItem("Lathe"));
10391151 latheItem.addActionListener(this);
1152
+ }
1153
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1154
+ bezierItem.addActionListener(this);
1155
+ overlayItem = menu.add(new MenuItem("Overlay"));
1156
+ overlayItem.addActionListener(this);
10401157 lightItem = menu.add(new MenuItem("Light"));
10411158 lightItem.addActionListener(this);
10421159 menu.add("-");
....@@ -1046,41 +1163,39 @@
10461163 loopItem.addActionListener(this);
10471164 doubleItem = menu.add(new MenuItem("Fork"));
10481165 doubleItem.addActionListener(this);
1166
+ if (Globals.ADVANCED)
1167
+ {
10491168 tripleItem = menu.add(new MenuItem("Trident"));
10501169 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);
1170
+ }
10601171 }
10611172
10621173 void buildToolsMenu(Menu menu)
10631174 {
10641175 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651176 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1177
+ animationItem.setState(Globals.ANIMATION);
10671178
10681179 menu.add("-");
10691180 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701181 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1182
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1183
+ textureFieldItem.addActionListener(this);
1184
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721185 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751186 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761187 reduceMorphItem.addActionListener(this);
10771188 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781189 reduce34MorphItem.addActionListener(this);
1079
-
1190
+ menu.add("-");
10801191 menu.add(computeAOItem = new MenuItem("Compute AO"));
10811192 computeAOItem.addActionListener(this);
1082
- menu.add("-");
10831193
1194
+ if (Globals.ADVANCED)
1195
+ {
1196
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1197
+ mirrorItem.addActionListener(this);
1198
+ menu.add("-");
10841199 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851200 memoryItem.addActionListener(this);
10861201 menu.add(analyzeItem = new MenuItem("Analyze"));
....@@ -1094,6 +1209,8 @@
10941209 resetParentItem.addActionListener(this);
10951210 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961211 repairParentItem.addActionListener(this);
1212
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1213
+ repairShadowItem.addActionListener(this);
10971214 menu.add(invariantsItem = new MenuItem("Invariants"));
10981215 invariantsItem.addActionListener(this);
10991216 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1218,7 @@
11011218 menu.add("-");
11021219 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031220 editScriptItem.addActionListener(this);
1221
+ }
11041222 }
11051223
11061224 void ScreenFit()
....@@ -1429,9 +1547,9 @@
14291547
14301548 void Overwrite(int mask)
14311549 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1550
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14331551 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1552
+ Object3D content = Grafreed.clipboard.get(0);
14351553
14361554 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371555 content = ((cGroup)content).get(0);
....@@ -1454,6 +1572,7 @@
14541572 //
14551573 public void actionPerformed(ActionEvent event) // , Object arg)
14561574 {
1575
+ Object source = event.getSource();
14571576 /*
14581577 if (event.getSource() == nameField)
14591578 {
....@@ -1465,11 +1584,11 @@
14651584 }
14661585 else
14671586 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1587
+ if (source == lookAtItem || source == lookFromItem)
14691588 {
14701589 ScreenFit();
14711590 } else
1472
- if (event.getSource() == switchItem)
1591
+ if (source == switchItem)
14731592 {
14741593 cVector v1 = new cVector();
14751594 cVector v2 = new cVector();
....@@ -1478,11 +1597,11 @@
14781597 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791598 objEditor.cameraView.repaint();
14801599 } else
1481
- if (event.getSource() == rectoidItem)
1600
+ if (source == rectoidItem)
14821601 {
14831602 makeSomething(new Box());
14841603 } else
1485
- if (event.getSource() == particleItem)
1604
+ if (source == particleItem)
14861605 {
14871606 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881607 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1622,9 @@
15031622 applyExample(particleGeom, "SMOKE");
15041623 makeSomething(particleGeom);
15051624 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1625
+ if (source == ragdollItem || source == ragdoll2Item)
15071626 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1627
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091628
15101629 ragdoll.toParent = LA.newMatrix();
15111630 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +1640,71 @@
15211640 makeSomething(ragdoll);
15221641 //makeSomething(new VehicleDemo());
15231642 } else
1524
- if (event.getSource() == gridItem)
1643
+ /*
1644
+ */
1645
+ if (source == heightFieldItem)
1646
+ {
1647
+ Object3D obj = new Object3D();
1648
+
1649
+ obj.CreateMaterial();
1650
+ obj.bRep = new BoundaryRep();
1651
+
1652
+ obj.bRep.CreateMesh(new iHeightField()
1653
+ {
1654
+ public double f(double x, double y)
1655
+ {
1656
+ // The Mandelbrot set is represented by coloring
1657
+ // each point (x,y) according to the number of
1658
+ // iterations it takes before the while loop in
1659
+ // this method ends. For points that are actually
1660
+ // in the Mandelbrot set, or very close to it, the
1661
+ // count will reach the maximum value, 80. These
1662
+ // points will be colored purple. All other colors
1663
+ // represent points that are definitely NOT in the set.
1664
+ x -= 600;
1665
+ y -= 500;
1666
+ x /= 200;
1667
+ y /= 200;
1668
+ int count = 0;
1669
+ double zx = x;
1670
+ double zy = y;
1671
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
1672
+ double new_zx = zx*zx - zy*zy + x;
1673
+ zy = 2*zx*zy + y;
1674
+ zx = new_zx;
1675
+ count++;
1676
+ }
1677
+ return count; // Math.sqrt(count);
1678
+ }
1679
+ }, 1000,1000);
1680
+
1681
+ makeSomething(obj);
1682
+ } else
1683
+ if (source == gridItem)
15251684 {
15261685 makeSomething(new Grid());
15271686 } else
1528
- if (event.getSource() == ellipsoidItem)
1687
+ if (source == ellipsoidItem)
15291688 {
15301689 makeSomething(new Sphere());
15311690 } else
1532
- if (event.getSource() == coneItem)
1691
+ if (source == coneItem)
15331692 {
15341693 makeSomething(new Cone());
15351694 } else
1536
- if (event.getSource() == torusItem)
1695
+ if (source == torusItem)
15371696 {
15381697 makeSomething(new Torus());
15391698 } else
1540
- if (event.getSource() == superItem)
1699
+ if (source == superItem)
15411700 {
15421701 makeSomething(new Superellipsoid());
15431702 } else
1544
- if (event.getSource() == blobItem)
1703
+ if (source == kleinItem)
1704
+ {
1705
+ makeSomething(new Klein());
1706
+ } else
1707
+ if (source == blobItem)
15451708 {
15461709 Blob blob = new Blob();
15471710 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +1712,15 @@
15491712 //blob.retile();
15501713 makeSomething(blob);
15511714 } else
1552
- if (event.getSource() == latheItem)
1715
+ if (source == latheItem)
15531716 {
15541717 makeSomething(new Lathe());
15551718 } else
1556
- if (event.getSource() == bezierItem)
1719
+ if (source == bezierItem)
15571720 {
15581721 makeSomething(new BezierSurface());
15591722 } else
1560
- if (event.getSource() == checkerItem)
1723
+ if (source == overlayItem)
15611724 {
15621725 /*
15631726 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +1733,9 @@
15701733 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15711734 LA.matInvert(obj.toParent, obj.fromParent);
15721735 */
1573
- makeSomething(new CheckerIG());
1736
+ makeSomething(new Checker());
15741737 } else
1575
- if (event.getSource() == meshItem)
1738
+ if (source == meshItem)
15761739 {
15771740 Object3D itemtomake = new Object3D();
15781741 Object3D child;
....@@ -1593,35 +1756,35 @@
15931756 makeSomething(child);
15941757 }
15951758 } else
1596
- if (event.getSource() == springItem)
1759
+ if (source == springItem)
15971760 {
15981761 cSpring s = new cSpring();
15991762 s.setup();
16001763 makeSomething(s);
16011764 } else
1602
- if (event.getSource() == flagItem)
1765
+ if (source == flagItem)
16031766 {
16041767 cSpring s = new cFlag();
16051768 s.setup();
16061769 makeSomething(s);
16071770 } else
1608
- if (event.getSource() == lightItem)
1771
+ if (source == lightItem)
16091772 {
16101773 makeSomething(new Light());
16111774 } else
1612
- if (event.getSource() == csgItem)
1775
+ if (source == csgItem)
16131776 {
16141777 group(new CSG());
16151778 } else
1616
- if (event.getSource() == templateItem)
1779
+ if (source == templateItem)
16171780 {
16181781 group(new cTemplate());
16191782 } else
1620
- if (event.getSource() == attributeItem)
1783
+ if (source == attributeItem)
16211784 {
16221785 makeSomething(new Attribute());
16231786 } else
1624
- if (event.getSource() == pointflowItem)
1787
+ if (source == pointflowItem)
16251788 {
16261789 makeSomething(new PointFlow());
16271790 } else
....@@ -1633,7 +1796,7 @@
16331796 } else
16341797 */
16351798
1636
- if (event.getSource() == superLoopItem)
1799
+ if (source == superLoopItem)
16371800 {
16381801 Composite g = new cGroup();
16391802 for (int i=0; i<15; i++)
....@@ -1655,7 +1818,7 @@
16551818
16561819 group(g);
16571820 } else
1658
- if (event.getSource() == loopItem)
1821
+ if (source == loopItem)
16591822 {
16601823 Composite csg = new GroupLeaf();
16611824 csg.count = 5;
....@@ -1664,7 +1827,7 @@
16641827 csg.addChild(child);
16651828 child.addChild(csg);
16661829 } else
1667
- if (event.getSource() == doubleItem)
1830
+ if (source == doubleItem)
16681831 {
16691832 Composite csg = new GroupLeaf();
16701833 csg.count = 5;
....@@ -1676,7 +1839,7 @@
16761839 csg.addChild(child);
16771840 child.addChild(csg);
16781841 } else
1679
- if (event.getSource() == tripleItem)
1842
+ if (source == tripleItem)
16801843 {
16811844 Composite csg = new GroupLeaf();
16821845 csg.count = 4;
....@@ -1692,70 +1855,83 @@
16921855 child.addChild(csg);
16931856 } else
16941857
1695
- if (event.getSource() == importGFDItem)
1858
+ if (source == importGFDItem)
16961859 {
16971860 ImportGFD();
16981861 } else
1699
- if (event.getSource() == importVRMLX3DItem)
1862
+ if (source == importVRMLX3DItem)
17001863 {
17011864 ImportVRMLX3D();
17021865 } else
1703
- if (event.getSource() == import3DSItem)
1866
+ if (source == import3DSItem)
17041867 {
17051868 objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
17061869 } else
1707
- if (event.getSource() == importOBJItem)
1870
+ if (source == importOBJItem)
17081871 {
1709
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1872
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1873
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1874
+ browser.setVisible(true);
1875
+ String filename = browser.getFile();
1876
+ if (filename != null && filename.length() > 0)
1877
+ {
1878
+ String fullname = browser.getDirectory() + filename;
1879
+ makeSomething(ReadOBJ(fullname), true);
1880
+ }
17101881 } else
1711
- if (event.getSource() == computeAOItem)
1882
+ if (source == computeAOItem)
17121883 {
1713
- CameraPane.drawMode = CameraPane.OCCLUSION;
1714
- CameraPane.theRenderer.repaint();
1884
+ Globals.drawMode = CameraPane.OCCLUSION;
1885
+ Globals.theRenderer.repaint();
17151886 } else
1716
- if (event.getSource() == recompileItem)
1887
+ if (source == recompileItem)
17171888 {
17181889 Recompile();
17191890 refreshContents();
17201891 } else
1721
- if (event.getSource() == editScriptItem)
1892
+ if (source == editScriptItem)
17221893 {
17231894 OpenDialog();
17241895 refreshContents();
17251896 } else
1726
- if (event.getSource() == invariantsItem)
1897
+ if (source == invariantsItem)
17271898 {
17281899 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
1900
+ Grafreed.grafreeD.universe.invariants();
17301901 } else
1731
- if (event.getSource() == memoryItem)
1902
+ if (source == memoryItem)
17321903 {
17331904 //System.out.println("Invariants:");
17341905 PrintMemory();
17351906 } else
1736
- if (event.getSource() == pathItem)
1907
+ if (source == pathItem)
17371908 {
17381909 PrintPath();
17391910 } else
1740
- if (event.getSource() == analyzeItem)
1911
+ if (source == analyzeItem)
17411912 {
17421913 AnalyzeObject();
17431914 } else
1744
- if (event.getSource() == dumpItem)
1915
+ if (source == dumpItem)
17451916 {
17461917 DumpObject();
17471918 } else
1748
- if (event.getSource() == screenfitButton)
1919
+ if (source == oneStepButton)
1920
+ {
1921
+ Globals.ONESTEP = true;
1922
+ cameraView.repaint();
1923
+ } else
1924
+ if (source == screenfitButton)
17491925 {
17501926 //Reload(lastConverter, lastFilename, true);
17511927 ScreenFit();
17521928 } else
1753
- if (event.getSource() == screenfitpointButton)
1929
+ if (source == screenfitpointButton)
17541930 {
17551931 //Reload(lastConverter, lastFilename, true);
17561932 ScreenFitPoint();
17571933 } else
1758
- if (event.getSource() == snapobjectButton)
1934
+ if (source == snapobjectButton)
17591935 {
17601936 //Reload(lastConverter, lastFilename, true);
17611937 SnapObject();
....@@ -1766,13 +1942,13 @@
17661942 // Recompile();
17671943 // refreshContents();
17681944 // } else
1769
- if (event.getSource() == gcButton)
1945
+ if (source == gcButton)
17701946 {
17711947 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17721948 System.gc();
17731949 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17741950 } else
1775
- if (event.getSource() == editLeafItem)
1951
+ if (source == editLeafItem)
17761952 {
17771953 Object3D obj;
17781954 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +1962,70 @@
17861962 }
17871963 refreshContents(true);
17881964 } else
1789
- if (event.getSource() == openWindowItem)
1965
+ if (source == openWindowItem)
17901966 {
17911967 EditSelection(true);
17921968 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
1969
+ if (source == cutItem || source == clearButton)
17941970 {
17951971 loadClipboard(true);
17961972 } else
1797
- if (event.getSource() == duplicateItem)
1973
+ if (source == duplicateItem)
17981974 {
1799
- Object3D keep = GraphreeD.clipboard;
1975
+ Object3D keep = Grafreed.clipboard;
18001976 loadClipboard(false);
18011977 paste(false);
1802
- GraphreeD.clipboard = keep;
1978
+ Grafreed.clipboard = keep;
18031979 } else
1804
- if (event.getSource() == cloneItem)
1980
+ if (source == cloneItem)
18051981 {
18061982 CloneSelection(false);
18071983 } else
1808
- if (event.getSource() == cloneSupportItem)
1984
+ if (source == cloneSupportItem)
18091985 {
18101986 CloneSelection(true);
18111987 } else
1812
- if (event.getSource() == copyItem)
1988
+ if (source == copyItem)
18131989 {
18141990 loadClipboard(false);
18151991 } else
1816
- if (event.getSource() == pasteItem)
1992
+ if (source == pasteItem)
18171993 {
18181994 paste(false);
18191995 } else
1820
- if (event.getSource() == pasteLinkItem)
1996
+ if (source == pasteIntoItem)
18211997 {
1822
- pasteInto(false);
1998
+ pasteInto(true, false);
18231999 } else
1824
- if (event.getSource() == pasteCloneItem)
2000
+ if (source == pasteLinkItem)
18252001 {
1826
- pasteInto(true);
2002
+ pasteInto(false, false);
18272003 } else
1828
- if (event.getSource() == pasteExpandItem)
2004
+ if (source == pasteCloneItem)
2005
+ {
2006
+ pasteInto(true, true);
2007
+ } else
2008
+ if (source == pasteExpandItem)
18292009 {
18302010 paste(true);
18312011 } else
1832
- if (event.getSource() == synchronizeItem)
2012
+ if (source == synchronizeItem)
18332013 {
18342014 Overwrite(Object3D.TRANSFORM);
18352015 } else
1836
- if (event.getSource() == overwriteNameItem)
2016
+ if (source == overwriteNameItem)
18372017 {
18382018 Overwrite(Object3D.NAME);
18392019 } else
1840
- if (event.getSource() == overwriteUVItem)
2020
+ if (source == overwriteUVItem)
18412021 {
18422022 Overwrite(Object3D.UV);
18432023 } else
1844
- if (event.getSource() == overwriteMatItem)
2024
+ if (source == overwriteMatItem)
18452025 {
2026
+ /* july 2015
18462027 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2028
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482029 else
18492030 {
18502031 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2037,16 @@
18562037 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572038 }
18582039 }
2040
+ */
2041
+
2042
+ Overwrite(dropAttributes);
18592043 }
1860
- if (event.getSource() == overwriteGeoItem)
2044
+ if (source == overwriteGeoItem)
18612045 {
18622046 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2047
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642048 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2049
+// Object3D content = GrafreeD.clipboard.get(0);
18662050 //
18672051 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682052 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2058,7 @@
18742058 // refreshContents();
18752059 // }
18762060 } else
1877
- if (event.getSource() == generateMeshItem)
2061
+ if (source == generateMeshItem)
18782062 {
18792063 //if (group.selection.size() == 1)
18802064 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2069,7 @@
18852069 ResetModel();
18862070 refreshContents();
18872071 } else
1888
- if (event.getSource() == extractGeometriesItem)
2072
+ if (source == extractGeometriesItem)
18892073 {
18902074 boolean one = false;
18912075
....@@ -1912,7 +2096,7 @@
19122096 ResetModel();
19132097 refreshContents();
19142098 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2099
+ if (source == cloneGeometriesItem)
19162100 {
19172101 boolean one = false;
19182102
....@@ -1938,32 +2122,37 @@
19382122 ResetModel();
19392123 refreshContents();
19402124 } else
1941
- if (event.getSource() == shareGeometriesItem)
2125
+ if (source == shareGeometriesItem)
19422126 {
19432127 boolean one = false;
19442128
19452129 if (group.selection.size() == 1)
19462130 one = true;
19472131
2132
+ Object3D merge = null;
2133
+
19482134 Object3D content = new cGroup();
19492135
19502136 for (int i=0; i<group.selection.size(); i++)
19512137 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2138
+ merge = new Merge(group.selection.get(i));
19532139
19542140 if (one)
1955
- makeSomething(sel, false);
2141
+ makeSomething(merge, false);
19562142 else
1957
- content.addChild(sel);
2143
+ content.addChild(merge);
19582144 }
19592145
19602146 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2147
+ makeSomething(content, true);
2148
+ else
2149
+ {
2150
+ ResetModel();
2151
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2152
+ refreshContents();
2153
+ }
19652154 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2155
+ if (source == mergeGeometriesItem)
19672156 {
19682157 boolean one = false;
19692158
....@@ -1993,11 +2182,11 @@
19932182 ResetModel();
19942183 refreshContents();
19952184 } else
1996
- if (event.getSource() == linkverticesItem)
2185
+ if (source == linkverticesItem)
19972186 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2187
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992188 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2189
+// Object3D content = GrafreeD.clipboard.get(0);
20012190 //
20022191 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032192 // content = ((cGroup)content).get(0);
....@@ -2006,39 +2195,48 @@
20062195 // group.selection.get(0).setMasterThis(content); // should be identity
20072196 // refreshContents();
20082197 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2198
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20102199 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2200
+ Object3D content = Grafreed.clipboard.get(0);
20122201
20132202 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142203 content = ((cGroup)content).get(0);
20152204
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2205
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172206 for (int i=0; i<group.selection.size(); i++)
20182207 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
2208
+ boolean random = CameraPane.SWITCH;
2209
+ CameraPane.SWITCH = false; // parse all random nodes
20212210 group.selection.get(i).linkVerticesThis(content);
20222211 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
2212
+ CameraPane.SWITCH = random;
20242213 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2214
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262215 refreshContents();
20272216 }
20282217 } else
2029
- if (event.getSource() == resetsupportItem)
2218
+ if (source == resetsupportItem)
20302219 {
20312220 for (int i=0; i<group.selection.size(); i++)
20322221 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
2222
+ boolean random = CameraPane.SWITCH;
2223
+ CameraPane.SWITCH = false; // parse all random nodes
20352224 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
2225
+ CameraPane.SWITCH = random;
20372226 }
20382227
20392228 refreshContents();
20402229 } else
2041
- if (event.getSource() == resetreferencesItem)
2230
+ if (source == relinkverticesItem)
2231
+ {
2232
+ boolean random = CameraPane.SWITCH;
2233
+ CameraPane.SWITCH = false; // parse all random nodes
2234
+ group.selection.RelinkToSupport();
2235
+ CameraPane.SWITCH = random;
2236
+
2237
+ refreshContents();
2238
+ } else
2239
+ if (source == resetreferencesItem)
20422240 {
20432241 for (int i=0; i<group.selection.size(); i++)
20442242 {
....@@ -2047,11 +2245,11 @@
20472245
20482246 refreshContents();
20492247 } else
2050
- if (event.getSource() == setMasterItem)
2248
+ if (source == setMasterItem)
20512249 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2250
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20532251 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2252
+ Object3D content = Grafreed.clipboard.get(0);
20552253
20562254 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572255 content = ((cGroup)content).get(0);
....@@ -2060,13 +2258,13 @@
20602258 refreshContents();
20612259 }
20622260 } else
2063
- if (event.getSource() == poseMeshItem)
2261
+ if (source == poseMeshItem)
20642262 {
20652263 if (group.selection.size() == 1)
20662264 {
2067
- if (GraphreeD.clipboard.size() == 1)
2265
+ if (Grafreed.clipboard.size() == 1)
20682266 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2267
+ Object3D content = Grafreed.clipboard.get(0);
20702268
20712269 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722270 content = ((cGroup)content).get(0);
....@@ -2079,19 +2277,19 @@
20792277 }
20802278
20812279 } else
2082
- if (event.getSource() == revertMeshItem)
2280
+ if (source == revertMeshItem)
20832281 {
20842282 RevertMeshes();
20852283 } else
2086
- if (event.getSource() == resetMeshItem)
2284
+ if (source == resetAllItem)
20872285 {
20882286 ResetAll();
20892287 } else
2090
- if (event.getSource() == stepAllItem)
2288
+ if (source == stepAllItem)
20912289 {
20922290 StepAll();
20932291 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2292
+ if (source == clearItem) // || event.getSource() == clearButton)
20952293 {
20962294 //int indices[] = jList.getSelectedIndices();
20972295 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2297,46 @@
20992297
21002298 ClearSelection(false);
21012299 } else
2102
- if (event.getSource() == clearAllItem)
2300
+ if (source == clearAllItem)
21032301 {
21042302 ClearSelection(true);
21052303 } else
2106
- if (event.getSource() == grabItem)
2304
+ if (source == grabItem)
21072305 {
21082306 group(new cGroup(), true);
21092307 } else
2110
- if (event.getSource() == frontItem)
2308
+ if (source == hideItem)
2309
+ {
2310
+ group(new HiddenObject());
2311
+ } else
2312
+ if (source == frontItem)
21112313 {
21122314 front();
21132315 } else
2114
- if (event.getSource() == backItem)
2316
+ if (source == backItem)
21152317 {
21162318 back();
21172319 } else
2118
- if (event.getSource() == cameraItem)
2320
+ if (source == cameraItem)
21192321 {
21202322 makeSomething(new Camera());
21212323 } else
2122
- if (event.getSource() == compositeItem)
2324
+ if (source == compositeItem)
21232325 {
21242326 group(new Composite());
21252327 } else
2126
- if (event.getSource() == randomItem)
2328
+ if (source == randomItem)
21272329 {
21282330 RandomNode random = new RandomNode();
21292331 group(random);
21302332 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
2333
+ random.name = random.get(0).name + "Switch";
21322334 } else
2133
- if (event.getSource() == physicsItem)
2335
+ if (source == physicsItem)
21342336 {
21352337 group(new PhysicsNode());
21362338 } else
2137
- if (event.getSource() == frameselectorItem)
2339
+ if (source == frameselectorItem)
21382340 {
21392341 for (int i=0; i<group.selection.size(); i++)
21402342 {
....@@ -2146,7 +2348,7 @@
21462348 ResetModel();
21472349 refreshContents();
21482350 } else
2149
- if (event.getSource() == switchGeoItem)
2351
+ if (source == switchGeoItem)
21502352 {
21512353 for (int i=0; i<group.selection.size(); i++)
21522354 {
....@@ -2158,7 +2360,7 @@
21582360 ResetModel();
21592361 refreshContents();
21602362 } else
2161
- if (event.getSource() == switchTransfoItem)
2363
+ if (source == switchTransfoItem)
21622364 {
21632365 for (int i=0; i<group.selection.size(); i++)
21642366 {
....@@ -2170,7 +2372,7 @@
21702372 ResetModel();
21712373 refreshContents();
21722374 } else
2173
- if (event.getSource() == morphItem)
2375
+ if (source == morphItem)
21742376 {
21752377 for (int i=0; i<group.selection.size(); i++)
21762378 {
....@@ -2182,7 +2384,7 @@
21822384 ResetModel();
21832385 refreshContents();
21842386 } else
2185
- if (event.getSource() == scriptNodeItem)
2387
+ if (source == scriptNodeItem)
21862388 {
21872389 boolean atleastone = false;
21882390
....@@ -2221,191 +2423,223 @@
22212423 }
22222424 }
22232425 } else
2224
- if (event.getSource() == linkerItem)
2426
+ if (source == linkerItem)
22252427 {
22262428 group(new cLinker());
22272429 } else
2228
- if (event.getSource() == textureItem)
2430
+ if (source == textureItem)
22292431 {
22302432 group(new TextureNode());
22312433 } else
2232
- if (event.getSource() == shadowXItem)
2434
+ if (source == billboardItem)
2435
+ {
2436
+ group(new BillboardNode());
2437
+ } else
2438
+ if (source == shadowXItem)
22332439 {
22342440 CastShadow(0);
22352441 } else
2236
- if (event.getSource() == shadowYItem)
2442
+ if (source == shadowYItem)
22372443 {
22382444 CastShadow(1);
22392445 } else
2240
- if (event.getSource() == shadowZItem)
2446
+ if (source == shadowZItem)
22412447 {
22422448 CastShadow(2);
22432449 } else
2244
- if (event.getSource() == ungroupItem)
2450
+ if (source == ungroupItem)
22452451 {
2246
- ungroup();
2452
+ //ungroup();
2453
+ for (int i=0; i<group.selection.size(); i++)
2454
+ {
2455
+ Ungroup(group.selection.get(i));
2456
+ }
2457
+
2458
+ ClearSelection(false);
2459
+
2460
+ refreshContents();
22472461 } else
2248
- if (event.getSource() == genUVItem)
2462
+ if (source == genUVItem)
22492463 {
22502464 GenUV();
22512465 } else
2252
- if (event.getSource() == genNormalsCADItem)
2466
+ if (source == genNormalsCADItem)
22532467 {
22542468 GenNormals(true);
22552469 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2470
+ if (source == genNormalsMESHItem)
2471
+ {
2472
+ GenNormals(true); // TODO
2473
+ } else
2474
+ if (source == genNormalsORGANItem)
22572475 {
22582476 GenNormals(false);
22592477 } else
2260
- if (event.getSource() == stripifyItem)
2478
+ if (source == genNormalsMINEItem)
2479
+ {
2480
+ GenNormalsMINE();
2481
+ } else
2482
+ if (source == stripifyItem)
22612483 {
22622484 Stripify();
22632485 } else
2264
- if (event.getSource() == unstripifyItem)
2486
+ if (source == unstripifyItem)
22652487 {
22662488 Unstripify();
22672489 } else
2268
- if (event.getSource() == trimItem)
2490
+ if (source == trimItem)
22692491 {
22702492 Trim();
22712493 } else
2272
- if (event.getSource() == untrimItem)
2494
+ if (source == untrimItem)
22732495 {
22742496 Untrim();
22752497 } else
2276
- if (event.getSource() == clearColorsItem)
2498
+ if (source == clearColorsItem)
22772499 {
22782500 ClearColors();
22792501 } else
2280
- if (event.getSource() == clearMaterialsItem)
2502
+ if (source == clearMaterialsItem)
22812503 {
22822504 ClearMaterials();
22832505 } else
2284
- if (event.getSource() == liveleavesItem)
2506
+ if (source == liveleavesItem)
22852507 {
22862508 LiveLeaves(true);
22872509 } else
2288
- if (event.getSource() == unliveleavesItem)
2510
+ if (source == unliveleavesItem)
22892511 {
22902512 LiveLeaves(false);
22912513 } else
2292
- if (event.getSource() == supportleavesItem)
2514
+ if (source == supportleavesItem)
22932515 {
22942516 SupportLeaves(true);
22952517 } else
2296
- if (event.getSource() == unsupportleavesItem)
2518
+ if (source == unsupportleavesItem)
22972519 {
22982520 SupportLeaves(false);
22992521 } else
2300
- if (event.getSource() == hideleavesItem)
2522
+ if (source == hideleavesItem)
23012523 {
23022524 HideLeaves(true);
23032525 } else
2304
- if (event.getSource() == showleavesItem)
2526
+ if (source == showleavesItem)
23052527 {
23062528 HideLeaves(false);
23072529 } else
2308
- if (event.getSource() == markleavesItem)
2530
+ if (source == markleavesItem)
23092531 {
23102532 MarkLeaves(true);
23112533 } else
2312
- if (event.getSource() == unmarkleavesItem)
2534
+ if (source == unmarkleavesItem)
23132535 {
23142536 MarkLeaves(false);
23152537 } else
2316
- if (event.getSource() == flipVItem)
2538
+ if (source == flipVItem)
23172539 {
23182540 FlipV(true);
23192541 } else
2320
- if (event.getSource() == unflipVItem)
2542
+ if (source == unflipVItem)
23212543 {
23222544 FlipV(false);
23232545 } else
2324
- if (event.getSource() == lowTexturesItem)
2546
+ if (source == lowTexturesItem)
23252547 {
23262548 SetTexRes(0);
23272549 } else
2328
- if (event.getSource() == normalTexturesItem)
2550
+ if (source == normalTexturesItem)
23292551 {
23302552 SetTexRes(1);
23312553 } else
2332
- if (event.getSource() == highTexturesItem)
2554
+ if (source == highTexturesItem)
23332555 {
23342556 SetTexRes(2);
23352557 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2558
+ if (source == veryhighTexturesItem)
23372559 {
23382560 SetTexRes(3);
23392561 } else
2340
- if (event.getSource() == maxTexturesItem)
2562
+ if (source == maxTexturesItem)
23412563 {
23422564 SetTexRes(4);
23432565 } else
2344
- if (event.getSource() == panoTexturesItem)
2566
+ if (source == panoTexturesItem)
23452567 {
23462568 SetTexRes(5);
23472569 } else
2348
- if (event.getSource() == reverseNormalsItem)
2570
+ if (source == reverseNormalsItem)
23492571 {
23502572 ReverseNormals();
23512573 } else
2352
- if (event.getSource() == parseverticesItem)
2574
+ if (source == parseverticesItem)
23532575 {
23542576 ParseVertices();
23552577 } else
2356
- if (event.getSource() == alignItem)
2578
+ if (source == textureFieldItem)
2579
+ {
2580
+ TextureVertices();
2581
+ } else
2582
+ if (source == alignItem)
23572583 {
23582584 Align();
23592585 } else
2360
- if (event.getSource() == mirrorItem)
2586
+ if (source == mirrorItem)
23612587 {
23622588 MirrorPoses();
23632589 } else
2364
- if (event.getSource() == reduceMorphItem)
2590
+ if (source == reduceMorphItem)
23652591 {
23662592 MeshReduction(false);
23672593 } else
2368
- if (event.getSource() == reduce34MorphItem)
2594
+ if (source == reduce34MorphItem)
23692595 {
23702596 MeshReduction(true);
23712597 } else
2372
- if (event.getSource() == reverseTrianglesItem)
2598
+ if (source == reverseTrianglesItem)
23732599 {
23742600 ReverseTriangles();
23752601 } else
2376
- if (event.getSource() == reduceMeshItem)
2602
+ if (source == reduceMeshItem)
23772603 {
23782604 ReduceMesh(false);
23792605 } else
2380
- if (event.getSource() == reduce34MeshItem)
2606
+ if (source == reduce34MeshItem)
23812607 {
23822608 ReduceMesh(true);
23832609 } else
2384
- if (event.getSource() == increaseMeshItem)
2610
+ if (source == increaseMeshItem)
23852611 {
23862612 IncreaseMesh();
23872613 } else
2388
- if (event.getSource() == clipMeshItem)
2614
+ if (source == clipMeshItem)
23892615 {
23902616 ClipMesh();
23912617 } else
2392
- if (event.getSource() == smoothMeshItem)
2618
+ if (source == smoothMeshItem)
23932619 {
23942620 SmoothMesh();
23952621 } else
2396
- if (event.getSource() == transformgeometryItem)
2622
+ if (source == transformGeometryItem)
23972623 {
23982624 TransformGeometry();
23992625 } else
2400
- if (event.getSource() == resetTransformItem)
2626
+ if (source == transformChildrenItem)
2627
+ {
2628
+ TransformChildren();
2629
+ } else
2630
+ if (source == resetTransformItem)
24012631 {
24022632 ResetTransform();
24032633 } else
2404
- if (event.getSource() == resetCentroidItem)
2634
+ if (source == resetCentroidItem)
24052635 {
2406
- ResetCentroid();
2636
+ ResetCentroid(true);
24072637 } else
2408
- if (event.getSource() == resetParentItem)
2638
+ if (source == resetCentroidXZItem)
2639
+ {
2640
+ ResetCentroid(false);
2641
+ } else
2642
+ if (source == resetParentItem)
24092643 {
24102644 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24112645 {
....@@ -2415,7 +2649,7 @@
24152649
24162650 refreshContents();
24172651 } else
2418
- if (event.getSource() == repairParentItem)
2652
+ if (source == repairParentItem)
24192653 {
24202654 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24212655 {
....@@ -2429,7 +2663,21 @@
24292663
24302664 refreshContents();
24312665 } else
2432
- if (event.getSource() == sortbysizeItem)
2666
+ if (source == repairShadowItem)
2667
+ {
2668
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
2669
+ {
2670
+ Object3D obj = (Object3D)e.nextElement();
2671
+ obj.RepairShadow();
2672
+// for (int i=0; i<obj.size(); i++)
2673
+// {
2674
+// obj.get(i).parent = obj;
2675
+// }
2676
+ }
2677
+
2678
+ refreshContents();
2679
+ } else
2680
+ if (source == sortbysizeItem)
24332681 {
24342682 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24352683 {
....@@ -2441,7 +2689,7 @@
24412689 ResetModel();
24422690 refreshContents();
24432691 } else
2444
- if (event.getSource() == sortbynameItem)
2692
+ if (source == sortbynameItem)
24452693 {
24462694 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24472695 {
....@@ -2453,7 +2701,7 @@
24532701 ResetModel();
24542702 refreshContents();
24552703 } else
2456
- if (event.getSource() == attachPigmentItem)
2704
+ if (source == attachPigmentItem)
24572705 {
24582706 String texture = GetFile("Attach pigment");
24592707 Object3D obj;
....@@ -2465,7 +2713,7 @@
24652713
24662714 refreshContents();
24672715 } else
2468
- if (event.getSource() == detachPigmentItem)
2716
+ if (source == detachPigmentItem)
24692717 {
24702718 Object3D obj;
24712719 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +2724,7 @@
24762724
24772725 refreshContents();
24782726 } else
2479
- if (event.getSource() == attachBumpItem)
2727
+ if (source == attachBumpItem)
24802728 {
24812729 String texture = GetFile("Attach bump");
24822730 Object3D obj;
....@@ -2488,7 +2736,7 @@
24882736
24892737 refreshContents();
24902738 } else
2491
- if (event.getSource() == detachBumpItem)
2739
+ if (source == detachBumpItem)
24922740 {
24932741 Object3D obj;
24942742 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +2747,7 @@
24992747
25002748 refreshContents();
25012749 } else
2502
- if (event.getSource() == pigmentBumpItem)
2750
+ if (source == pigmentBumpItem)
25032751 {
25042752 Object3D obj;
25052753 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +2758,195 @@
25102758
25112759 refreshContents();
25122760 } else
2513
- if (event.getSource() == flashSelectionButton)
2761
+ if (source == flashSelectionButton)
25142762 {
25152763 CameraPane.flash = true;
25162764 refreshContents();
25172765 } else
2518
- if (event.getSource() == oneButton)
2766
+ if (source == oneButton)
25192767 {
25202768 } else
2521
- if (event.getSource() == twoButton)
2769
+ if (source == twoButton)
25222770 {
25232771 radio.layout = twoButton;
25242772 // bug
25252773 //gridPanel.setDividerLocation(1.0);
25262774 //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();
2775
+// bigThree.remove(scenePanel);
2776
+// bigThree.remove(centralPanel);
2777
+// bigThree.remove(XYZPanel);
2778
+// aWindowConstraints.gridx = 0;
2779
+// aWindowConstraints.gridy = 0;
2780
+// aWindowConstraints.gridwidth = 1;
2781
+// // aConstraints.gridheight = 3;
2782
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2783
+// aWindowConstraints.weightx = 0;
2784
+// aWindowConstraints.weighty = 1;
2785
+// //bigThree.add(jtp, aWindowConstraints);
2786
+// aWindowConstraints.weightx = 1;
2787
+// aWindowConstraints.gridwidth = 3;
2788
+// // aConstraints.gridheight = 3;
2789
+// aWindowConstraints.gridx = 1;
2790
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2791
+// bigThree.add(centralPanel, aWindowConstraints);
2792
+// aWindowConstraints.weightx = 0;
2793
+// aWindowConstraints.gridx = 4;
2794
+// aWindowConstraints.gridwidth = 1;
2795
+// // aConstraints.gridheight = 3;
2796
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2797
+// //bigThree.add(XYZPanel, aWindowConstraints);
2798
+// scenePanel.setVisible(false);
2799
+// centralPanel.setVisible(true);
2800
+// XYZPanel.setVisible(false);
2801
+ bigThree.ClearUI();
2802
+ bigThree.add(centralPanel);
2803
+ bigThree.FlushUI();
25512804 } else
2552
- if (event.getSource() == threeButton)
2805
+ if (source == threeButton)
25532806 {
25542807 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();
2808
+
2809
+// bigThree.remove(scenePanel);
2810
+// bigThree.remove(centralPanel);
2811
+// bigThree.remove(XYZPanel);
2812
+// aWindowConstraints.gridx = 0;
2813
+// aWindowConstraints.gridy = 0;
2814
+// aWindowConstraints.gridwidth = 1;
2815
+// // aConstraints.gridheight = 3;
2816
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2817
+// aWindowConstraints.weightx = 0;
2818
+// aWindowConstraints.weighty = 1;
2819
+// //bigThree.add(jtp, aWindowConstraints);
2820
+// aWindowConstraints.weightx = 1;
2821
+// aWindowConstraints.gridwidth = 3;
2822
+// // aConstraints.gridheight = 3;
2823
+// aWindowConstraints.gridx = 1;
2824
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2825
+// bigThree.add(centralPanel, aWindowConstraints);
2826
+// aWindowConstraints.weightx = 0;
2827
+// aWindowConstraints.gridx = 4;
2828
+// aWindowConstraints.gridwidth = 1;
2829
+// // aConstraints.gridheight = 3;
2830
+// aConstraints.fill = GridBagConstraints.VERTICAL;
2831
+// bigThree.add(XYZPanel, aWindowConstraints);
2832
+// bigThree.validate();
2833
+// scenePanel.setVisible(false);
2834
+// centralPanel.setVisible(true);
2835
+// XYZPanel.setVisible(true);
2836
+ bigThree.ClearUI();
2837
+ bigThree.add(centralPanel);
2838
+ bigThree.add(XYZPanel);
2839
+ bigThree.FlushUI();
25792840 } else
2580
- if (event.getSource() == fourButton)
2841
+ if (source == fourButton)
25812842 {
25822843 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();
2844
+
2845
+// bigThree.remove(scenePanel);
2846
+// bigThree.remove(centralPanel);
2847
+// bigThree.remove(XYZPanel);
2848
+// aWindowConstraints.gridx = 0;
2849
+// aWindowConstraints.gridy = 0;
2850
+// aWindowConstraints.gridwidth = 1;
2851
+// // aWindowConstraints.gridheight = 3;
2852
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2853
+// aWindowConstraints.weightx = 1;
2854
+// aWindowConstraints.weighty = 1;
2855
+// bigThree.add(scenePanel, aWindowConstraints);
2856
+// aWindowConstraints.weightx = 1;
2857
+// aWindowConstraints.gridwidth = 3;
2858
+// // aConstraints.gridheight = 3;
2859
+// aWindowConstraints.gridx = 1;
2860
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2861
+// //bigThree.add(cameraPanel, aWindowConstraints);
2862
+// aWindowConstraints.weightx = 0;
2863
+// aWindowConstraints.gridx = 4;
2864
+// aWindowConstraints.gridwidth = 1;
2865
+// // aWindowConstraints.gridheight = 3;
2866
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2867
+// //bigThree.add(XYZPanel, aWindowConstraints);
2868
+// bigThree.validate();
2869
+// scenePanel.setVisible(true);
2870
+// centralPanel.setVisible(false);
2871
+// XYZPanel.setVisible(false);
2872
+ bigThree.ClearUI();
2873
+ bigThree.add(scenePanel);
2874
+ bigThree.FlushUI();
26072875 } else
2608
- if (event.getSource() == sixButton)
2876
+ if (source == sixButton)
26092877 {
26102878 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();
2879
+
2880
+// bigThree.remove(scenePanel);
2881
+// bigThree.remove(centralPanel);
2882
+// bigThree.remove(XYZPanel);
2883
+// aWindowConstraints.gridx = 0;
2884
+// aWindowConstraints.gridy = 0;
2885
+// aWindowConstraints.gridwidth = 1;
2886
+// // aConstraints.gridheight = 3;
2887
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2888
+// aWindowConstraints.weightx = 0;
2889
+// aWindowConstraints.weighty = 1;
2890
+// bigThree.add(scenePanel, aWindowConstraints);
2891
+// aWindowConstraints.weightx = 1;
2892
+// aWindowConstraints.gridwidth = 3;
2893
+// // aWindowConstraints.gridheight = 3;
2894
+// aWindowConstraints.gridx = 1;
2895
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2896
+// bigThree.add(centralPanel, aWindowConstraints);
2897
+// aWindowConstraints.weightx = 0;
2898
+// aWindowConstraints.gridx = 4;
2899
+// aWindowConstraints.gridwidth = 1;
2900
+// // aWindowConstraints.gridheight = 3;
2901
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2902
+// //bigThree.add(XYZPanel, aConstraints);
2903
+// bigThree.validate();
2904
+// scenePanel.setVisible(true);
2905
+// centralPanel.setVisible(true);
2906
+// XYZPanel.setVisible(false);
2907
+ bigThree.ClearUI();
2908
+ bigThree.add(scenePanel);
2909
+ bigThree.add(centralPanel);
2910
+ bigThree.FlushUI();
26352911 } else
2636
- if (event.getSource() == sevenButton)
2912
+ if (source == sevenButton)
26372913 {
26382914 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();
2915
+
2916
+// bigThree.remove(scenePanel);
2917
+// bigThree.remove(centralPanel);
2918
+// bigThree.remove(XYZPanel);
2919
+// aWindowConstraints.gridx = 0;
2920
+// aWindowConstraints.gridy = 0;
2921
+// aWindowConstraints.gridwidth = 1;
2922
+// // aWindowConstraints.gridheight = 3;
2923
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2924
+// aWindowConstraints.weightx = 0;
2925
+// aWindowConstraints.weighty = 1;
2926
+// bigThree.add(scenePanel, aWindowConstraints);
2927
+// aWindowConstraints.weightx = 1;
2928
+// aWindowConstraints.gridwidth = 3;
2929
+// // aWindowConstraints.gridheight = 3;
2930
+// aWindowConstraints.gridx = 1;
2931
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2932
+// bigThree.add(centralPanel, aWindowConstraints);
2933
+// aWindowConstraints.weightx = 0;
2934
+// aWindowConstraints.gridx = 4;
2935
+// aWindowConstraints.gridwidth = 1;
2936
+// // aConstraints.gridheight = 3;
2937
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2938
+// bigThree.add(XYZPanel, aWindowConstraints);
2939
+// bigThree.validate();
2940
+// scenePanel.setVisible(true);
2941
+// centralPanel.setVisible(true);
2942
+// XYZPanel.setVisible(true);
2943
+ bigThree.ClearUI();
2944
+ bigThree.add(scenePanel);
2945
+ bigThree.add(centralPanel);
2946
+ bigThree.add(XYZPanel);
2947
+ bigThree.FlushUI();
26632948 } else
2664
- if (event.getSource() == rootButton)
2949
+ if (source == rootButton)
26652950 {
26662951 Object3D obj;
26672952 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2673,7 +2958,7 @@
26732958
26742959 refreshContents(true);
26752960 } else
2676
- if (event.getSource() == closeButton)
2961
+ if (source == closeButton)
26772962 {
26782963 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26792964 cRadio ab;
....@@ -2694,11 +2979,11 @@
26942979 }
26952980 refreshContents(true);
26962981 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
2982
+ if (source == editItem || source == editButton)
26982983 {
26992984 EditSelection(false);
27002985 } else
2701
- if (event.getSource() == uneditButton)
2986
+ if (source == uneditButton)
27022987 {
27032988 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27042989 {
....@@ -2710,12 +2995,12 @@
27102995
27112996 child.editWindow = null; // ???????????
27122997 }
2713
- objEditor.ctrlPanel.revalidate();
2998
+ objEditor.ctrlPanel.FlushUI();
27142999 //objEditor.jTree.clearSelection();
27153000 //objEditor.ResetSliders();
27163001 refreshContents(true);
27173002 } else
2718
- if (event.getSource() == clearPanelButton)
3003
+ if (source == clearPanelButton)
27193004 {
27203005 assert(copy == group);
27213006 //copy.ClearUI();
....@@ -2726,7 +3011,7 @@
27263011 listUI.clear();
27273012 refreshContents(true);
27283013 } else
2729
- if (event.getSource() == allParamsButton)
3014
+ if (source == allParamsButton)
27303015 {
27313016 assert(copy == group);
27323017
....@@ -2747,19 +3032,19 @@
27473032
27483033 refreshContents(true);
27493034 } else
2750
- if (event.getSource() == unselectButton)
3035
+ if (source == unselectButton)
27513036 {
27523037 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3038
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543039 objEditor.ResetSliders();
27553040 refreshContents(true);
27563041 } else
2757
- if(event.getSource() instanceof cRadio)
3042
+ if(source instanceof cRadio)
27583043 {
27593044 group.parent = keepparent;
27603045 group.attributes = 0;
27613046 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3047
+ /*cRadio*/ radio = (cRadio)source;
27633048 Object3D obj = radio.GetObject();
27643049 System.out.println("Edit " + obj);
27653050 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +3064,7 @@
27793064 }
27803065
27813066 copy = group;
2782
- //CameraPane.theRenderer.object = group;
3067
+ //Globals.theRenderer.object = group;
27833068 if(!useclient)
27843069 {
27853070 cameraView.renderCamera = radio.camera;
....@@ -2788,7 +3073,8 @@
27883073 cameraView.cameras[cameraView.cameracount] = radio.camera;
27893074 cameraView.targetLookAt.set(radio.camera.lookAt);
27903075 cameraView.object = group;
2791
- cameraView.lighttouched = true;
3076
+ //cameraView.lighttouched = true;
3077
+ Globals.lighttouched = true;
27923078 topView.object = group;
27933079 frontView.object = group;
27943080 sideView.object = group;
....@@ -2824,7 +3110,7 @@
28243110 if (useclient)
28253111 {
28263112 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3113
+ Globals.lighttouched = true;
28283114 //topView.object = client;
28293115 //frontView.object = client;
28303116 //sideView.object = client;
....@@ -2832,7 +3118,7 @@
28323118 else
28333119 {
28343120 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3121
+ Globals.lighttouched = true;
28363122 //topView.object = group;
28373123 //frontView.object = group;
28383124 //sideView.object = group;
....@@ -2867,6 +3153,28 @@
28673153 refreshContents();
28683154 }
28693155
3156
+ void TransformChildren()
3157
+ {
3158
+ Object3D obj;
3159
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3160
+ {
3161
+ obj = (Object3D)e.nextElement();
3162
+ obj.KeepTextureMatrices();
3163
+ obj.TransformChildren();
3164
+ obj.RestoreTextureMatrices();
3165
+
3166
+// if (obj.parent == null)
3167
+// {
3168
+// System.out.println("NULL PARENT!");
3169
+// new Exception().printStackTrace();
3170
+// }
3171
+// else
3172
+// TouchTransform(obj);
3173
+// //obj.parent.Touch();
3174
+ }
3175
+
3176
+ refreshContents();
3177
+ }
28703178
28713179 void ResetTransform()
28723180 {
....@@ -2979,7 +3287,7 @@
29793287 refreshContents();
29803288 }
29813289
2982
- void ResetCentroid()
3290
+ void ResetCentroid(boolean full)
29833291 {
29843292 Object3D obj;
29853293 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +3302,16 @@
29943302 LA.matIdentity(Object3D.mat);
29953303 obj.getBounds(minima, maxima, false);
29963304 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3305
+ if (full)
3306
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29983307 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29993308 obj.TransformMesh(Object3D.mat);
3309
+
30003310 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3311
+ if (full)
3312
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30023313 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3314
+
30033315 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30043316 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30053317 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3065,9 +3377,9 @@
30653377 obj = (Object3D)e.nextElement();
30663378
30673379 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3380
+ Grafreed.AnalyzeObject(obj);
30693381 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3382
+ Grafreed.AnalyzeObject(obj.bRep);
30713383
30723384 // System.err.println((size/1024) + " KB is the size of " + obj);
30733385 }
....@@ -3109,6 +3421,13 @@
31093421 void GenNormals(boolean crease)
31103422 {
31113423 group.GenNormalsS(crease);
3424
+
3425
+ refreshContents();
3426
+ }
3427
+
3428
+ void GenNormalsMINE()
3429
+ {
3430
+ group.selection.GenNormalsMINE();
31123431
31133432 refreshContents();
31143433 }
....@@ -3157,104 +3476,259 @@
31573476
31583477 //Object3D buffer;
31593478 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
-
3479
+// BoundaryRep temprep;
3480
+// Object3D nodes;
3481
+// Vector<Vertex> vertices;
3482
+//
3483
+// cGroup buffer;
3484
+//
3485
+// public void Vertex(Object3D node, Vertex v)
3486
+// {
3487
+//// vertices.add(v);
3488
+//// nodes.addElement(node);
3489
+////
3490
+//// if (temprep.GetCache(v) != null)
3491
+//// {
3492
+//// temprep.Remove(v);
3493
+//// } else
3494
+//// {
3495
+//// temprep.Remember(v);
3496
+//// }
3497
+//
3498
+// //Object3D node = nodes.get(index);
3499
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
3500
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3501
+//
3502
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3503
+//
3504
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3505
+//
3506
+// cGroup g = new cGroup();
3507
+//
3508
+// if (g.toParent == null)
3509
+// {
3510
+// g.toParent = LA.newMatrix();
3511
+// g.fromParent = LA.newMatrix();
3512
+// }
3513
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3514
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3515
+//
3516
+// g.add(GrafreeD.clipboard);
3517
+//
3518
+// buffer.add(g);
3519
+// }
3520
+//
3521
+// public void Face(Object3D node, Face f)
3522
+// {
3523
+//
3524
+// }
3525
+//
3526
+// void ParseVerticesOld() // ??
3527
+// {
3528
+// //if (group.selection.size() != 1)
3529
+// // return;
3530
+//
3531
+// temprep = new BoundaryRep();
3532
+// nodes = new Object3D();
3533
+// vertices = new Vector<Vertex>();
3534
+//
3535
+// boolean epsequal = GrafreeD.epsequal;
3536
+// GrafreeD.epsequal = true;
3537
+//
3538
+// for (int i=0; i<group.selection.size(); i++)
3539
+// {
3540
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3541
+//
3542
+// group.selection.get(i).Parse(
3543
+//this );
3544
+//
3545
+// int repsize = temprep.VertexCount();
3546
+// int tablesize = temprep.vertextable.size();
3547
+// int nodesize = nodes.size();
3548
+//
3549
+// assert(vertices.size() == nodes.size());
3550
+//
3551
+// temprep.vertextable.elements();
3552
+//
3553
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
3554
+//
3555
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3556
+// {
3557
+// cGroup g = new cGroup();
3558
+//
3559
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3560
+//
3561
+// Object3D node = nodes.get(index);
3562
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
3563
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3564
+//
3565
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3566
+//
3567
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3568
+//
3569
+// if (g.toParent == null)
3570
+// {
3571
+// g.toParent = LA.newMatrix();
3572
+// g.fromParent = LA.newMatrix();
3573
+// }
3574
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3575
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3576
+//
3577
+// g.add(GrafreeD.clipboard);
3578
+//
3579
+// buffer.add(g);
3580
+// }
3581
+//
3582
+// makeSomething(buffer, i==group.selection.size()-1);
3583
+// }
3584
+//
3585
+// GrafreeD.epsequal = epsequal;
3586
+//
3587
+// //buffer = null;
3588
+// temprep = null;
3589
+// nodes = null;
3590
+//
3591
+// refreshContents();
3592
+// }
3593
+
31843594 void ParseVertices()
31853595 {
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;
3596
+ boolean epsequal = Grafreed.epsequal;
3597
+ Grafreed.epsequal = true;
31953598
31963599 for (int i=0; i<group.selection.size(); i++)
31973600 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3601
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31993602
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
3603
+ group.selection.get(i).Parse(
3604
+
3605
+ new iParse()
3606
+ {
3607
+ public void Vertex(Object3D node, Vertex v)
3608
+ {
3609
+ temp.set(v);
3610
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32053611
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();
3612
+ cGroup g = new cGroup();
32113613
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
3614
+ if (g.toParent == null)
3615
+ {
3616
+ g.toParent = LA.newMatrix();
3617
+ g.fromParent = LA.newMatrix();
3618
+ }
3619
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3620
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32153621
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);
3622
+ g.add(Grafreed.clipboard);
32203623
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);
3624
+ buffer.add(g);
3625
+ }
32323626
3233
- g.add(GraphreeD.clipboard);
3627
+ public void Face(Object3D node, Face f)
3628
+ {
32343629
3235
- buffer.add(g);
3236
- }
3630
+ }
3631
+ }
3632
+ );
32373633
32383634 makeSomething(buffer, i==group.selection.size()-1);
32393635 }
32403636
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
3637
+ Grafreed.epsequal = epsequal;
32463638
32473639 refreshContents();
32483640 }
3249
-
3641
+
3642
+ void TextureVertices()
3643
+ {
3644
+ for (int i=0; i<group.selection.size(); i++)
3645
+ {
3646
+ group.selection.get(i).Parse(
3647
+ new iParse()
3648
+ {
3649
+ public void Vertex(Object3D node, Vertex v)
3650
+ {
3651
+ cTexture tex = node.GetTextures();
3652
+ String pigment = Object3D.GetPigment(tex);
3653
+ //String bump = Object3D.GetBump(tex);
3654
+
3655
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3656
+
3657
+ try
3658
+ {
3659
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3660
+ }
3661
+ catch (Exception e)
3662
+ {
3663
+ System.err.println("FAIL: " + node);
3664
+ }
3665
+
3666
+ double s = v.s;
3667
+
3668
+ if (s == 1)
3669
+ s = 0;
3670
+
3671
+ double t = v.t;
3672
+
3673
+ if (t == 1)
3674
+ t = 0;
3675
+
3676
+ int indexs = (int) (texturedata.getWidth() * s);
3677
+ int indext = (int) (texturedata.getHeight() * t);
3678
+
3679
+ int index = indext * texturedata.getWidth() + indexs;
3680
+
3681
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
3682
+
3683
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
3684
+
3685
+ float scale = bytebuf.get(index*slide) & 0xFF;
3686
+ scale += bytebuf.get(index*slide+1) & 0xFF;
3687
+ scale += bytebuf.get(index*slide+2) & 0xFF;
3688
+ scale /= 3;
3689
+
3690
+ scale /= 0xFF;
3691
+ // c'est quoi ca? scale /= 4;
3692
+
3693
+ //v.AO = scale;
3694
+
3695
+ v.x += v.norm.x * scale;
3696
+ v.y += v.norm.y * scale;
3697
+ v.z += v.norm.z * scale;
3698
+ }
3699
+
3700
+ public void Face(Object3D node, Face f)
3701
+ {
3702
+ }
3703
+ }
3704
+ );
3705
+ }
3706
+
3707
+ refreshContents();
3708
+ }
3709
+
32503710 void Align()
32513711 {
3712
+ if (group.selection.size() == 0)
3713
+ return;
3714
+
3715
+ cVector bbmin = new cVector();
3716
+ cVector bbmax = new cVector();
3717
+
3718
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
3719
+
3720
+ double dx = bbmax.x - bbmin.x;
3721
+ double dy = bbmax.y - bbmin.y;
3722
+ double dz = bbmax.z - bbmin.z;
3723
+
3724
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
3725
+
32523726 for (int i=0; i<group.selection.size(); i++)
32533727 {
32543728 Object3D obj = group.selection.get(i);
32553729
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
3730
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
3731
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32583732 }
32593733
32603734 refreshContents();
....@@ -3267,7 +3741,7 @@
32673741 // ref.SaveSupports();
32683742 // Object3D par = ref.parent;
32693743 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
3744
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32713745 // ref.parent = par;
32723746 // ref.RestoreSupports();
32733747
....@@ -3275,11 +3749,11 @@
32753749
32763750 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32773751
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
3752
+ boolean random = CameraPane.SWITCH;
3753
+ CameraPane.SWITCH = false; // parse all random nodes
32803754 lowres.linkVerticesThis(null);
32813755 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
3756
+ CameraPane.SWITCH = random;
32833757
32843758 System.err.flush();
32853759
....@@ -3297,7 +3771,7 @@
32973771 // lowres.SaveSupports();
32983772 // par = lowres.parent;
32993773 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
3774
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33013775 Object3D newlow = CloneObject(lowres, false);
33023776 newlow.name = sn.switchobject.get(i).name;
33033777 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +3793,7 @@
33193793 return;
33203794
33213795 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
3796
+ Object3D ref = Grafreed.clipboard.get(0);
33233797
33243798 Object3D newgroup = new Object3D("Po:" + poses.name);
33253799
....@@ -3488,7 +3962,7 @@
34883962 group.selection.RelinkToSupport(); // july 2014
34893963 System.out.println("DONE.");
34903964 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
3965
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34923966 }
34933967
34943968 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +3987,20 @@
35133987
35143988 void ClipMesh()
35153989 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3990
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35173991 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
3992
+ Object3D content = Grafreed.clipboard.get(0);
35193993
35203994 if (content instanceof cGroup && ((cGroup)content).transientlink )
35213995 content = ((cGroup)content).get(0);
35223996
35233997 // for (int i=0; i<group.selection.size(); i++)
35243998 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
3999
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264000 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4001
+ group.selection.ClipMesh(Grafreed.clipboard);
35284002 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4003
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304004 System.out.println("DONE.");
35314005 refreshContents();
35324006 }
....@@ -3764,25 +4238,25 @@
37644238 System.err.println("info : " + child.GetPath());
37654239 }
37664240 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
4241
+// else
4242
+// {
4243
+// objEditor.SetMaterial(group); // .GetMaterial());
4244
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4245
+// System.err.println("info : " + group.GetPath());
4246
+// }
37734247
37744248 objEditor.SetText(); // jan 2014
37754249
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4250
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
37774251 CameraPane.flash = true;
37784252
37794253 if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
37804254 // a camera
37814255 {
37824256 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;
4257
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4258
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4259
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864260 }
37874261
37884262 refreshContents();
....@@ -3864,12 +4338,12 @@
38644338 {
38654339 if (group.selection.isEmpty())
38664340 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4341
+ Grafreed.clipboardIsTempGroup = false;
38684342 Composite tGroup = null;
38694343 if (group.selection.size() > 0) // 1)
38704344 {
38714345 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4346
+ Grafreed.clipboardIsTempGroup = true;
38734347 }
38744348
38754349 if (cut)
....@@ -3909,16 +4383,16 @@
39094383 //System.out.println("cut " + child);
39104384 //System.out.println("parent = " + child.parent);
39114385 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4386
+ if (Grafreed.clipboardIsTempGroup)
39134387 tGroup.add/*Child*/(tmp);
39144388 else
3915
- GraphreeD.clipboard = tmp;
4389
+ Grafreed.clipboard = tmp;
39164390 }
39174391 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4392
+ if (Grafreed.clipboardIsTempGroup)
39194393 tGroup.add/*Child*/(child);
39204394 else
3921
- GraphreeD.clipboard = child;
4395
+ Grafreed.clipboard = child;
39224396 }
39234397
39244398 //ResetModel();
....@@ -3950,21 +4424,21 @@
39504424 //System.out.println("cut " + elem);
39514425 //System.out.println("parent = " + elem.parent);
39524426 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4427
+ if (Grafreed.clipboardIsTempGroup)
39544428 tGroup.add/*Child*/(tmp);
39554429 else
3956
- GraphreeD.clipboard = tmp;
4430
+ Grafreed.clipboard = tmp;
39574431 }
39584432 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4433
+ if (Grafreed.clipboardIsTempGroup)
39604434 tGroup.add/*Child*/(child);
39614435 else
3962
- GraphreeD.clipboard = child;
4436
+ Grafreed.clipboard = child;
39634437 }
39644438
39654439 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4440
+ if (Grafreed.clipboardIsTempGroup)
4441
+ Grafreed.clipboard = tGroup;
39684442 if (cut)
39694443 {
39704444 ResetModel();
....@@ -3974,11 +4448,11 @@
39744448
39754449 void paste(boolean expand)
39764450 {
3977
- // if (GraphreeD.clipboard == null)
4451
+ // if (GrafreeD.clipboard == null)
39784452 // return;
39794453 boolean first = true;
39804454
3981
- if (GraphreeD.clipboardIsTempGroup)
4455
+ if (Grafreed.clipboardIsTempGroup)
39824456 {
39834457 Composite temp;
39844458
....@@ -3989,7 +4463,7 @@
39894463 temp = (Composite)Applet3D.clipboard.deepCopy();
39904464 */
39914465 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4466
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39934467 {
39944468 Object3D child = (Object3D)e.nextElement();
39954469
....@@ -4003,7 +4477,7 @@
40034477 else
40044478 elem = child.deepCopy(); // ?
40054479 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4480
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40074481 // elem = elem.get(0);
40084482 makeSomething(elem, true); // ?? first);
40094483 //group.addChild(elem);
....@@ -4023,23 +4497,23 @@
40234497 //Object3D cb = Applet3D.clipboard;
40244498 //temp.addChild(cb);
40254499 //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());
4500
+ assert(Grafreed.clipboard.parent == null);
4501
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4502
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4503
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4504
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40314505 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
4506
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4507
+ Grafreed.clipboard.get(0).parent = keepparent;
40344508 }
40354509
40364510 ResetModel();
40374511 refreshContents();
40384512 }
40394513
4040
- void pasteInto(boolean copyit)
4514
+ void pasteInto(boolean copyit, boolean clone)
40414515 {
4042
-// if (GraphreeD.clipboard == null)
4516
+// if (GrafreeD.clipboard == null)
40434517 // return;
40444518
40454519 if (group.selection.size() != 1)
....@@ -4066,15 +4540,22 @@
40664540 if (copyit)
40674541 {
40684542 // paste(false);
4069
- CloneClipboard(false); // sept 2014
4543
+ if (clone)
4544
+ {
4545
+ CloneClipboard(false); // sept 2014
4546
+ }
4547
+ else
4548
+ {
4549
+ paste(false);
4550
+ }
40704551 }
40714552 else
40724553 {
40734554 boolean first = true;
40744555
4075
- if (GraphreeD.clipboardIsTempGroup)
4556
+ if (Grafreed.clipboardIsTempGroup)
40764557 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
4558
+ Composite temp = (Composite)Grafreed.clipboard;
40784559 Object3D copy;
40794560 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40804561 {
....@@ -4084,7 +4565,7 @@
40844565 }
40854566 } else
40864567 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
4568
+ linkSomething(Grafreed.clipboard); //.get(0));
40884569 }
40894570 }
40904571 }
....@@ -4276,6 +4757,26 @@
42764757 makeSomething(csg);
42774758 }
42784759
4760
+ void Ungroup(Object3D g)
4761
+ {
4762
+ if (g instanceof HiddenObject)
4763
+ {
4764
+ HiddenObject h = (HiddenObject) g;
4765
+
4766
+ for (int i=0; i<h.ActualSize(); i++)
4767
+ {
4768
+ objEditor.makeSomething(h.get(i), false);
4769
+ }
4770
+ }
4771
+ else
4772
+ {
4773
+ for (int i=0; i<g.Size(); i++)
4774
+ {
4775
+ objEditor.makeSomething(g.get(i), false);
4776
+ }
4777
+ }
4778
+ }
4779
+
42794780 void ungroup()
42804781 {
42814782 /*
....@@ -4471,7 +4972,7 @@
44714972
44724973 void ImportGFD()
44734974 {
4474
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4975
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
44754976 browser.show();
44764977 String filename = browser.getFile();
44774978 if (filename != null && filename.length() > 0)
....@@ -4509,7 +5010,7 @@
45095010
45105011 void ImportVRMLX3D()
45115012 {
4512
- if (GraphreeD.standAlone)
5013
+ if (Grafreed.standAlone)
45135014 {
45145015 /**/
45155016 FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
....@@ -4526,7 +5027,7 @@
45265027
45275028 String GetFile(String dialogName)
45285029 {
4529
- if (GraphreeD.standAlone)
5030
+ if (Grafreed.standAlone)
45305031 {
45315032 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45325033 browser.show();
....@@ -4590,10 +5091,12 @@
45905091 cButton flashSelectionButton;
45915092 cButton editButton;
45925093 cButton uneditButton;
5094
+ JCheckBox allParamsButton;
45935095 cButton clearpanelButton;
4594
- cButton allParamsButton;
45955096 cButton unselectButton;
45965097
5098
+ cButton oneStepButton;
5099
+
45975100 cButton screenfitButton;
45985101 cButton screenfitpointButton;
45995102 cButton snapobjectButton;
....@@ -4635,8 +5138,9 @@
46355138 private MenuItem resetsupportItem;
46365139 private MenuItem resetreferencesItem;
46375140 private MenuItem linkverticesItem;
5141
+ private MenuItem relinkverticesItem;
46385142 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
5143
+ private MenuItem resetAllItem;
46405144 private MenuItem stepAllItem;
46415145 private MenuItem revertMeshItem;
46425146 private MenuItem poseMeshItem;
....@@ -4647,14 +5151,17 @@
46475151 private MenuItem mergeGeometriesItem;
46485152 private MenuItem copyItem;
46495153 private MenuItem pasteItem;
5154
+ private MenuItem pasteIntoItem;
46505155 private MenuItem pasteLinkItem;
46515156 private MenuItem pasteCloneItem;
46525157 private MenuItem pasteExpandItem;
46535158 private MenuItem clearItem;
46545159 private MenuItem clearAllItem;
46555160 private MenuItem genUVItem;
5161
+ private MenuItem genNormalsMESHItem;
46565162 private MenuItem genNormalsCADItem;
46575163 private MenuItem genNormalsORGANItem;
5164
+ private MenuItem genNormalsMINEItem;
46585165 private MenuItem stripifyItem;
46595166 private MenuItem unstripifyItem;
46605167 private MenuItem trimItem;
....@@ -4694,8 +5201,11 @@
46945201 private MenuItem panoTexturesItem;
46955202
46965203 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
5204
+ private MenuItem resetCentroidXZItem;
46985205 private MenuItem resetTransformItem;
5206
+ private MenuItem transformGeometryItem;
5207
+ private MenuItem transformChildrenItem;
5208
+ private MenuItem hideItem;
46995209 private MenuItem grabItem;
47005210 private MenuItem backItem;
47015211 private MenuItem frontItem;
....@@ -4716,6 +5226,7 @@
47165226
47175227 private MenuItem resetParentItem;
47185228 private MenuItem repairParentItem;
5229
+ private MenuItem repairShadowItem;
47195230 private MenuItem sortbysizeItem;
47205231 private MenuItem sortbynameItem;
47215232
....@@ -4728,16 +5239,19 @@
47285239 private MenuItem particleItem;
47295240 private MenuItem ragdollItem;
47305241 private MenuItem ragdoll2Item;
5242
+ private MenuItem heightFieldItem;
5243
+ private MenuItem textureFieldItem;
47315244 private MenuItem gridItem;
47325245 private MenuItem rectoidItem;
47335246 private MenuItem ellipsoidItem;
47345247 private MenuItem coneItem;
47355248 private MenuItem torusItem;
47365249 private MenuItem superItem;
5250
+ private MenuItem kleinItem;
47375251 private MenuItem blobItem;
47385252 private MenuItem latheItem;
47395253 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
5254
+ private MenuItem overlayItem;
47415255 private MenuItem meshItem;
47425256 // private MenuItem meshGroupItem;
47435257 private MenuItem springItem;
....@@ -4746,6 +5260,7 @@
47465260 private MenuItem csgItem;
47475261 private MenuItem templateItem;
47485262 private MenuItem textureItem;
5263
+ private MenuItem billboardItem;
47495264 private MenuItem shadowXItem;
47505265 private MenuItem shadowYItem;
47515266 private MenuItem shadowZItem;