Normand Briere
2019-06-24 c67da2e5d8655704601d6d06e8bc60aabe212253
GroupEditor.java
....@@ -12,6 +12,7 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
1718 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
....@@ -73,7 +74,7 @@
7374 this.copy = this.group = copy;
7475 //selectees = this.group.selectees;
7576
76
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7778 SetupUI2(objEditor);
7879 objEditor.SetupUI(true);
7980 SetupViews(objEditor);
....@@ -97,14 +98,14 @@
9798
9899 void CloneClipboard(boolean supports)
99100 {
100
- assert(GrafreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
102
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
101
+ assert(Grafreed.clipboard.parent == null);
102
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
103
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
104
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
105
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105106 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
107
+ makeSomething(CloneObject(Grafreed.clipboard, false));
108
+ Grafreed.clipboard.get(0).parent = keepparent;
108109 }
109110
110111 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +119,7 @@
118119 // obj.support = null;
119120 if (!supports)
120121 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
122
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122123 obj.parent = parent;
123124 // obj.support = support;
124125 // clone.support = support; // aout 2013
....@@ -147,8 +148,129 @@
147148
148149 //JTextField nameField;
149150
150
- void SetupMenu2(ObjEditor oe)
151
+ void SetupMenu2(GroupEditor oe)
151152 {
153
+ Menu menu;
154
+ oe.menuBar.add(menu = new Menu("Edit"));
155
+ //editItem = menu.add(new MenuItem("Edit"));
156
+ //editItem.addActionListener(this);
157
+
158
+// undoItem = menu.add(new MenuItem("Undo"));
159
+// undoItem.addActionListener(this);
160
+// redoItem = menu.add(new MenuItem("Redo"));
161
+// redoItem.addActionListener(this);
162
+// menu.add("-");
163
+ duplicateItem = menu.add(new MenuItem("Duplicate"));
164
+ duplicateItem.addActionListener(this);
165
+ cloneItem = menu.add(new MenuItem("Clone"));
166
+ cloneItem.addActionListener(this);
167
+ if (Globals.ADVANCED)
168
+ {
169
+ cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
170
+ cloneSupportItem.addActionListener(this);
171
+ }
172
+ menu.add("-");
173
+ cutItem = menu.add(new MenuItem("Cut"));
174
+ cutItem.addActionListener(this);
175
+ copyItem = menu.add(new MenuItem("Copy"));
176
+ copyItem.addActionListener(this);
177
+ pasteItem = menu.add(new MenuItem("Paste"));
178
+ pasteItem.addActionListener(this);
179
+
180
+ menu.add("-");
181
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
182
+ pasteIntoItem.addActionListener(this);
183
+ pasteLinkItem = menu.add(new MenuItem("Paste link"));
184
+ pasteLinkItem.addActionListener(this);
185
+ pasteCloneItem = menu.add(new MenuItem("Paste clone"));
186
+ pasteCloneItem.addActionListener(this);
187
+// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
188
+// pasteExpandItem.addActionListener(this);
189
+ menu.add("-");
190
+ clearItem = menu.add(new MenuItem("Clear"));
191
+ clearItem.addActionListener(this);
192
+
193
+ if (Globals.ADVANCED)
194
+ {
195
+ // Deletes the cameras...
196
+ clearAllItem = menu.add(new MenuItem("Clear All"));
197
+ clearAllItem.addActionListener(this);
198
+ }
199
+
200
+ menuBar.add(cameraMenu = new Menu("View"));
201
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
202
+ //zBufferItem.addActionListener(this);
203
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204
+ //normalLensItem.addActionListener(this);
205
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
+ revertCameraItem.addActionListener(this);
207
+
208
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
+ toggleFullScreenItem.addItemListener(this);
210
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
+ cameraMenu.add("-");
212
+
213
+ cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
+ toggleTextureItem.addItemListener(this);
215
+ toggleTextureItem.setState(CameraPane.textureon);
216
+
217
+ cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
+ toggleSwitchItem.addItemListener(this);
219
+ toggleSwitchItem.setState(CameraPane.SWITCH);
220
+
221
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
222
+ toggleHandleItem.addItemListener(this);
223
+ toggleHandleItem.setState(CameraPane.HANDLES);
224
+
225
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
226
+ togglePaintItem.addItemListener(this);
227
+ togglePaintItem.setState(CameraPane.PAINTMODE);
228
+
229
+ if (Globals.ADVANCED)
230
+ {
231
+ cameraMenu.add("-");
232
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
233
+ toggleLiveItem.addItemListener(this);
234
+ toggleLiveItem.setState(Globals.isLIVE());
235
+
236
+ cameraMenu.add(stepItem = new MenuItem("Step"));
237
+ stepItem.addActionListener(this);
238
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
239
+ // toggleDLItem.addItemListener(this);
240
+ // toggleDLItem.setState(false);
241
+
242
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
243
+ toggleRenderItem.addItemListener(this);
244
+ toggleRenderItem.setState(!CameraPane.frozen);
245
+
246
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
247
+ toggleDebugItem.addItemListener(this);
248
+ toggleDebugItem.setState(Globals.DEBUG);
249
+
250
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
251
+ toggleFrustumItem.addItemListener(this);
252
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
253
+
254
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
255
+ toggleFootContactItem.addItemListener(this);
256
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
257
+
258
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
259
+ toggleTimelineItem.addItemListener(this);
260
+ }
261
+
262
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
263
+// toggleRootItem.addItemListener(this);
264
+// toggleRootItem.setState(false);
265
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
266
+// animationItem.addItemListener(this);
267
+// animationItem.setState(CameraPane.ANIMATION);
268
+ cameraMenu.add("-");
269
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
270
+ editCameraItem.addActionListener(this);
271
+
272
+ if (Globals.ADVANCED)
273
+ {
152274 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153275 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154276 //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
....@@ -160,45 +282,17 @@
160282 lookAtItem.addActionListener(this);
161283 //lookFromItem.addActinoListener(this);
162284 //switchItem.addActionListener(this);
163
- Menu menu;
164
- oe.menuBar.add(menu = new Menu("Edit"));
165
- //editItem = menu.add(new MenuItem("Edit"));
166
- //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
168
- duplicateItem.addActionListener(this);
169
- menu.add("-");
170
- cloneItem = menu.add(new MenuItem("Clone"));
171
- cloneItem.addActionListener(this);
172
- cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173
- cloneSupportItem.addActionListener(this);
174
- menu.add("-");
175
- cutItem = menu.add(new MenuItem("Cut"));
176
- cutItem.addActionListener(this);
177
- copyItem = menu.add(new MenuItem("Copy"));
178
- copyItem.addActionListener(this);
179
- pasteItem = menu.add(new MenuItem("Paste"));
180
- pasteItem.addActionListener(this);
181
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
182
- pasteLinkItem.addActionListener(this);
183
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184
- pasteCloneItem.addActionListener(this);
185
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186
-// pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
189
- clearAllItem = menu.add(new MenuItem("Clear All"));
190
- clearAllItem.addActionListener(this);
191
-
285
+ }
286
+
192287 oe.menuBar.add(menu = new Menu("Setting"));
193
- resetMeshItem = menu.add(new MenuItem("Reset All"));
194
- resetMeshItem.addActionListener(this);
195
- stepAllItem = menu.add(new MenuItem("Step All"));
196
- stepAllItem.addActionListener(this);
288
+ if (Globals.ADVANCED)
289
+ {
197290 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198291 revertMeshItem.addActionListener(this);
199292 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200293 resetreferencesItem.addActionListener(this);
201294 menu.add("-");
295
+ }
202296 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203297 overwriteGeoItem.addActionListener(this);
204298 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,17 +304,26 @@
210304 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211305 overwriteUVItem.addActionListener(this);
212306 menu.add("-");
307
+ if (Globals.ADVANCED)
308
+ {
213309 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214310 generateMeshItem.addActionListener(this);
215311 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216312 poseMeshItem.addActionListener(this);
217313 menu.add("-");
314
+ }
218315 resetsupportItem = menu.add(new MenuItem("Reset support"));
219316 resetsupportItem.addActionListener(this);
220317 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221318 linkverticesItem.addActionListener(this);
319
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
320
+ relinkverticesItem.addActionListener(this);
321
+
322
+ if (Globals.ADVANCED)
323
+ {
222324 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223325 setMasterItem.addActionListener(this);
326
+ }
224327
225328 oe.menuBar.add(menu = new Menu("Group"));
226329 grabItem = menu.add(new MenuItem("Grab"));
....@@ -231,52 +334,69 @@
231334 frontItem.addActionListener(this);
232335 compositeItem = menu.add(new MenuItem("Composite"));
233336 compositeItem.addActionListener(this);
337
+ hideItem = menu.add(new MenuItem("Hidden Group"));
338
+ hideItem.addActionListener(this);
339
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
340
+ ungroupItem.addActionListener(this);
234341 menu.add("-");
235
- randomItem = menu.add(new MenuItem("Random"));
342
+ randomItem = menu.add(new MenuItem("Switch node"));
236343 randomItem.addActionListener(this);
237
- physicsItem = menu.add(new MenuItem("Physics"));
238
- physicsItem.addActionListener(this);
239
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
240
- frameselectorItem.addActionListener(this);
241344 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
242345 switchGeoItem.addActionListener(this);
243346 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
244347 switchTransfoItem.addActionListener(this);
245
- morphItem = menu.add(new MenuItem("Morph"));
348
+ morphItem = menu.add(new MenuItem("Morph Group"));
246349 morphItem.addActionListener(this);
350
+
351
+ if (Globals.ADVANCED)
352
+ {
353
+ menu.add("-");
354
+ physicsItem = menu.add(new MenuItem("Physics"));
355
+ physicsItem.addActionListener(this);
356
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
357
+ frameselectorItem.addActionListener(this);
247358 scriptNodeItem = menu.add(new MenuItem("Script Node"));
248359 scriptNodeItem.addActionListener(this);
249360 cameraItem = menu.add(new MenuItem("Camera"));
250361 cameraItem.addActionListener(this);
362
+ }
251363
252364 oe.menuBar.add(menu = new Menu("Object"));
253365 textureItem = menu.add(new MenuItem("Texture"));
254366 textureItem.addActionListener(this);
367
+ billboardItem = menu.add(new MenuItem("Billboard"));
368
+ billboardItem.addActionListener(this);
255369 csgItem = menu.add(new MenuItem("CSG"));
256370 csgItem.addActionListener(this);
257
- shadowXItem = menu.add(new MenuItem("Shadow X"));
371
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
258372 shadowXItem.addActionListener(this);
259
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
373
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
260374 shadowYItem.addActionListener(this);
261
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
375
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
262376 shadowZItem.addActionListener(this);
377
+ if (Globals.ADVANCED)
378
+ {
379
+ menu.add("-");
263380 linkerItem = menu.add(new MenuItem("Linker"));
264381 linkerItem.addActionListener(this);
265
- templateItem = menu.add(new MenuItem("Template"));
266
- templateItem.addActionListener(this);
267382 attributeItem = menu.add(new MenuItem("Attribute"));
268383 attributeItem.addActionListener(this);
384
+ templateItem = menu.add(new MenuItem("Template"));
385
+ templateItem.addActionListener(this);
269386 pointflowItem = menu.add(new MenuItem("Point Flow"));
270387 pointflowItem.addActionListener(this);
388
+ }
271389 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274390 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275391 resetTransformItem.addActionListener(this);
276392 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277393 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.addActionListener(this);
394
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
395
+ resetCentroidXZItem.addActionListener(this);
396
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
397
+ transformGeometryItem.addActionListener(this);
398
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
399
+ transformChildrenItem.addActionListener(this);
280400
281401 oe.menuBar.add(menu = new Menu("Geometry"));
282402 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -285,6 +405,13 @@
285405 genNormalsORGANItem.addActionListener(this);
286406 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
287407 genNormalsCADItem.addActionListener(this);
408
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
409
+ genNormalsMESHItem.addActionListener(this);
410
+ if (Globals.ADVANCED)
411
+ {
412
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
413
+ genNormalsMINEItem.addActionListener(this);
414
+ }
288415 stripifyItem = menu.add(new MenuItem("Stripify"));
289416 stripifyItem.addActionListener(this);
290417 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -306,23 +433,34 @@
306433 reduce34MeshItem.addActionListener(this);
307434 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308435 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311436 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312437 clipMeshItem.addActionListener(this);
438
+
439
+ if (Globals.ADVANCED)
440
+ {
441
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
442
+ smoothMeshItem.addActionListener(this);
443
+ }
313444
314445 oe.menuBar.add(menu = new Menu("Attributes"));
315446 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
316447 clearMaterialsItem.addActionListener(this);
448
+ resetAllItem = menu.add(new MenuItem("Reset All"));
449
+ resetAllItem.addActionListener(this);
450
+ stepAllItem = menu.add(new MenuItem("Step All"));
451
+ stepAllItem.addActionListener(this);
317452 menu.add("-");
318453 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
319454 liveleavesItem.addActionListener(this);
320455 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
321456 unliveleavesItem.addActionListener(this);
457
+ if (Globals.ADVANCED)
458
+ {
322459 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
323460 supportleavesItem.addActionListener(this);
324461 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
325462 unsupportleavesItem.addActionListener(this);
463
+ }
326464 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
327465 hideleavesItem.addActionListener(this);
328466 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -331,6 +469,14 @@
331469 markleavesItem.addActionListener(this);
332470 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
333471 unmarkleavesItem.addActionListener(this);
472
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
473
+ rewindleavesItem.addActionListener(this);
474
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
475
+ unrewindleavesItem.addActionListener(this);
476
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
477
+ randomleavesItem.addActionListener(this);
478
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
479
+ unrandomleavesItem.addActionListener(this);
334480 menu.add("-");
335481 flipVItem = menu.add(new MenuItem("Flip V"));
336482 flipVItem.addActionListener(this);
....@@ -366,35 +512,40 @@
366512 sortbynameItem = menu.add(new MenuItem("Sort by name"));
367513 sortbynameItem.addActionListener(this);
368514 menu.add("-");
515
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
516
+ shareGeometriesItem.addActionListener(this);
517
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
518
+ mergeGeometriesItem.addActionListener(this);
519
+ if (Globals.ADVANCED)
520
+ {
521
+ // Pretty much the same as duplicate and clone.
369522 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
370523 extractGeometriesItem.addActionListener(this);
371524 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
372525 cloneGeometriesItem.addActionListener(this);
373
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
374
- shareGeometriesItem.addActionListener(this);
375
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
376
- mergeGeometriesItem.addActionListener(this);
526
+ }
377527
378528 oe.menuBar.add(menu = new Menu("Insert"));
379529 buildCreateMenu(menu);
380530
381
-
382
- oe.menuBar.add(menu = new Menu("Include"));
383
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
384
- importGFDItem.addActionListener(this);
385
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
386
- importVRMLX3DItem.addActionListener(this);
387
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
388
- importOBJItem.addActionListener(this);
389
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
390
- import3DSItem.addActionListener(this);
391
-
392531 oe.menuBar.add(menu = new Menu("Tools"));
393532 buildToolsMenu(menu);
394533 }
395534
396535 void SetupUI2(ObjEditor oe)
397536 {
537
+ // June 2019
538
+ if (oe == null)
539
+ {
540
+ //super.SetupUI2(this);
541
+ //return;
542
+ }
543
+
544
+ if (copy != group)
545
+ {
546
+ //super.SetupUI2(this);
547
+ }
548
+
398549 //new Exception().printStackTrace();
399550
400551 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -423,150 +574,120 @@
423574 oe.radioPanel.add(dummyButton);
424575 oe.buttonGroup.add(dummyButton);
425576 */
426
- aConstraints.gridy += 1;
427
- oe.aConstraints.gridwidth = 1;
428
- oe.aConstraints.gridx = 0;
577
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
429578
430
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
579
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580
+ //minButton.setToolTipText("Minimize window");
581
+ //minButton.addActionListener(this);
582
+
583
+ oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
+ maxButton.setToolTipText("Maximize window");
585
+ maxButton.addActionListener(this);
586
+
587
+ oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ fullButton.setToolTipText("Full-screen window");
589
+ fullButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ undoButton.setToolTipText("Undo changes");
593
+ undoButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ redoButton.setToolTipText("Redo changes");
597
+ redoButton.addActionListener(this);
598
+
599
+ oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ saveButton.setToolTipText("Save changes");
601
+ saveButton.addActionListener(this);
602
+
603
+ oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
604
+ liveCB.setToolTipText("Enable animation");
431605 liveCB.addItemListener(this);
432606
433
- oe.aConstraints.gridx += 1;
434
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
435
- supportCB.addItemListener(this);
436
-
437
- // oe.aConstraints.gridx += 1;
438
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
439
- // localCB.addItemListener(this);
440
-
441
- oe.aConstraints.gridx += 1;
442
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
443
- crowdCB.addItemListener(this);
444
-
445
- oe.aConstraints.gridx += 1;
446
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
447
- smoothCB.addItemListener(this);
448
-
449
- oe.aConstraints.gridx += 1;
450
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
607
+ oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ oneStepButton.setToolTipText("Animate one step forward");
609
+ oneStepButton.addActionListener(this);
610
+
611
+ oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
612
+ fastCB.setToolTipText("Fast mode");
451613 fastCB.addItemListener(this);
452
- oe.aConstraints.gridx += 1;
453
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
454
- slowCB.addItemListener(this);
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
457
- boxCB.addItemListener(this);
458
-
459
-// oe.aConstraints.gridx += 1;
460
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
461
-// speakerMocapCB.addItemListener(this);
462
-
463
- if (false)
464
- {
465
- // handled in scripts
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
468
- speakerCameraCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
472
- speakerFocusCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
476
- smoothfocusCB.addItemListener(this);
477
- }
478
-
479
-//oe.aConstraints.gridx += 1;
480
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
481
-// debugCB.addItemListener(this);
482
-
483
- oe.aConstraints.gridx += 1;
484
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
485
- oeilCB.addItemListener(this);
486
-
487
- oe.aConstraints.gridx += 1;
488
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
489
- lookAtCB.addItemListener(this);
490
-
491
- oe.aConstraints.gridx += 1;
492
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
614
+
615
+ oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
616
+ trackCB.setToolTipText("Enable tracking");
493617 trackCB.addItemListener(this);
494618
495
- oe.aConstraints.gridx += 1;
496
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ screenfitButton.setToolTipText("Screen fit");
497621 screenfitButton.addActionListener(this);
498
- oe.aConstraints.gridx += 1;
622
+
499623 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
500624 // screenfitpointButton.addActionListener(this);
501
-// oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
503
- snapobjectButton.addActionListener(this);
504
- oe.aConstraints.gridx += 1;
505625
506
- //aConstraints.gridx = 0;
507
- //aConstraints.gridy += 1;
508
- oe.aConstraints.weighty = 0;
509
- oe.aConstraints.gridwidth = 1;
510
-
511
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
626
+ if (Globals.ADVANCED)
627
+ {
628
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ snapobjectButton.addActionListener(this);
630
+ snapobjectButton.setToolTipText("Snap Object");
631
+ }
632
+
633
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ flashSelectionButton.setToolTipText("Show selection");
512635 flashSelectionButton.addActionListener(this);
513
- oe.aConstraints.gridx += 1;
514
- oe.aConstraints.weighty = 0;
515
- oe.aConstraints.gridwidth = 1;
516636
517
- //
518
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
637
+ oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
638
+
639
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
640
+ twoButton.setToolTipText("Show center view only");
519641 twoButton.addActionListener(this);
520
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
642
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521643 fourButton.addActionListener(this);
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
644
+ fourButton.setToolTipText("Show left panel only");
645
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646
+ sixButton.setToolTipText("2-column layout left");
523647 sixButton.addActionListener(this);
524
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
648
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ threeButton.setToolTipText("2-column layout right");
525650 threeButton.addActionListener(this);
526
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
651
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
+ sevenButton.setToolTipText("3-column layout");
527653 sevenButton.addActionListener(this);
528654 //
529655
530
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
656
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
+ rootButton.setToolTipText("Edit selection in new tab");
531658 rootButton.addActionListener(this);
532
- oe.aConstraints.gridx += 1;
533
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
659
+
660
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
+ closeButton.setToolTipText("Close tab");
534662 closeButton.addActionListener(this);
535663 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
536664 //clearButton.addActionListener(this);
537
- oe.aConstraints.gridx += 1;
538665
539
- oe.aConstraints.gridx = 1; //
540
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
666
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
+ editButton.setToolTipText("Edit selection");
541668 editButton.addActionListener(this);
542
- oe.aConstraints.gridx += 1;
543
- oe.aConstraints.weighty = 0;
544
- oe.aConstraints.gridwidth = 1;
545669
546
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
670
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
+ uneditButton.setToolTipText("Unedit selection");
547672 uneditButton.addActionListener(this);
548673
549
- oe.aConstraints.gridx += 1;
550
- oe.aConstraints.weighty = 0;
551
- oe.aConstraints.gridwidth = 1;
552
-
553
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
554
- clearPanelButton.addActionListener(this);
555
-
556
- oe.aConstraints.gridx += 1;
557
- oe.aConstraints.weighty = 0;
558
- oe.aConstraints.gridwidth = 1;
559
-
560
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
674
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
+ allParamsButton.setToolTipText("Edit all params");
561676 allParamsButton.addActionListener(this);
562677
563
- oe.aConstraints.gridx += 1;
564
- oe.aConstraints.weighty = 0;
565
- oe.aConstraints.gridwidth = 1;
566
-
567
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
678
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
+ clearPanelButton.setToolTipText("Clear edit panel");
680
+ clearPanelButton.addActionListener(this);
681
+
682
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
683
+ unselectButton.setToolTipText("Unselect");
568684 unselectButton.addActionListener(this);
569685
686
+ editCommandsPanel.preferredHeight = 1;
687
+
688
+// oe.treePanel.add(commandsPanel);
689
+// oe.treePanel.Return();
690
+
570691 // oe.aConstraints.gridx += 1;
571692 // oe.aConstraints.weighty = 0;
572693 // oe.aConstraints.gridwidth = 1;
....@@ -578,40 +699,37 @@
578699 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
579700 // gcButton.addActionListener(this);
580701
581
- oe.aConstraints.gridx = 0;
582
- oe.aConstraints.gridy += 1;
583
-
584
- //ctrlPanel.add(objList = new List(5, true));
585
- oe.aConstraints.gridwidth = 100;
586
- // oe.aConstraints.gridheight = 100;
587
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
588
- oe.aConstraints.gridheight = 1;
589
- oe.aConstraints.weighty = 0.5;
590
- oe.aConstraints.gridx = 0;
591
- JScrollPane jSP;
702
+ cGridBag jSPPanel = new cGridBag();
703
+
704
+ JScrollPane jSP;
592705 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
593
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
706
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
594707 ResetModel();
595
- oe.aConstraints.weighty = 0.5;
596
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
597
- oe.aConstraints.gridy += 1;
598
- oe.aConstraints.gridwidth = 1;
708
+
709
+ oe.treePanel.add(jSPPanel);
710
+ oe.treePanel.Return();
599711
600
- oe.aConstraints.weighty = 0;
601
- oe.aConstraints.gridwidth = 2;
602
-
603
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
712
+ cGridBag copyOptionsPanel = new cGridBag();
713
+
714
+ copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
715
+ colorCB.setToolTipText("Copy color when dropped");
604716 colorCB.addItemListener(this);
605
- oe.aConstraints.gridx += 2;
606
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
717
+
718
+ copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
719
+ materialCB.setToolTipText("Copy material when dropped");
607720 materialCB.addItemListener(this);
608
- oe.aConstraints.gridx += 2;
609
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
721
+
722
+ copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
723
+ textureCB.setToolTipText("Copy texture when dropped");
610724 textureCB.addItemListener(this);
611725
612
- oe.aConstraints.gridx = 0;
613
- oe.aConstraints.gridy += 1;
726
+ copyOptionsPanel.preferredHeight = 1;
727
+ oe.treePanel.add(copyOptionsPanel);
728
+ oe.treePanel.Return();
614729
730
+// mainPanel.setDividerLocation(0.5); //1.0);
731
+// mainPanel.setResizeWeight(0.5);
732
+
615733 //jList.addListSelectionListener(this);
616734 oe.jTree.addTreeSelectionListener(this);
617735 //jTree.setRootVisible(false);
....@@ -633,20 +751,111 @@
633751 radio.layout = sevenButton;
634752 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
635753 }
754
+
755
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
756
+ {
757
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
758
+ boxCB.setToolTipText("Display bounding boxes");
759
+ boxCB.addItemListener(this);
760
+
761
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
+ zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
763
+ zoomBoxCB.addItemListener(this);
764
+
765
+ if (true) // Globals.ADVANCED)
766
+ {
767
+ panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
+ supportCB.setToolTipText("Enable rigging");
769
+ supportCB.addItemListener(this);
770
+
771
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
772
+ // localCB.addItemListener(this);
773
+
774
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
775
+ crowdCB.setToolTipText("Used for crowds");
776
+ crowdCB.addItemListener(this);
777
+
778
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
779
+ smoothCB.setToolTipText("Snapping delay");
780
+ smoothCB.addItemListener(this);
781
+
782
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
783
+ slowCB.setToolTipText("Smooth interpolation");
784
+ slowCB.addItemListener(this);
785
+
786
+// constraints.gridy += 1;
787
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
788
+// speakerMocapCB.addItemListener(this);
789
+
790
+ if (false)
791
+ {
792
+ // handled in scripts
793
+ //constraints.gridy += 1;
794
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
795
+ speakerCameraCB.addItemListener(this);
796
+
797
+ //constraints.gridy += 1;
798
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
799
+ speakerFocusCB.addItemListener(this);
800
+
801
+ //constraints.gridy += 1;
802
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
803
+ smoothfocusCB.addItemListener(this);
804
+ }
805
+
806
+//constraints.gridx += 1;
807
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
808
+// debugCB.addItemListener(this);
809
+
810
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
+ oeilCB.setToolTipText("Move camera when tracking target");
812
+ oeilCB.addItemListener(this);
813
+
814
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
+ shadowCB.setToolTipText("Compute shadows when live");
816
+ shadowCB.addItemListener(this);
817
+
818
+ if (Globals.ADVANCED)
819
+ {
820
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
821
+ lookAtCB.setToolTipText("Look-at target");
822
+ lookAtCB.addItemListener(this);
823
+ }
824
+
825
+ }
826
+
827
+ cGridBag fill = new cGridBag();
828
+
829
+ fill.preferredHeight = 200;
830
+
831
+ panel.add(fill);
832
+
833
+ }
636834
637835 void EditObject(Object3D obj)
638836 {
639
- cRadio dummyButton = new cRadio(obj.name);
640
- dummyButton.SetObject(obj);
641
- dummyButton.layout = sevenButton;
642
- dummyButton.SetCamera(cameraView.renderCamera, false);
643
- dummyButton.addActionListener(this);
644
- radioPanel.add(dummyButton);
645
- buttonGroup.add(dummyButton);
646
- dummyButton.doClick();
837
+ cRadio radioButton = new cRadio(obj.name);
838
+
839
+ // Patch to avoid bug with transparency.
840
+ radioButton.hadMaterial = obj.material != null;
841
+ if (!radioButton.hadMaterial)
842
+ {
843
+ obj.material = new cMaterial();
844
+ }
845
+
846
+ radioButton.SetObject(obj);
847
+ radioButton.layout = sevenButton;
848
+ radioButton.SetCamera(cameraView.renderCamera, false);
849
+ radioButton.addActionListener(this);
850
+ radioPanel.add(radioButton);
851
+ buttonGroup.add(radioButton);
852
+ radioButton.doClick();
647853 }
854
+
648855 void SetupViews(ObjEditor oe)
649856 {
857
+ theFrame = this;
858
+
650859 oe.SetupViews();
651860
652861 System.out.println("SetupViews");
....@@ -663,13 +872,16 @@
663872 JCheckBox fastCB;
664873 JCheckBox slowCB;
665874 JCheckBox boxCB;
875
+ JCheckBox zoomBoxCB;
666876 JCheckBox trackCB;
667877 JCheckBox smoothfocusCB;
668878 // JCheckBox speakerMocapCB;
669879 JCheckBox speakerCameraCB;
670880 JCheckBox speakerFocusCB;
671881 JCheckBox debugCB;
882
+
672883 JCheckBox oeilCB;
884
+ JCheckBox shadowCB;
673885 JCheckBox lookAtCB;
674886
675887 // static int COLOR = 1;
....@@ -705,10 +917,10 @@
705917 dropAttributes |= Object3D.TEXTURE;
706918 else
707919 dropAttributes &= ~Object3D.TEXTURE;
708
- }
709
- else if(e.getSource() == liveCB)
920
+ } else if(e.getSource() == liveCB)
710921 {
711922 cameraView.ToggleLive();
923
+ refreshContents(false);
712924 }
713925 else if(e.getSource() == supportCB)
714926 {
....@@ -744,6 +956,10 @@
744956 cameraView.repaint();
745957 // refreshContents();
746958 }
959
+ else if(e.getSource() == zoomBoxCB)
960
+ {
961
+ cameraView.ToggleZoomBoxMode();
962
+ }
747963 else if(e.getSource() == smoothfocusCB)
748964 {
749965 cameraView.ToggleSmoothFocus();
....@@ -768,6 +984,10 @@
768984 else if(e.getSource() == oeilCB)
769985 {
770986 cameraView.ToggleOeil();
987
+ }
988
+ else if(e.getSource() == shadowCB)
989
+ {
990
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
771991 }
772992 else if(e.getSource() == lookAtCB)
773993 {
....@@ -857,7 +1077,9 @@
8571077 // objEditor.DropFile((java.io.File[]) object, true);
8581078 // return;
8591079 // }
860
- if (string.charAt(0) == '/')
1080
+
1081
+ // File path for Mac and Windows
1082
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8611083 {
8621084 // file(s)
8631085 String[] names = string.split("\n");
....@@ -884,7 +1106,7 @@
8841106
8851107 flashIt = false;
8861108 CameraPane pane = (CameraPane) target;
887
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1109
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8881110 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8891111
8901112 if (group.selection.size() == 1)
....@@ -911,11 +1133,11 @@
9111133 {
9121134 loadClipboard(true);
9131135 objEditor.jTree.setSelectionPath(destinationPath);
914
- pasteInto(false);
1136
+ pasteInto(false, false);
9151137 } else {
9161138 loadClipboard(false);
9171139 objEditor.jTree.setSelectionPath(destinationPath);
918
- pasteInto(false); // true); // ???
1140
+ pasteInto(false, false); // true); // ???
9191141 }
9201142 }
9211143 public void dropActionChanged(DropTargetDragEvent dtde)
....@@ -1033,29 +1255,37 @@
10331255 torusItem.addActionListener(this);
10341256 superItem = menu.add(new MenuItem("Superellipsoid"));
10351257 superItem.addActionListener(this);
1258
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1259
+ kleinItem.addActionListener(this);
10361260 particleItem = menu.add(new MenuItem("Particle system"));
10371261 particleItem.addActionListener(this);
1262
+ if (Globals.ADVANCED)
1263
+ {
10381264 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10391265 ragdollItem.addActionListener(this);
10401266 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10411267 ragdoll2Item.addActionListener(this);
1268
+ }
10421269 menu.add("-");
1043
- meshItem = menu.add(new MenuItem("Mesh"));
1270
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10441271 meshItem.addActionListener(this);
10451272 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10461273 // meshGroupItem.addActionListener(this);
1274
+ if (Globals.ADVANCED)
1275
+ {
10471276 springItem = menu.add(new MenuItem("Spring"));
10481277 springItem.addActionListener(this);
10491278 flagItem = menu.add(new MenuItem("Flag"));
10501279 flagItem.addActionListener(this);
1051
- bezierItem = menu.add(new MenuItem("Patch"));
1052
- bezierItem.addActionListener(this);
1053
- checkerItem = menu.add(new MenuItem("Checker"));
1054
- checkerItem.addActionListener(this);
10551280 blobItem = menu.add(new MenuItem("Blob"));
10561281 blobItem.addActionListener(this);
10571282 latheItem = menu.add(new MenuItem("Lathe"));
10581283 latheItem.addActionListener(this);
1284
+ }
1285
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1286
+ bezierItem.addActionListener(this);
1287
+ overlayItem = menu.add(new MenuItem("Overlay"));
1288
+ overlayItem.addActionListener(this);
10591289 lightItem = menu.add(new MenuItem("Light"));
10601290 lightItem.addActionListener(this);
10611291 menu.add("-");
....@@ -1065,39 +1295,44 @@
10651295 loopItem.addActionListener(this);
10661296 doubleItem = menu.add(new MenuItem("Fork"));
10671297 doubleItem.addActionListener(this);
1298
+ if (Globals.ADVANCED)
1299
+ {
10681300 tripleItem = menu.add(new MenuItem("Trident"));
10691301 tripleItem.addActionListener(this);
1302
+ }
10701303 }
10711304
10721305 void buildToolsMenu(Menu menu)
10731306 {
10741307 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10751308 animationItem.addItemListener(this);
1076
- animationItem.setState(CameraPane.ANIMATION);
1309
+ animationItem.setState(Globals.ANIMATION);
10771310
10781311 menu.add("-");
10791312 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10801313 parseverticesItem.addActionListener(this);
10811314 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10821315 textureFieldItem.addActionListener(this);
1083
- alignItem = menu.add(new MenuItem("Align"));
1316
+ alignItem = menu.add(new MenuItem("Align Objects"));
10841317 alignItem.addActionListener(this);
1085
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1086
- mirrorItem.addActionListener(this);
10871318 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10881319 reduceMorphItem.addActionListener(this);
10891320 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10901321 reduce34MorphItem.addActionListener(this);
1091
-
1322
+ menu.add("-");
10921323 menu.add(computeAOItem = new MenuItem("Compute AO"));
10931324 computeAOItem.addActionListener(this);
1094
- menu.add("-");
10951325
1326
+ if (Globals.ADVANCED)
1327
+ {
1328
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1329
+ mirrorItem.addActionListener(this);
1330
+ menu.add("-");
10961331 menu.add(memoryItem = new MenuItem("Memory Usage"));
10971332 memoryItem.addActionListener(this);
10981333 menu.add(analyzeItem = new MenuItem("Analyze"));
10991334 analyzeItem.addActionListener(this);
1100
- menu.add(dumpItem = new MenuItem("Dump"));
1335
+ menu.add(dumpItem = new MenuItem("Print"));
11011336 dumpItem.addActionListener(this);
11021337 // menu.add(pathItem = new MenuItem("From-to path"));
11031338 // pathItem.addActionListener(this);
....@@ -1106,6 +1341,8 @@
11061341 resetParentItem.addActionListener(this);
11071342 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11081343 repairParentItem.addActionListener(this);
1344
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1345
+ repairShadowItem.addActionListener(this);
11091346 menu.add(invariantsItem = new MenuItem("Invariants"));
11101347 invariantsItem.addActionListener(this);
11111348 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1113,6 +1350,7 @@
11131350 menu.add("-");
11141351 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11151352 editScriptItem.addActionListener(this);
1353
+ }
11161354 }
11171355
11181356 void ScreenFit()
....@@ -1235,6 +1473,7 @@
12351473 shadow.material = new cMaterial(obj.material);
12361474 shadow.material.diffuse = 0.0001f;
12371475 shadow.material.specular = 0.0001f;
1476
+ //shadow.projectedVertices[1].x = 300;
12381477
12391478 makeSomething(shadow);
12401479 }
....@@ -1441,9 +1680,9 @@
14411680
14421681 void Overwrite(int mask)
14431682 {
1444
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1683
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14451684 {
1446
- Object3D content = GrafreeD.clipboard.get(0);
1685
+ Object3D content = Grafreed.clipboard.get(0);
14471686
14481687 if (content instanceof cGroup && ((cGroup)content).transientlink )
14491688 content = ((cGroup)content).get(0);
....@@ -1466,6 +1705,7 @@
14661705 //
14671706 public void actionPerformed(ActionEvent event) // , Object arg)
14681707 {
1708
+ Object source = event.getSource();
14691709 /*
14701710 if (event.getSource() == nameField)
14711711 {
....@@ -1477,11 +1717,11 @@
14771717 }
14781718 else
14791719 */
1480
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1720
+ if (source == lookAtItem || source == lookFromItem)
14811721 {
14821722 ScreenFit();
14831723 } else
1484
- if (event.getSource() == switchItem)
1724
+ if (source == switchItem)
14851725 {
14861726 cVector v1 = new cVector();
14871727 cVector v2 = new cVector();
....@@ -1490,11 +1730,11 @@
14901730 objEditor.cameraView.renderCamera.setAim(v2, v1);
14911731 objEditor.cameraView.repaint();
14921732 } else
1493
- if (event.getSource() == rectoidItem)
1733
+ if (source == rectoidItem)
14941734 {
14951735 makeSomething(new Box());
14961736 } else
1497
- if (event.getSource() == particleItem)
1737
+ if (source == particleItem)
14981738 {
14991739 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15001740 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1515,9 +1755,9 @@
15151755 applyExample(particleGeom, "SMOKE");
15161756 makeSomething(particleGeom);
15171757 } else
1518
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1758
+ if (source == ragdollItem || source == ragdoll2Item)
15191759 {
1520
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1760
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15211761
15221762 ragdoll.toParent = LA.newMatrix();
15231763 ragdoll.fromParent = LA.newMatrix();
....@@ -1535,7 +1775,7 @@
15351775 } else
15361776 /*
15371777 */
1538
- if (event.getSource() == heightFieldItem)
1778
+ if (source == heightFieldItem)
15391779 {
15401780 Object3D obj = new Object3D();
15411781
....@@ -1573,27 +1813,31 @@
15731813
15741814 makeSomething(obj);
15751815 } else
1576
- if (event.getSource() == gridItem)
1816
+ if (source == gridItem)
15771817 {
15781818 makeSomething(new Grid());
15791819 } else
1580
- if (event.getSource() == ellipsoidItem)
1820
+ if (source == ellipsoidItem)
15811821 {
15821822 makeSomething(new Sphere());
15831823 } else
1584
- if (event.getSource() == coneItem)
1824
+ if (source == coneItem)
15851825 {
15861826 makeSomething(new Cone());
15871827 } else
1588
- if (event.getSource() == torusItem)
1828
+ if (source == torusItem)
15891829 {
15901830 makeSomething(new Torus());
15911831 } else
1592
- if (event.getSource() == superItem)
1832
+ if (source == superItem)
15931833 {
15941834 makeSomething(new Superellipsoid());
15951835 } else
1596
- if (event.getSource() == blobItem)
1836
+ if (source == kleinItem)
1837
+ {
1838
+ makeSomething(new Klein());
1839
+ } else
1840
+ if (source == blobItem)
15971841 {
15981842 Blob blob = new Blob();
15991843 BlobComponent comp = new BlobComponent();
....@@ -1601,15 +1845,15 @@
16011845 //blob.retile();
16021846 makeSomething(blob);
16031847 } else
1604
- if (event.getSource() == latheItem)
1848
+ if (source == latheItem)
16051849 {
16061850 makeSomething(new Lathe());
16071851 } else
1608
- if (event.getSource() == bezierItem)
1852
+ if (source == bezierItem)
16091853 {
16101854 makeSomething(new BezierSurface());
16111855 } else
1612
- if (event.getSource() == checkerItem)
1856
+ if (source == overlayItem)
16131857 {
16141858 /*
16151859 Object3D obj = new BezierSurface(5,8);
....@@ -1624,7 +1868,7 @@
16241868 */
16251869 makeSomething(new Checker());
16261870 } else
1627
- if (event.getSource() == meshItem)
1871
+ if (source == meshItem)
16281872 {
16291873 Object3D itemtomake = new Object3D();
16301874 Object3D child;
....@@ -1645,35 +1889,35 @@
16451889 makeSomething(child);
16461890 }
16471891 } else
1648
- if (event.getSource() == springItem)
1892
+ if (source == springItem)
16491893 {
16501894 cSpring s = new cSpring();
16511895 s.setup();
16521896 makeSomething(s);
16531897 } else
1654
- if (event.getSource() == flagItem)
1898
+ if (source == flagItem)
16551899 {
16561900 cSpring s = new cFlag();
16571901 s.setup();
16581902 makeSomething(s);
16591903 } else
1660
- if (event.getSource() == lightItem)
1904
+ if (source == lightItem)
16611905 {
16621906 makeSomething(new Light());
16631907 } else
1664
- if (event.getSource() == csgItem)
1908
+ if (source == csgItem)
16651909 {
16661910 group(new CSG());
16671911 } else
1668
- if (event.getSource() == templateItem)
1912
+ if (source == templateItem)
16691913 {
16701914 group(new cTemplate());
16711915 } else
1672
- if (event.getSource() == attributeItem)
1916
+ if (source == attributeItem)
16731917 {
16741918 makeSomething(new Attribute());
16751919 } else
1676
- if (event.getSource() == pointflowItem)
1920
+ if (source == pointflowItem)
16771921 {
16781922 makeSomething(new PointFlow());
16791923 } else
....@@ -1685,7 +1929,7 @@
16851929 } else
16861930 */
16871931
1688
- if (event.getSource() == superLoopItem)
1932
+ if (source == superLoopItem)
16891933 {
16901934 Composite g = new cGroup();
16911935 for (int i=0; i<15; i++)
....@@ -1707,7 +1951,7 @@
17071951
17081952 group(g);
17091953 } else
1710
- if (event.getSource() == loopItem)
1954
+ if (source == loopItem)
17111955 {
17121956 Composite csg = new GroupLeaf();
17131957 csg.count = 5;
....@@ -1716,7 +1960,7 @@
17161960 csg.addChild(child);
17171961 child.addChild(csg);
17181962 } else
1719
- if (event.getSource() == doubleItem)
1963
+ if (source == doubleItem)
17201964 {
17211965 Composite csg = new GroupLeaf();
17221966 csg.count = 5;
....@@ -1728,7 +1972,7 @@
17281972 csg.addChild(child);
17291973 child.addChild(csg);
17301974 } else
1731
- if (event.getSource() == tripleItem)
1975
+ if (source == tripleItem)
17321976 {
17331977 Composite csg = new GroupLeaf();
17341978 csg.count = 4;
....@@ -1743,71 +1987,83 @@
17431987 csg.addChild(child);
17441988 child.addChild(csg);
17451989 } else
1746
-
1747
- if (event.getSource() == importGFDItem)
1990
+ if (source == computeAOItem)
17481991 {
1749
- ImportGFD();
1992
+ Globals.drawMode = CameraPane.OCCLUSION;
1993
+ Globals.theRenderer.repaint();
17501994 } else
1751
- if (event.getSource() == importVRMLX3DItem)
1752
- {
1753
- ImportVRMLX3D();
1754
- } else
1755
- if (event.getSource() == import3DSItem)
1756
- {
1757
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1758
- } else
1759
- if (event.getSource() == importOBJItem)
1760
- {
1761
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1762
- } else
1763
- if (event.getSource() == computeAOItem)
1764
- {
1765
- CameraPane.drawMode = CameraPane.OCCLUSION;
1766
- CameraPane.theRenderer.repaint();
1767
- } else
1768
- if (event.getSource() == recompileItem)
1995
+ if (source == recompileItem)
17691996 {
17701997 Recompile();
17711998 refreshContents();
17721999 } else
1773
- if (event.getSource() == editScriptItem)
2000
+ if (source == editScriptItem)
17742001 {
17752002 OpenDialog();
17762003 refreshContents();
17772004 } else
1778
- if (event.getSource() == invariantsItem)
2005
+ if (source == invariantsItem)
17792006 {
17802007 System.out.println("Invariants:");
1781
- GrafreeD.theApplet3D.universe.invariants();
2008
+ Grafreed.grafreeD.universe.invariants();
17822009 } else
1783
- if (event.getSource() == memoryItem)
2010
+ if (source == memoryItem)
17842011 {
17852012 //System.out.println("Invariants:");
17862013 PrintMemory();
17872014 } else
1788
- if (event.getSource() == pathItem)
2015
+ if (source == pathItem)
17892016 {
17902017 PrintPath();
17912018 } else
1792
- if (event.getSource() == analyzeItem)
2019
+ if (source == analyzeItem)
17932020 {
17942021 AnalyzeObject();
17952022 } else
1796
- if (event.getSource() == dumpItem)
2023
+ if (source == dumpItem)
17972024 {
17982025 DumpObject();
17992026 } else
1800
- if (event.getSource() == screenfitButton)
2027
+ if (source == minButton)
2028
+ {
2029
+ Minimize();
2030
+ } else
2031
+ if (source == maxButton)
2032
+ {
2033
+ Maximize();
2034
+ } else
2035
+ if (source == fullButton)
2036
+ {
2037
+ ToggleFullScreen();
2038
+ } else
2039
+ if (source == undoButton)
2040
+ {
2041
+ Undo();
2042
+ } else
2043
+ if (source == redoButton)
2044
+ {
2045
+ Redo();
2046
+ } else
2047
+ if (source == saveButton)
2048
+ {
2049
+ Save();
2050
+ } else
2051
+ if (source == oneStepButton)
2052
+ {
2053
+ Globals.ONESTEP = true;
2054
+ cameraView.repaint();
2055
+ } else
2056
+ if (source == screenfitButton)
18012057 {
18022058 //Reload(lastConverter, lastFilename, true);
18032059 ScreenFit();
18042060 } else
1805
- if (event.getSource() == screenfitpointButton)
2061
+ if (source == screenfitpointButton)
18062062 {
18072063 //Reload(lastConverter, lastFilename, true);
18082064 ScreenFitPoint();
18092065 } else
1810
- if (event.getSource() == snapobjectButton)
2066
+ if (source == snapobjectButton)
18112067 {
18122068 //Reload(lastConverter, lastFilename, true);
18132069 SnapObject();
....@@ -1818,13 +2074,13 @@
18182074 // Recompile();
18192075 // refreshContents();
18202076 // } else
1821
- if (event.getSource() == gcButton)
2077
+ if (source == gcButton)
18222078 {
18232079 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18242080 System.gc();
18252081 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262082 } else
1827
- if (event.getSource() == editLeafItem)
2083
+ if (source == editLeafItem)
18282084 {
18292085 Object3D obj;
18302086 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1838,62 +2094,74 @@
18382094 }
18392095 refreshContents(true);
18402096 } else
1841
- if (event.getSource() == openWindowItem)
2097
+ if (source == openWindowItem)
18422098 {
18432099 EditSelection(true);
18442100 } else
1845
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2101
+ if (source == cutItem || source == clearButton)
18462102 {
18472103 loadClipboard(true);
18482104 } else
1849
- if (event.getSource() == duplicateItem)
2105
+ if (source == undoItem)
18502106 {
1851
- Object3D keep = GrafreeD.clipboard;
2107
+ Undo();
2108
+ } else
2109
+ if (source == redoItem)
2110
+ {
2111
+ Redo();
2112
+ } else
2113
+ if (source == duplicateItem)
2114
+ {
2115
+ Object3D keep = Grafreed.clipboard;
18522116 loadClipboard(false);
18532117 paste(false);
1854
- GrafreeD.clipboard = keep;
2118
+ Grafreed.clipboard = keep;
18552119 } else
1856
- if (event.getSource() == cloneItem)
2120
+ if (source == cloneItem)
18572121 {
18582122 CloneSelection(false);
18592123 } else
1860
- if (event.getSource() == cloneSupportItem)
2124
+ if (source == cloneSupportItem)
18612125 {
18622126 CloneSelection(true);
18632127 } else
1864
- if (event.getSource() == copyItem)
2128
+ if (source == copyItem)
18652129 {
18662130 loadClipboard(false);
18672131 } else
1868
- if (event.getSource() == pasteItem)
2132
+ if (source == pasteItem)
18692133 {
18702134 paste(false);
18712135 } else
1872
- if (event.getSource() == pasteLinkItem)
2136
+ if (source == pasteIntoItem)
18732137 {
1874
- pasteInto(false);
2138
+ pasteInto(true, false);
18752139 } else
1876
- if (event.getSource() == pasteCloneItem)
2140
+ if (source == pasteLinkItem)
18772141 {
1878
- pasteInto(true);
2142
+ pasteInto(false, false);
18792143 } else
1880
- if (event.getSource() == pasteExpandItem)
2144
+ if (source == pasteCloneItem)
2145
+ {
2146
+ pasteInto(true, true);
2147
+ } else
2148
+ if (source == pasteExpandItem)
18812149 {
18822150 paste(true);
18832151 } else
1884
- if (event.getSource() == synchronizeItem)
2152
+ if (source == synchronizeItem)
18852153 {
18862154 Overwrite(Object3D.TRANSFORM);
18872155 } else
1888
- if (event.getSource() == overwriteNameItem)
2156
+ if (source == overwriteNameItem)
18892157 {
18902158 Overwrite(Object3D.NAME);
18912159 } else
1892
- if (event.getSource() == overwriteUVItem)
2160
+ if (source == overwriteUVItem)
18932161 {
18942162 Overwrite(Object3D.UV);
18952163 } else
1896
- if (event.getSource() == overwriteMatItem)
2164
+ if (source == overwriteMatItem)
18972165 {
18982166 /* july 2015
18992167 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1913,7 +2181,7 @@
19132181
19142182 Overwrite(dropAttributes);
19152183 }
1916
- if (event.getSource() == overwriteGeoItem)
2184
+ if (source == overwriteGeoItem)
19172185 {
19182186 Overwrite(Object3D.GEOMETRY);
19192187 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1930,7 +2198,7 @@
19302198 // refreshContents();
19312199 // }
19322200 } else
1933
- if (event.getSource() == generateMeshItem)
2201
+ if (source == generateMeshItem)
19342202 {
19352203 //if (group.selection.size() == 1)
19362204 // for (int i=0; i<group.selection.size(); i++)
....@@ -1941,7 +2209,7 @@
19412209 ResetModel();
19422210 refreshContents();
19432211 } else
1944
- if (event.getSource() == extractGeometriesItem)
2212
+ if (source == extractGeometriesItem)
19452213 {
19462214 boolean one = false;
19472215
....@@ -1968,7 +2236,7 @@
19682236 ResetModel();
19692237 refreshContents();
19702238 } else
1971
- if (event.getSource() == cloneGeometriesItem)
2239
+ if (source == cloneGeometriesItem)
19722240 {
19732241 boolean one = false;
19742242
....@@ -1994,32 +2262,37 @@
19942262 ResetModel();
19952263 refreshContents();
19962264 } else
1997
- if (event.getSource() == shareGeometriesItem)
2265
+ if (source == shareGeometriesItem)
19982266 {
19992267 boolean one = false;
20002268
20012269 if (group.selection.size() == 1)
20022270 one = true;
20032271
2272
+ Object3D merge = null;
2273
+
20042274 Object3D content = new cGroup();
20052275
20062276 for (int i=0; i<group.selection.size(); i++)
20072277 {
2008
- Object3D sel = new Merge(group.selection.get(i));
2278
+ merge = new Merge(group.selection.get(i));
20092279
20102280 if (one)
2011
- makeSomething(sel, false);
2281
+ makeSomething(merge, false);
20122282 else
2013
- content.addChild(sel);
2283
+ content.addChild(merge);
20142284 }
20152285
20162286 if (!one)
2017
- makeSomething(content, false);
2018
-
2019
- ResetModel();
2020
- refreshContents();
2287
+ makeSomething(content, true);
2288
+ else
2289
+ {
2290
+ ResetModel();
2291
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2292
+ refreshContents();
2293
+ }
20212294 } else
2022
- if (event.getSource() == mergeGeometriesItem)
2295
+ if (source == mergeGeometriesItem)
20232296 {
20242297 boolean one = false;
20252298
....@@ -2049,7 +2322,7 @@
20492322 ResetModel();
20502323 refreshContents();
20512324 } else
2052
- if (event.getSource() == linkverticesItem)
2325
+ if (source == linkverticesItem)
20532326 {
20542327 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20552328 // {
....@@ -2062,39 +2335,48 @@
20622335 // group.selection.get(0).setMasterThis(content); // should be identity
20632336 // refreshContents();
20642337 // }
2065
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2338
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20662339 {
2067
- Object3D content = GrafreeD.clipboard.get(0);
2340
+ Object3D content = Grafreed.clipboard.get(0);
20682341
20692342 if (content instanceof cGroup && ((cGroup)content).transientlink )
20702343 content = ((cGroup)content).get(0);
20712344
2072
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2345
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20732346 for (int i=0; i<group.selection.size(); i++)
20742347 {
2075
- boolean random = CameraPane.RANDOM;
2076
- CameraPane.RANDOM = false; // parse all random nodes
2348
+ boolean random = CameraPane.SWITCH;
2349
+ CameraPane.SWITCH = false; // parse all random nodes
20772350 group.selection.get(i).linkVerticesThis(content);
20782351 // group.selection.get(i).setMasterThis(content); // should be identity
2079
- CameraPane.RANDOM = random;
2352
+ CameraPane.SWITCH = random;
20802353 }
2081
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2354
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20822355 refreshContents();
20832356 }
20842357 } else
2085
- if (event.getSource() == resetsupportItem)
2358
+ if (source == resetsupportItem)
20862359 {
20872360 for (int i=0; i<group.selection.size(); i++)
20882361 {
2089
- boolean random = CameraPane.RANDOM;
2090
- CameraPane.RANDOM = false; // parse all random nodes
2362
+ boolean random = CameraPane.SWITCH;
2363
+ CameraPane.SWITCH = false; // parse all random nodes
20912364 group.selection.get(i).linkVerticesThis(null);
2092
- CameraPane.RANDOM = random;
2365
+ CameraPane.SWITCH = random;
20932366 }
20942367
20952368 refreshContents();
20962369 } else
2097
- if (event.getSource() == resetreferencesItem)
2370
+ if (source == relinkverticesItem)
2371
+ {
2372
+ boolean random = CameraPane.SWITCH;
2373
+ CameraPane.SWITCH = false; // parse all random nodes
2374
+ group.selection.RelinkToSupport();
2375
+ CameraPane.SWITCH = random;
2376
+
2377
+ refreshContents();
2378
+ } else
2379
+ if (source == resetreferencesItem)
20982380 {
20992381 for (int i=0; i<group.selection.size(); i++)
21002382 {
....@@ -2103,11 +2385,11 @@
21032385
21042386 refreshContents();
21052387 } else
2106
- if (event.getSource() == setMasterItem)
2388
+ if (source == setMasterItem)
21072389 {
2108
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2390
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21092391 {
2110
- Object3D content = GrafreeD.clipboard.get(0);
2392
+ Object3D content = Grafreed.clipboard.get(0);
21112393
21122394 if (content instanceof cGroup && ((cGroup)content).transientlink )
21132395 content = ((cGroup)content).get(0);
....@@ -2116,13 +2398,13 @@
21162398 refreshContents();
21172399 }
21182400 } else
2119
- if (event.getSource() == poseMeshItem)
2401
+ if (source == poseMeshItem)
21202402 {
21212403 if (group.selection.size() == 1)
21222404 {
2123
- if (GrafreeD.clipboard.size() == 1)
2405
+ if (Grafreed.clipboard.size() == 1)
21242406 {
2125
- Object3D content = GrafreeD.clipboard.get(0);
2407
+ Object3D content = Grafreed.clipboard.get(0);
21262408
21272409 if (content instanceof cGroup && ((cGroup)content).transientlink )
21282410 content = ((cGroup)content).get(0);
....@@ -2135,19 +2417,19 @@
21352417 }
21362418
21372419 } else
2138
- if (event.getSource() == revertMeshItem)
2420
+ if (source == revertMeshItem)
21392421 {
21402422 RevertMeshes();
21412423 } else
2142
- if (event.getSource() == resetMeshItem)
2424
+ if (source == resetAllItem)
21432425 {
21442426 ResetAll();
21452427 } else
2146
- if (event.getSource() == stepAllItem)
2428
+ if (source == stepAllItem)
21472429 {
21482430 StepAll();
21492431 } else
2150
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2432
+ if (source == clearItem) // || event.getSource() == clearButton)
21512433 {
21522434 //int indices[] = jList.getSelectedIndices();
21532435 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2155,42 +2437,46 @@
21552437
21562438 ClearSelection(false);
21572439 } else
2158
- if (event.getSource() == clearAllItem)
2440
+ if (source == clearAllItem)
21592441 {
21602442 ClearSelection(true);
21612443 } else
2162
- if (event.getSource() == grabItem)
2444
+ if (source == grabItem)
21632445 {
21642446 group(new cGroup(), true);
21652447 } else
2166
- if (event.getSource() == frontItem)
2448
+ if (source == hideItem)
2449
+ {
2450
+ group(new HiddenObject());
2451
+ } else
2452
+ if (source == frontItem)
21672453 {
21682454 front();
21692455 } else
2170
- if (event.getSource() == backItem)
2456
+ if (source == backItem)
21712457 {
21722458 back();
21732459 } else
2174
- if (event.getSource() == cameraItem)
2460
+ if (source == cameraItem)
21752461 {
21762462 makeSomething(new Camera());
21772463 } else
2178
- if (event.getSource() == compositeItem)
2464
+ if (source == compositeItem)
21792465 {
21802466 group(new Composite());
21812467 } else
2182
- if (event.getSource() == randomItem)
2468
+ if (source == randomItem)
21832469 {
21842470 RandomNode random = new RandomNode();
21852471 group(random);
21862472 if (random.size() > 0)
2187
- random.name = random.get(0).name + "Rnd";
2473
+ random.name = random.get(0).name + "Switch";
21882474 } else
2189
- if (event.getSource() == physicsItem)
2475
+ if (source == physicsItem)
21902476 {
21912477 group(new PhysicsNode());
21922478 } else
2193
- if (event.getSource() == frameselectorItem)
2479
+ if (source == frameselectorItem)
21942480 {
21952481 for (int i=0; i<group.selection.size(); i++)
21962482 {
....@@ -2202,7 +2488,7 @@
22022488 ResetModel();
22032489 refreshContents();
22042490 } else
2205
- if (event.getSource() == switchGeoItem)
2491
+ if (source == switchGeoItem)
22062492 {
22072493 for (int i=0; i<group.selection.size(); i++)
22082494 {
....@@ -2214,7 +2500,7 @@
22142500 ResetModel();
22152501 refreshContents();
22162502 } else
2217
- if (event.getSource() == switchTransfoItem)
2503
+ if (source == switchTransfoItem)
22182504 {
22192505 for (int i=0; i<group.selection.size(); i++)
22202506 {
....@@ -2226,7 +2512,7 @@
22262512 ResetModel();
22272513 refreshContents();
22282514 } else
2229
- if (event.getSource() == morphItem)
2515
+ if (source == morphItem)
22302516 {
22312517 for (int i=0; i<group.selection.size(); i++)
22322518 {
....@@ -2238,7 +2524,7 @@
22382524 ResetModel();
22392525 refreshContents();
22402526 } else
2241
- if (event.getSource() == scriptNodeItem)
2527
+ if (source == scriptNodeItem)
22422528 {
22432529 boolean atleastone = false;
22442530
....@@ -2277,195 +2563,239 @@
22772563 }
22782564 }
22792565 } else
2280
- if (event.getSource() == linkerItem)
2566
+ if (source == linkerItem)
22812567 {
22822568 group(new cLinker());
22832569 } else
2284
- if (event.getSource() == textureItem)
2570
+ if (source == textureItem)
22852571 {
22862572 group(new TextureNode());
22872573 } else
2288
- if (event.getSource() == shadowXItem)
2574
+ if (source == billboardItem)
2575
+ {
2576
+ group(new BillboardNode());
2577
+ } else
2578
+ if (source == shadowXItem)
22892579 {
22902580 CastShadow(0);
22912581 } else
2292
- if (event.getSource() == shadowYItem)
2582
+ if (source == shadowYItem)
22932583 {
22942584 CastShadow(1);
22952585 } else
2296
- if (event.getSource() == shadowZItem)
2586
+ if (source == shadowZItem)
22972587 {
22982588 CastShadow(2);
22992589 } else
2300
- if (event.getSource() == ungroupItem)
2590
+ if (source == ungroupItem)
23012591 {
2302
- ungroup();
2592
+ //ungroup();
2593
+ for (int i=0; i<group.selection.size(); i++)
2594
+ {
2595
+ Ungroup(group.selection.get(i));
2596
+ }
2597
+
2598
+ ClearSelection(false);
2599
+
2600
+ refreshContents();
23032601 } else
2304
- if (event.getSource() == genUVItem)
2602
+ if (source == genUVItem)
23052603 {
23062604 GenUV();
23072605 } else
2308
- if (event.getSource() == genNormalsCADItem)
2606
+ if (source == genNormalsCADItem)
23092607 {
23102608 GenNormals(true);
23112609 } else
2312
- if (event.getSource() == genNormalsORGANItem)
2610
+ if (source == genNormalsMESHItem)
2611
+ {
2612
+ GenNormalsMESH();
2613
+ } else
2614
+ if (source == genNormalsORGANItem)
23132615 {
23142616 GenNormals(false);
23152617 } else
2316
- if (event.getSource() == stripifyItem)
2618
+ if (source == genNormalsMINEItem)
2619
+ {
2620
+ GenNormalsMINE();
2621
+ } else
2622
+ if (source == stripifyItem)
23172623 {
23182624 Stripify();
23192625 } else
2320
- if (event.getSource() == unstripifyItem)
2626
+ if (source == unstripifyItem)
23212627 {
23222628 Unstripify();
23232629 } else
2324
- if (event.getSource() == trimItem)
2630
+ if (source == trimItem)
23252631 {
23262632 Trim();
23272633 } else
2328
- if (event.getSource() == untrimItem)
2634
+ if (source == untrimItem)
23292635 {
23302636 Untrim();
23312637 } else
2332
- if (event.getSource() == clearColorsItem)
2638
+ if (source == clearColorsItem)
23332639 {
23342640 ClearColors();
23352641 } else
2336
- if (event.getSource() == clearMaterialsItem)
2642
+ if (source == clearMaterialsItem)
23372643 {
23382644 ClearMaterials();
23392645 } else
2340
- if (event.getSource() == liveleavesItem)
2646
+ if (source == liveleavesItem)
23412647 {
23422648 LiveLeaves(true);
23432649 } else
2344
- if (event.getSource() == unliveleavesItem)
2650
+ if (source == unliveleavesItem)
23452651 {
23462652 LiveLeaves(false);
23472653 } else
2348
- if (event.getSource() == supportleavesItem)
2654
+ if (source == supportleavesItem)
23492655 {
23502656 SupportLeaves(true);
23512657 } else
2352
- if (event.getSource() == unsupportleavesItem)
2658
+ if (source == unsupportleavesItem)
23532659 {
23542660 SupportLeaves(false);
23552661 } else
2356
- if (event.getSource() == hideleavesItem)
2662
+ if (source == hideleavesItem)
23572663 {
23582664 HideLeaves(true);
23592665 } else
2360
- if (event.getSource() == showleavesItem)
2666
+ if (source == showleavesItem)
23612667 {
23622668 HideLeaves(false);
23632669 } else
2364
- if (event.getSource() == markleavesItem)
2670
+ if (source == markleavesItem)
23652671 {
23662672 MarkLeaves(true);
23672673 } else
2368
- if (event.getSource() == unmarkleavesItem)
2674
+ if (source == unmarkleavesItem)
23692675 {
23702676 MarkLeaves(false);
23712677 } else
2372
- if (event.getSource() == flipVItem)
2678
+ if (source == rewindleavesItem)
2679
+ {
2680
+ RewindLeaves(true);
2681
+ } else
2682
+ if (source == unrewindleavesItem)
2683
+ {
2684
+ RewindLeaves(false);
2685
+ } else
2686
+ if (source == randomleavesItem)
2687
+ {
2688
+ RandomLeaves(true);
2689
+ } else
2690
+ if (source == unrandomleavesItem)
2691
+ {
2692
+ RandomLeaves(false);
2693
+ } else
2694
+ if (source == flipVItem)
23732695 {
23742696 FlipV(true);
23752697 } else
2376
- if (event.getSource() == unflipVItem)
2698
+ if (source == unflipVItem)
23772699 {
23782700 FlipV(false);
23792701 } else
2380
- if (event.getSource() == lowTexturesItem)
2702
+ if (source == lowTexturesItem)
23812703 {
23822704 SetTexRes(0);
23832705 } else
2384
- if (event.getSource() == normalTexturesItem)
2706
+ if (source == normalTexturesItem)
23852707 {
23862708 SetTexRes(1);
23872709 } else
2388
- if (event.getSource() == highTexturesItem)
2710
+ if (source == highTexturesItem)
23892711 {
23902712 SetTexRes(2);
23912713 } else
2392
- if (event.getSource() == veryhighTexturesItem)
2714
+ if (source == veryhighTexturesItem)
23932715 {
23942716 SetTexRes(3);
23952717 } else
2396
- if (event.getSource() == maxTexturesItem)
2718
+ if (source == maxTexturesItem)
23972719 {
23982720 SetTexRes(4);
23992721 } else
2400
- if (event.getSource() == panoTexturesItem)
2722
+ if (source == panoTexturesItem)
24012723 {
24022724 SetTexRes(5);
24032725 } else
2404
- if (event.getSource() == reverseNormalsItem)
2726
+ if (source == reverseNormalsItem)
24052727 {
24062728 ReverseNormals();
24072729 } else
2408
- if (event.getSource() == parseverticesItem)
2730
+ if (source == parseverticesItem)
24092731 {
24102732 ParseVertices();
24112733 } else
2412
- if (event.getSource() == textureFieldItem)
2734
+ if (source == textureFieldItem)
24132735 {
24142736 TextureVertices();
24152737 } else
2416
- if (event.getSource() == alignItem)
2738
+ if (source == alignItem)
24172739 {
24182740 Align();
24192741 } else
2420
- if (event.getSource() == mirrorItem)
2742
+ if (source == mirrorItem)
24212743 {
24222744 MirrorPoses();
24232745 } else
2424
- if (event.getSource() == reduceMorphItem)
2746
+ if (source == reduceMorphItem)
24252747 {
24262748 MeshReduction(false);
24272749 } else
2428
- if (event.getSource() == reduce34MorphItem)
2750
+ if (source == reduce34MorphItem)
24292751 {
24302752 MeshReduction(true);
24312753 } else
2432
- if (event.getSource() == reverseTrianglesItem)
2754
+ if (source == reverseTrianglesItem)
24332755 {
24342756 ReverseTriangles();
24352757 } else
2436
- if (event.getSource() == reduceMeshItem)
2758
+ if (source == reduceMeshItem)
24372759 {
24382760 ReduceMesh(false);
24392761 } else
2440
- if (event.getSource() == reduce34MeshItem)
2762
+ if (source == reduce34MeshItem)
24412763 {
24422764 ReduceMesh(true);
24432765 } else
2444
- if (event.getSource() == increaseMeshItem)
2766
+ if (source == increaseMeshItem)
24452767 {
24462768 IncreaseMesh();
24472769 } else
2448
- if (event.getSource() == clipMeshItem)
2770
+ if (source == clipMeshItem)
24492771 {
24502772 ClipMesh();
24512773 } else
2452
- if (event.getSource() == smoothMeshItem)
2774
+ if (source == smoothMeshItem)
24532775 {
24542776 SmoothMesh();
24552777 } else
2456
- if (event.getSource() == transformgeometryItem)
2778
+ if (source == transformGeometryItem)
24572779 {
24582780 TransformGeometry();
24592781 } else
2460
- if (event.getSource() == resetTransformItem)
2782
+ if (source == transformChildrenItem)
2783
+ {
2784
+ TransformChildren();
2785
+ } else
2786
+ if (source == resetTransformItem)
24612787 {
24622788 ResetTransform();
24632789 } else
2464
- if (event.getSource() == resetCentroidItem)
2790
+ if (source == resetCentroidItem)
24652791 {
2466
- ResetCentroid();
2792
+ ResetCentroid(true);
24672793 } else
2468
- if (event.getSource() == resetParentItem)
2794
+ if (source == resetCentroidXZItem)
2795
+ {
2796
+ ResetCentroid(false);
2797
+ } else
2798
+ if (source == resetParentItem)
24692799 {
24702800 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24712801 {
....@@ -2475,7 +2805,7 @@
24752805
24762806 refreshContents();
24772807 } else
2478
- if (event.getSource() == repairParentItem)
2808
+ if (source == repairParentItem)
24792809 {
24802810 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24812811 {
....@@ -2489,7 +2819,21 @@
24892819
24902820 refreshContents();
24912821 } else
2492
- if (event.getSource() == sortbysizeItem)
2822
+ if (source == repairShadowItem)
2823
+ {
2824
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
2825
+ {
2826
+ Object3D obj = (Object3D)e.nextElement();
2827
+ obj.RepairShadow();
2828
+// for (int i=0; i<obj.size(); i++)
2829
+// {
2830
+// obj.get(i).parent = obj;
2831
+// }
2832
+ }
2833
+
2834
+ refreshContents();
2835
+ } else
2836
+ if (source == sortbysizeItem)
24932837 {
24942838 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24952839 {
....@@ -2501,7 +2845,7 @@
25012845 ResetModel();
25022846 refreshContents();
25032847 } else
2504
- if (event.getSource() == sortbynameItem)
2848
+ if (source == sortbynameItem)
25052849 {
25062850 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25072851 {
....@@ -2513,7 +2857,7 @@
25132857 ResetModel();
25142858 refreshContents();
25152859 } else
2516
- if (event.getSource() == attachPigmentItem)
2860
+ if (source == attachPigmentItem)
25172861 {
25182862 String texture = GetFile("Attach pigment");
25192863 Object3D obj;
....@@ -2525,7 +2869,7 @@
25252869
25262870 refreshContents();
25272871 } else
2528
- if (event.getSource() == detachPigmentItem)
2872
+ if (source == detachPigmentItem)
25292873 {
25302874 Object3D obj;
25312875 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2536,7 +2880,7 @@
25362880
25372881 refreshContents();
25382882 } else
2539
- if (event.getSource() == attachBumpItem)
2883
+ if (source == attachBumpItem)
25402884 {
25412885 String texture = GetFile("Attach bump");
25422886 Object3D obj;
....@@ -2548,7 +2892,7 @@
25482892
25492893 refreshContents();
25502894 } else
2551
- if (event.getSource() == detachBumpItem)
2895
+ if (source == detachBumpItem)
25522896 {
25532897 Object3D obj;
25542898 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2559,7 +2903,7 @@
25592903
25602904 refreshContents();
25612905 } else
2562
- if (event.getSource() == pigmentBumpItem)
2906
+ if (source == pigmentBumpItem)
25632907 {
25642908 Object3D obj;
25652909 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2570,158 +2914,221 @@
25702914
25712915 refreshContents();
25722916 } else
2573
- if (event.getSource() == flashSelectionButton)
2917
+ if (source == flashSelectionButton)
25742918 {
25752919 CameraPane.flash = true;
25762920 refreshContents();
25772921 } else
2578
- if (event.getSource() == oneButton)
2922
+ if (source == oneButton)
25792923 {
25802924 } else
2581
- if (event.getSource() == twoButton)
2925
+ if (source == twoButton)
25822926 {
25832927 radio.layout = twoButton;
25842928 // bug
25852929 //gridPanel.setDividerLocation(1.0);
25862930 //bigPanel.setDividerLocation(0.0);
2587
- bigThree.remove(jtp);
2588
- bigThree.remove(cameraPanel);
2589
- bigThree.remove(XYZPanel);
2590
- aWindowConstraints.gridx = 0;
2591
- aWindowConstraints.gridy = 0;
2592
- aWindowConstraints.gridwidth = 1;
2593
- // aConstraints.gridheight = 3;
2594
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2595
- aWindowConstraints.weightx = 0;
2596
- aWindowConstraints.weighty = 1;
2597
- //bigThree.add(jtp, aWindowConstraints);
2598
- aWindowConstraints.weightx = 1;
2599
- aWindowConstraints.gridwidth = 3;
2600
- // aConstraints.gridheight = 3;
2601
- aWindowConstraints.gridx = 1;
2602
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2603
- bigThree.add(cameraPanel, aWindowConstraints);
2604
- aWindowConstraints.weightx = 0;
2605
- aWindowConstraints.gridx = 4;
2606
- aWindowConstraints.gridwidth = 1;
2607
- // aConstraints.gridheight = 3;
2608
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2609
- //bigThree.add(XYZPanel, aWindowConstraints);
2610
- bigThree.revalidate();
2931
+// bigThree.remove(scenePanel);
2932
+// bigThree.remove(centralPanel);
2933
+// bigThree.remove(XYZPanel);
2934
+// aWindowConstraints.gridx = 0;
2935
+// aWindowConstraints.gridy = 0;
2936
+// aWindowConstraints.gridwidth = 1;
2937
+// // aConstraints.gridheight = 3;
2938
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2939
+// aWindowConstraints.weightx = 0;
2940
+// aWindowConstraints.weighty = 1;
2941
+// //bigThree.add(jtp, aWindowConstraints);
2942
+// aWindowConstraints.weightx = 1;
2943
+// aWindowConstraints.gridwidth = 3;
2944
+// // aConstraints.gridheight = 3;
2945
+// aWindowConstraints.gridx = 1;
2946
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2947
+// bigThree.add(centralPanel, aWindowConstraints);
2948
+// aWindowConstraints.weightx = 0;
2949
+// aWindowConstraints.gridx = 4;
2950
+// aWindowConstraints.gridwidth = 1;
2951
+// // aConstraints.gridheight = 3;
2952
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2953
+// //bigThree.add(XYZPanel, aWindowConstraints);
2954
+// scenePanel.setVisible(false);
2955
+// centralPanel.setVisible(true);
2956
+// XYZPanel.setVisible(false);
2957
+ bigThree.ClearUI();
2958
+ bigThree.add(centralPanel);
2959
+ bigThree.FlushUI();
2960
+
2961
+ cameraView.requestFocusInWindow();
2962
+
2963
+// refreshContents(true);
2964
+//
2965
+// try
2966
+// {
2967
+// java.awt.Robot bot = new java.awt.Robot();
2968
+// int mask = InputEvent.BUTTON1_MASK;
2969
+// bot.mouseMove(100, 100);
2970
+// bot.mousePress(mask);
2971
+// bot.mouseRelease(mask);
2972
+// }
2973
+// catch (Exception e)
2974
+// {
2975
+//
2976
+// }
2977
+
26112978 } else
2612
- if (event.getSource() == threeButton)
2979
+ if (source == threeButton)
26132980 {
26142981 radio.layout = threeButton;
2615
- bigThree.remove(jtp);
2616
- bigThree.remove(cameraPanel);
2617
- bigThree.remove(XYZPanel);
2618
- aWindowConstraints.gridx = 0;
2619
- aWindowConstraints.gridy = 0;
2620
- aWindowConstraints.gridwidth = 1;
2621
- // aConstraints.gridheight = 3;
2622
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2623
- aWindowConstraints.weightx = 0;
2624
- aWindowConstraints.weighty = 1;
2625
- //bigThree.add(jtp, aWindowConstraints);
2626
- aWindowConstraints.weightx = 1;
2627
- aWindowConstraints.gridwidth = 3;
2628
- // aConstraints.gridheight = 3;
2629
- aWindowConstraints.gridx = 1;
2630
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2631
- bigThree.add(cameraPanel, aWindowConstraints);
2632
- aWindowConstraints.weightx = 0;
2633
- aWindowConstraints.gridx = 4;
2634
- aWindowConstraints.gridwidth = 1;
2635
- // aConstraints.gridheight = 3;
2636
- aConstraints.fill = GridBagConstraints.VERTICAL;
2637
- bigThree.add(XYZPanel, aWindowConstraints);
2638
- bigThree.revalidate();
2982
+
2983
+// bigThree.remove(scenePanel);
2984
+// bigThree.remove(centralPanel);
2985
+// bigThree.remove(XYZPanel);
2986
+// aWindowConstraints.gridx = 0;
2987
+// aWindowConstraints.gridy = 0;
2988
+// aWindowConstraints.gridwidth = 1;
2989
+// // aConstraints.gridheight = 3;
2990
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2991
+// aWindowConstraints.weightx = 0;
2992
+// aWindowConstraints.weighty = 1;
2993
+// //bigThree.add(jtp, aWindowConstraints);
2994
+// aWindowConstraints.weightx = 1;
2995
+// aWindowConstraints.gridwidth = 3;
2996
+// // aConstraints.gridheight = 3;
2997
+// aWindowConstraints.gridx = 1;
2998
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2999
+// bigThree.add(centralPanel, aWindowConstraints);
3000
+// aWindowConstraints.weightx = 0;
3001
+// aWindowConstraints.gridx = 4;
3002
+// aWindowConstraints.gridwidth = 1;
3003
+// // aConstraints.gridheight = 3;
3004
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3005
+// bigThree.add(XYZPanel, aWindowConstraints);
3006
+// bigThree.validate();
3007
+// scenePanel.setVisible(false);
3008
+// centralPanel.setVisible(true);
3009
+// XYZPanel.setVisible(true);
3010
+ bigThree.ClearUI();
3011
+ bigThree.add(centralPanel);
3012
+ bigThree.add(XYZPanel);
3013
+ bigThree.FlushUI();
3014
+
3015
+ cameraView.requestFocusInWindow();
26393016 } else
2640
- if (event.getSource() == fourButton)
3017
+ if (source == fourButton)
26413018 {
26423019 radio.layout = fourButton;
2643
- bigThree.remove(jtp);
2644
- bigThree.remove(cameraPanel);
2645
- bigThree.remove(XYZPanel);
2646
- aWindowConstraints.gridx = 0;
2647
- aWindowConstraints.gridy = 0;
2648
- aWindowConstraints.gridwidth = 1;
2649
- // aWindowConstraints.gridheight = 3;
2650
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2651
- aWindowConstraints.weightx = 1;
2652
- aWindowConstraints.weighty = 1;
2653
- bigThree.add(jtp, aWindowConstraints);
2654
- aWindowConstraints.weightx = 1;
2655
- aWindowConstraints.gridwidth = 3;
2656
- // aConstraints.gridheight = 3;
2657
- aWindowConstraints.gridx = 1;
2658
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2659
- //bigThree.add(cameraPanel, aWindowConstraints);
2660
- aWindowConstraints.weightx = 0;
2661
- aWindowConstraints.gridx = 4;
2662
- aWindowConstraints.gridwidth = 1;
2663
- // aWindowConstraints.gridheight = 3;
2664
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2665
- //bigThree.add(XYZPanel, aWindowConstraints);
2666
- bigThree.revalidate();
3020
+
3021
+// bigThree.remove(scenePanel);
3022
+// bigThree.remove(centralPanel);
3023
+// bigThree.remove(XYZPanel);
3024
+// aWindowConstraints.gridx = 0;
3025
+// aWindowConstraints.gridy = 0;
3026
+// aWindowConstraints.gridwidth = 1;
3027
+// // aWindowConstraints.gridheight = 3;
3028
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3029
+// aWindowConstraints.weightx = 1;
3030
+// aWindowConstraints.weighty = 1;
3031
+// bigThree.add(scenePanel, aWindowConstraints);
3032
+// aWindowConstraints.weightx = 1;
3033
+// aWindowConstraints.gridwidth = 3;
3034
+// // aConstraints.gridheight = 3;
3035
+// aWindowConstraints.gridx = 1;
3036
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3037
+// //bigThree.add(cameraPanel, aWindowConstraints);
3038
+// aWindowConstraints.weightx = 0;
3039
+// aWindowConstraints.gridx = 4;
3040
+// aWindowConstraints.gridwidth = 1;
3041
+// // aWindowConstraints.gridheight = 3;
3042
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3043
+// //bigThree.add(XYZPanel, aWindowConstraints);
3044
+// bigThree.validate();
3045
+// scenePanel.setVisible(true);
3046
+// centralPanel.setVisible(false);
3047
+// XYZPanel.setVisible(false);
3048
+ bigThree.ClearUI();
3049
+ bigThree.add(scenePanel);
3050
+ bigThree.FlushUI();
3051
+
3052
+ cameraView.requestFocusInWindow();
26673053 } else
2668
- if (event.getSource() == sixButton)
3054
+ if (source == sixButton)
26693055 {
26703056 radio.layout = sixButton;
2671
- bigThree.remove(jtp);
2672
- bigThree.remove(cameraPanel);
2673
- bigThree.remove(XYZPanel);
2674
- aWindowConstraints.gridx = 0;
2675
- aWindowConstraints.gridy = 0;
2676
- aWindowConstraints.gridwidth = 1;
2677
- // aConstraints.gridheight = 3;
2678
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2679
- aWindowConstraints.weightx = 0;
2680
- aWindowConstraints.weighty = 1;
2681
- bigThree.add(jtp, aWindowConstraints);
2682
- aWindowConstraints.weightx = 1;
2683
- aWindowConstraints.gridwidth = 3;
2684
- // aWindowConstraints.gridheight = 3;
2685
- aWindowConstraints.gridx = 1;
2686
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2687
- bigThree.add(cameraPanel, aWindowConstraints);
2688
- aWindowConstraints.weightx = 0;
2689
- aWindowConstraints.gridx = 4;
2690
- aWindowConstraints.gridwidth = 1;
2691
- // aWindowConstraints.gridheight = 3;
2692
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2693
- //bigThree.add(XYZPanel, aConstraints);
2694
- bigThree.revalidate();
3057
+
3058
+// bigThree.remove(scenePanel);
3059
+// bigThree.remove(centralPanel);
3060
+// bigThree.remove(XYZPanel);
3061
+// aWindowConstraints.gridx = 0;
3062
+// aWindowConstraints.gridy = 0;
3063
+// aWindowConstraints.gridwidth = 1;
3064
+// // aConstraints.gridheight = 3;
3065
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3066
+// aWindowConstraints.weightx = 0;
3067
+// aWindowConstraints.weighty = 1;
3068
+// bigThree.add(scenePanel, aWindowConstraints);
3069
+// aWindowConstraints.weightx = 1;
3070
+// aWindowConstraints.gridwidth = 3;
3071
+// // aWindowConstraints.gridheight = 3;
3072
+// aWindowConstraints.gridx = 1;
3073
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3074
+// bigThree.add(centralPanel, aWindowConstraints);
3075
+// aWindowConstraints.weightx = 0;
3076
+// aWindowConstraints.gridx = 4;
3077
+// aWindowConstraints.gridwidth = 1;
3078
+// // aWindowConstraints.gridheight = 3;
3079
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3080
+// //bigThree.add(XYZPanel, aConstraints);
3081
+// bigThree.validate();
3082
+// scenePanel.setVisible(true);
3083
+// centralPanel.setVisible(true);
3084
+// XYZPanel.setVisible(false);
3085
+ bigThree.ClearUI();
3086
+ bigThree.add(scenePanel);
3087
+ bigThree.add(centralPanel);
3088
+ bigThree.FlushUI();
3089
+
3090
+ cameraView.requestFocusInWindow();
26953091 } else
2696
- if (event.getSource() == sevenButton)
3092
+ if (source == sevenButton)
26973093 {
26983094 radio.layout = sevenButton;
2699
- bigThree.remove(jtp);
2700
- bigThree.remove(cameraPanel);
2701
- bigThree.remove(XYZPanel);
2702
- aWindowConstraints.gridx = 0;
2703
- aWindowConstraints.gridy = 0;
2704
- aWindowConstraints.gridwidth = 1;
2705
- // aWindowConstraints.gridheight = 3;
2706
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2707
- aWindowConstraints.weightx = 0;
2708
- aWindowConstraints.weighty = 1;
2709
- bigThree.add(jtp, aWindowConstraints);
2710
- aWindowConstraints.weightx = 1;
2711
- aWindowConstraints.gridwidth = 3;
2712
- // aWindowConstraints.gridheight = 3;
2713
- aWindowConstraints.gridx = 1;
2714
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2715
- bigThree.add(cameraPanel, aWindowConstraints);
2716
- aWindowConstraints.weightx = 0;
2717
- aWindowConstraints.gridx = 4;
2718
- aWindowConstraints.gridwidth = 1;
2719
- // aConstraints.gridheight = 3;
2720
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2721
- bigThree.add(XYZPanel, aWindowConstraints);
2722
- bigThree.revalidate();
3095
+
3096
+// bigThree.remove(scenePanel);
3097
+// bigThree.remove(centralPanel);
3098
+// bigThree.remove(XYZPanel);
3099
+// aWindowConstraints.gridx = 0;
3100
+// aWindowConstraints.gridy = 0;
3101
+// aWindowConstraints.gridwidth = 1;
3102
+// // aWindowConstraints.gridheight = 3;
3103
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3104
+// aWindowConstraints.weightx = 0;
3105
+// aWindowConstraints.weighty = 1;
3106
+// bigThree.add(scenePanel, aWindowConstraints);
3107
+// aWindowConstraints.weightx = 1;
3108
+// aWindowConstraints.gridwidth = 3;
3109
+// // aWindowConstraints.gridheight = 3;
3110
+// aWindowConstraints.gridx = 1;
3111
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3112
+// bigThree.add(centralPanel, aWindowConstraints);
3113
+// aWindowConstraints.weightx = 0;
3114
+// aWindowConstraints.gridx = 4;
3115
+// aWindowConstraints.gridwidth = 1;
3116
+// // aConstraints.gridheight = 3;
3117
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3118
+// bigThree.add(XYZPanel, aWindowConstraints);
3119
+// bigThree.validate();
3120
+// scenePanel.setVisible(true);
3121
+// centralPanel.setVisible(true);
3122
+// XYZPanel.setVisible(true);
3123
+ bigThree.ClearUI();
3124
+ bigThree.add(scenePanel);
3125
+ bigThree.add(centralPanel);
3126
+ bigThree.add(XYZPanel);
3127
+ bigThree.FlushUI();
3128
+
3129
+ cameraView.requestFocusInWindow();
27233130 } else
2724
- if (event.getSource() == rootButton)
3131
+ if (source == rootButton)
27253132 {
27263133 Object3D obj;
27273134 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2731,17 +3138,24 @@
27313138 EditObject(obj);
27323139 }
27333140
3141
+ cameraView.requestFocusInWindow();
27343142 refreshContents(true);
27353143 } else
2736
- if (event.getSource() == closeButton)
3144
+ if (source == closeButton)
27373145 {
27383146 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27393147 cRadio ab;
27403148 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27413149 {
27423150 ab = (cRadio)e.nextElement();
2743
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3151
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27443152 {
3153
+ // Patch to avoid bug with transparency.
3154
+ if (!ab.hadMaterial)
3155
+ {
3156
+ ab.object.material = null;
3157
+ }
3158
+
27453159 buttonGroup.remove(ab);
27463160 radioPanel.remove(ab);
27473161
....@@ -2752,13 +3166,15 @@
27523166 break;
27533167 }
27543168 }
3169
+
3170
+ cameraView.requestFocusInWindow();
27553171 refreshContents(true);
27563172 } else
2757
- if (event.getSource() == editItem || event.getSource() == editButton)
3173
+ if (source == editItem || source == editButton)
27583174 {
27593175 EditSelection(false);
27603176 } else
2761
- if (event.getSource() == uneditButton)
3177
+ if (source == uneditButton)
27623178 {
27633179 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27643180 {
....@@ -2768,14 +3184,14 @@
27683184 child.CloseUI();
27693185 listUI.remove(child);
27703186
2771
- child.editWindow = null; // ???????????
3187
+ //child.editWindow = null; // ???????????
27723188 }
2773
- objEditor.ctrlPanel.revalidate();
3189
+ objEditor.ctrlPanel.FlushUI();
27743190 //objEditor.jTree.clearSelection();
27753191 //objEditor.ResetSliders();
27763192 refreshContents(true);
27773193 } else
2778
- if (event.getSource() == clearPanelButton)
3194
+ if (source == clearPanelButton)
27793195 {
27803196 assert(copy == group);
27813197 //copy.ClearUI();
....@@ -2786,7 +3202,7 @@
27863202 listUI.clear();
27873203 refreshContents(true);
27883204 } else
2789
- if (event.getSource() == allParamsButton)
3205
+ if (source == allParamsButton)
27903206 {
27913207 assert(copy == group);
27923208
....@@ -2807,19 +3223,19 @@
28073223
28083224 refreshContents(true);
28093225 } else
2810
- if (event.getSource() == unselectButton)
3226
+ if (source == unselectButton)
28113227 {
28123228 objEditor.jTree.clearSelection();
28133229 // ?? oct 2012 GrafreeD.clipboard.clear();
28143230 objEditor.ResetSliders();
28153231 refreshContents(true);
28163232 } else
2817
- if(event.getSource() instanceof cRadio)
3233
+ if(source instanceof cRadio)
28183234 {
28193235 group.parent = keepparent;
28203236 group.attributes = 0;
28213237 //group.editWindow = null;
2822
- /*cRadio*/ radio = (cRadio)event.getSource();
3238
+ /*cRadio*/ radio = (cRadio)source;
28233239 Object3D obj = radio.GetObject();
28243240 System.out.println("Edit " + obj);
28253241 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2839,7 +3255,7 @@
28393255 }
28403256
28413257 copy = group;
2842
- //CameraPane.theRenderer.object = group;
3258
+ //Globals.theRenderer.object = group;
28433259 if(!useclient)
28443260 {
28453261 cameraView.renderCamera = radio.camera;
....@@ -2848,12 +3264,16 @@
28483264 cameraView.cameras[cameraView.cameracount] = radio.camera;
28493265 cameraView.targetLookAt.set(radio.camera.lookAt);
28503266 cameraView.object = group;
2851
- cameraView.lighttouched = true;
3267
+ //cameraView.lighttouched = true;
3268
+ Globals.lighttouched = true;
28523269 topView.object = group;
28533270 frontView.object = group;
28543271 sideView.object = group;
28553272 }
2856
- group.editWindow = this;
3273
+
3274
+// fix "+" issue
3275
+ //group.editWindow = this;
3276
+
28573277 /*
28583278 currentLayout = radio.layout;
28593279 if (currentLayout == null)
....@@ -2865,8 +3285,23 @@
28653285 //group.parent = null; // ROOT
28663286 //group.attributes = -1;
28673287 ResetModel();
3288
+
3289
+ cameraView.requestFocusInWindow();
28683290 refreshContents(true);
2869
- }
3291
+ } else if (event.getSource() == editCameraItem)
3292
+ {
3293
+ cameraView.ProtectCamera();
3294
+ cameraView.repaint();
3295
+ return;
3296
+ } else if (event.getSource() == revertCameraItem)
3297
+ {
3298
+ cameraView.RevertCamera();
3299
+ cameraView.repaint();
3300
+ return;
3301
+ // } else if (event.getSource() == textureButton)
3302
+ // {
3303
+ // return; // true;
3304
+ }
28703305 else
28713306 {
28723307 //return super.action(event, arg);
....@@ -2875,7 +3310,6 @@
28753310 }
28763311
28773312 boolean useclient = false;
2878
- cRadio radio;
28793313
28803314 void ToggleRoot()
28813315 {
....@@ -2884,7 +3318,7 @@
28843318 if (useclient)
28853319 {
28863320 cameraView.object = client;
2887
- cameraView.lighttouched = true;
3321
+ Globals.lighttouched = true;
28883322 //topView.object = client;
28893323 //frontView.object = client;
28903324 //sideView.object = client;
....@@ -2892,7 +3326,7 @@
28923326 else
28933327 {
28943328 cameraView.object = group;
2895
- cameraView.lighttouched = true;
3329
+ Globals.lighttouched = true;
28963330 //topView.object = group;
28973331 //frontView.object = group;
28983332 //sideView.object = group;
....@@ -2927,6 +3361,28 @@
29273361 refreshContents();
29283362 }
29293363
3364
+ void TransformChildren()
3365
+ {
3366
+ Object3D obj;
3367
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3368
+ {
3369
+ obj = (Object3D)e.nextElement();
3370
+ obj.KeepTextureMatrices();
3371
+ obj.TransformChildren();
3372
+ obj.RestoreTextureMatrices();
3373
+
3374
+// if (obj.parent == null)
3375
+// {
3376
+// System.out.println("NULL PARENT!");
3377
+// new Exception().printStackTrace();
3378
+// }
3379
+// else
3380
+// TouchTransform(obj);
3381
+// //obj.parent.Touch();
3382
+ }
3383
+
3384
+ refreshContents();
3385
+ }
29303386
29313387 void ResetTransform()
29323388 {
....@@ -3039,7 +3495,7 @@
30393495 refreshContents();
30403496 }
30413497
3042
- void ResetCentroid()
3498
+ void ResetCentroid(boolean full)
30433499 {
30443500 Object3D obj;
30453501 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3054,12 +3510,16 @@
30543510 LA.matIdentity(Object3D.mat);
30553511 obj.getBounds(minima, maxima, false);
30563512 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3057
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3513
+ if (full)
3514
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30583515 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30593516 obj.TransformMesh(Object3D.mat);
3517
+
30603518 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3061
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3519
+ if (full)
3520
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30623521 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3522
+
30633523 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30643524 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30653525 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3088,7 +3548,8 @@
30883548
30893549 int size = obj.MemorySize();
30903550
3091
- System.err.println((size/1024) + " KB is the size of " + obj);
3551
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3552
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30923553 }
30933554 }
30943555 catch (Exception e)
....@@ -3125,9 +3586,9 @@
31253586 obj = (Object3D)e.nextElement();
31263587
31273588 System.out.println("Object is: " + obj);
3128
- GrafreeD.AnalyzeObject(obj);
3589
+ Grafreed.AnalyzeObject(obj);
31293590 System.out.println("Boundary rep: " + obj.bRep);
3130
- GrafreeD.AnalyzeObject(obj.bRep);
3591
+ Grafreed.AnalyzeObject(obj.bRep);
31313592
31323593 // System.err.println((size/1024) + " KB is the size of " + obj);
31333594 }
....@@ -3169,6 +3630,20 @@
31693630 void GenNormals(boolean crease)
31703631 {
31713632 group.GenNormalsS(crease);
3633
+
3634
+ refreshContents();
3635
+ }
3636
+
3637
+ void GenNormalsMESH()
3638
+ {
3639
+ group.GenNormalsMeshS();
3640
+
3641
+ refreshContents();
3642
+ }
3643
+
3644
+ void GenNormalsMINE()
3645
+ {
3646
+ group.selection.GenNormalsMINE();
31723647
31733648 refreshContents();
31743649 }
....@@ -3334,8 +3809,8 @@
33343809
33353810 void ParseVertices()
33363811 {
3337
- boolean epsequal = GrafreeD.epsequal;
3338
- GrafreeD.epsequal = true;
3812
+ boolean epsequal = Grafreed.epsequal;
3813
+ Grafreed.epsequal = true;
33393814
33403815 for (int i=0; i<group.selection.size(); i++)
33413816 {
....@@ -3360,7 +3835,7 @@
33603835 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33613836 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33623837
3363
- g.add(GrafreeD.clipboard);
3838
+ g.add(Grafreed.clipboard);
33643839
33653840 buffer.add(g);
33663841 }
....@@ -3375,7 +3850,7 @@
33753850 makeSomething(buffer, i==group.selection.size()-1);
33763851 }
33773852
3378
- GrafreeD.epsequal = epsequal;
3853
+ Grafreed.epsequal = epsequal;
33793854
33803855 refreshContents();
33813856 }
....@@ -3393,7 +3868,16 @@
33933868 String pigment = Object3D.GetPigment(tex);
33943869 //String bump = Object3D.GetBump(tex);
33953870
3396
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
3871
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3872
+
3873
+ try
3874
+ {
3875
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3876
+ }
3877
+ catch (Exception e)
3878
+ {
3879
+ System.err.println("FAIL: " + node);
3880
+ }
33973881
33983882 double s = v.s;
33993883
....@@ -3441,12 +3925,26 @@
34413925
34423926 void Align()
34433927 {
3928
+ if (group.selection.size() == 0)
3929
+ return;
3930
+
3931
+ cVector bbmin = new cVector();
3932
+ cVector bbmax = new cVector();
3933
+
3934
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
3935
+
3936
+ double dx = bbmax.x - bbmin.x;
3937
+ double dy = bbmax.y - bbmin.y;
3938
+ double dz = bbmax.z - bbmin.z;
3939
+
3940
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
3941
+
34443942 for (int i=0; i<group.selection.size(); i++)
34453943 {
34463944 Object3D obj = group.selection.get(i);
34473945
3448
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3449
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
3946
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
3947
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34503948 }
34513949
34523950 refreshContents();
....@@ -3467,11 +3965,11 @@
34673965
34683966 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34693967
3470
- boolean random = CameraPane.RANDOM;
3471
- CameraPane.RANDOM = false; // parse all random nodes
3968
+ boolean random = CameraPane.SWITCH;
3969
+ CameraPane.SWITCH = false; // parse all random nodes
34723970 lowres.linkVerticesThis(null);
34733971 lowres.linkVerticesThis(sn);
3474
- CameraPane.RANDOM = random;
3972
+ CameraPane.SWITCH = random;
34753973
34763974 System.err.flush();
34773975
....@@ -3511,7 +4009,7 @@
35114009 return;
35124010
35134011 Object3D poses = group.selection.get(0);
3514
- Object3D ref = GrafreeD.clipboard.get(0);
4012
+ Object3D ref = Grafreed.clipboard.get(0);
35154013
35164014 Object3D newgroup = new Object3D("Po:" + poses.name);
35174015
....@@ -3680,7 +4178,7 @@
36804178 group.selection.RelinkToSupport(); // july 2014
36814179 System.out.println("DONE.");
36824180 refreshContents();
3683
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4181
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
36844182 }
36854183
36864184 void ReduceMesh(boolean reduction34)
....@@ -3705,9 +4203,9 @@
37054203
37064204 void ClipMesh()
37074205 {
3708
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4206
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37094207 {
3710
- Object3D content = GrafreeD.clipboard.get(0);
4208
+ Object3D content = Grafreed.clipboard.get(0);
37114209
37124210 if (content instanceof cGroup && ((cGroup)content).transientlink )
37134211 content = ((cGroup)content).get(0);
....@@ -3716,7 +4214,7 @@
37164214 // {
37174215 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37184216 // }
3719
- group.selection.ClipMesh(GrafreeD.clipboard);
4217
+ group.selection.ClipMesh(Grafreed.clipboard);
37204218 }
37214219 // group.selection.ClipMesh(GrafreeD.clipboard);
37224220 System.out.println("DONE.");
....@@ -3763,6 +4261,18 @@
37634261 void MarkLeaves(boolean hide)
37644262 {
37654263 group.selection.MarkLeaves(hide);
4264
+ refreshContents();
4265
+ }
4266
+
4267
+ void RewindLeaves(boolean hide)
4268
+ {
4269
+ group.selection.RewindLeaves(hide);
4270
+ refreshContents();
4271
+ }
4272
+
4273
+ void RandomLeaves(boolean hide)
4274
+ {
4275
+ group.selection.RandomLeaves(hide);
37664276 refreshContents();
37674277 }
37684278
....@@ -3851,7 +4361,7 @@
38514361 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38524362
38534363 Object3D elem = (Object3D)group.selection.elementAt(i);
3854
- if(elem != group)
4364
+ if(elem != group || !newWindow)
38554365 {
38564366 // if (!(elem instanceof Composite))
38574367 // newWindow = false;
....@@ -3941,7 +4451,6 @@
39414451 //case 702: // Event.LIST_DESELECT
39424452 group.deselectAll();
39434453 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3944
- objEditor.ClearInfo(); // .GetMaterial());
39454454 if (tps != null)
39464455 {
39474456 for (int i=0; i < tps.length; i++)
....@@ -3950,31 +4459,30 @@
39504459
39514460 //if (child.parent != null)
39524461 //child.parent.addSelectee(child);
4462
+ objEditor.SetMaterial(child);
39534463 group.addSelectee(child);
3954
- objEditor.SetMaterial(child); // .GetMaterial());
3955
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3956
- System.err.println("info : " + child.GetPath());
39574464 }
39584465 }
3959
- else
3960
- {
3961
- objEditor.SetMaterial(group); // .GetMaterial());
3962
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3963
- System.err.println("info : " + group.GetPath());
3964
- }
4466
+// else
4467
+// {
4468
+// objEditor.SetMaterial(group); // .GetMaterial());
4469
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4470
+// System.err.println("info : " + group.GetPath());
4471
+// }
39654472
3966
- objEditor.SetText(); // jan 2014
3967
-
3968
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4473
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
39694474 CameraPane.flash = true;
39704475
3971
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4476
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39724477 // a camera
39734478 {
3974
- CameraPane.camerachangeframe = 0; // don't refuse it
3975
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3976
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3977
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
4479
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4480
+ {
4481
+ CameraPane.camerachangeframe = 0; // don't refuse it
4482
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4483
+ }
4484
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4485
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
39784486 }
39794487
39804488 refreshContents();
....@@ -3985,6 +4493,26 @@
39854493
39864494 freezemodel = false;
39874495 }
4496
+
4497
+ void refreshContents(boolean cp)
4498
+ {
4499
+ if (!Globals.MOUSEDRAGGED)
4500
+ {
4501
+ objEditor.ClearInfo(); // .GetMaterial());
4502
+
4503
+ for (int i=0; i < group.selection.Size(); i++)
4504
+ {
4505
+ Object3D child = (Object3D) group.selection.get(i);
4506
+
4507
+ objEditor.AddInfo(child, this, true);
4508
+ System.err.println("info : " + child.GetPath());
4509
+ }
4510
+
4511
+ objEditor.SetText(); // jan 2014
4512
+ }
4513
+
4514
+ super.refreshContents(cp);
4515
+ }
39884516
39894517 void linkSomething(Object3D thing)
39904518 {
....@@ -4056,16 +4584,18 @@
40564584 {
40574585 if (group.selection.isEmpty())
40584586 return;
4059
- GrafreeD.clipboardIsTempGroup = false;
4587
+
4588
+ Grafreed.clipboardIsTempGroup = false;
40604589 Composite tGroup = null;
40614590 if (group.selection.size() > 0) // 1)
40624591 {
40634592 tGroup = new cGroup();
4064
- GrafreeD.clipboardIsTempGroup = true;
4593
+ Grafreed.clipboardIsTempGroup = true;
40654594 }
40664595
40674596 if (cut)
40684597 {
4598
+ Save();
40694599 //int indices[] = jList.getSelectedIndices();
40704600 //for (int i = indices.length - 1; i >= 0; i--)
40714601 //jList.remove(indices[i]);
....@@ -4101,16 +4631,16 @@
41014631 //System.out.println("cut " + child);
41024632 //System.out.println("parent = " + child.parent);
41034633 // tmp.addChild(child);
4104
- if (GrafreeD.clipboardIsTempGroup)
4634
+ if (Grafreed.clipboardIsTempGroup)
41054635 tGroup.add/*Child*/(tmp);
41064636 else
4107
- GrafreeD.clipboard = tmp;
4637
+ Grafreed.clipboard = tmp;
41084638 }
41094639 else
4110
- if (GrafreeD.clipboardIsTempGroup)
4640
+ if (Grafreed.clipboardIsTempGroup)
41114641 tGroup.add/*Child*/(child);
41124642 else
4113
- GrafreeD.clipboard = child;
4643
+ Grafreed.clipboard = child;
41144644 }
41154645
41164646 //ResetModel();
....@@ -4142,21 +4672,23 @@
41424672 //System.out.println("cut " + elem);
41434673 //System.out.println("parent = " + elem.parent);
41444674 // tmp.addChild(elem);
4145
- if (GrafreeD.clipboardIsTempGroup)
4675
+ if (Grafreed.clipboardIsTempGroup)
41464676 tGroup.add/*Child*/(tmp);
41474677 else
4148
- GrafreeD.clipboard = tmp;
4678
+ Grafreed.clipboard = tmp;
41494679 }
41504680 else
4151
- if (GrafreeD.clipboardIsTempGroup)
4681
+ if (Grafreed.clipboardIsTempGroup)
41524682 tGroup.add/*Child*/(child);
41534683 else
4154
- GrafreeD.clipboard = child;
4684
+ Grafreed.clipboard = child;
41554685 }
41564686
41574687 }
4158
- if (GrafreeD.clipboardIsTempGroup)
4159
- GrafreeD.clipboard = tGroup;
4688
+
4689
+ if (Grafreed.clipboardIsTempGroup)
4690
+ Grafreed.clipboard = tGroup;
4691
+
41604692 if (cut)
41614693 {
41624694 ResetModel();
....@@ -4170,7 +4702,7 @@
41704702 // return;
41714703 boolean first = true;
41724704
4173
- if (GrafreeD.clipboardIsTempGroup)
4705
+ if (Grafreed.clipboardIsTempGroup)
41744706 {
41754707 Composite temp;
41764708
....@@ -4181,7 +4713,7 @@
41814713 temp = (Composite)Applet3D.clipboard.deepCopy();
41824714 */
41834715 Object3D elem;
4184
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4716
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41854717 {
41864718 Object3D child = (Object3D)e.nextElement();
41874719
....@@ -4215,21 +4747,21 @@
42154747 //Object3D cb = Applet3D.clipboard;
42164748 //temp.addChild(cb);
42174749 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4218
- assert(GrafreeD.clipboard.parent == null);
4219
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4220
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4221
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4222
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4750
+ assert(Grafreed.clipboard.parent == null);
4751
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4752
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4753
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4754
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42234755 else
4224
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4225
- GrafreeD.clipboard.get(0).parent = keepparent;
4756
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4757
+ Grafreed.clipboard.get(0).parent = keepparent;
42264758 }
42274759
42284760 ResetModel();
42294761 refreshContents();
42304762 }
42314763
4232
- void pasteInto(boolean copyit)
4764
+ void pasteInto(boolean copyit, boolean clone)
42334765 {
42344766 // if (GrafreeD.clipboard == null)
42354767 // return;
....@@ -4258,15 +4790,22 @@
42584790 if (copyit)
42594791 {
42604792 // paste(false);
4261
- CloneClipboard(false); // sept 2014
4793
+ if (clone)
4794
+ {
4795
+ CloneClipboard(false); // sept 2014
4796
+ }
4797
+ else
4798
+ {
4799
+ paste(false);
4800
+ }
42624801 }
42634802 else
42644803 {
42654804 boolean first = true;
42664805
4267
- if (GrafreeD.clipboardIsTempGroup)
4806
+ if (Grafreed.clipboardIsTempGroup)
42684807 {
4269
- Composite temp = (Composite)GrafreeD.clipboard;
4808
+ Composite temp = (Composite)Grafreed.clipboard;
42704809 Object3D copy;
42714810 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42724811 {
....@@ -4276,7 +4815,7 @@
42764815 }
42774816 } else
42784817 {
4279
- linkSomething(GrafreeD.clipboard); //.get(0));
4818
+ linkSomething(Grafreed.clipboard); //.get(0));
42804819 }
42814820 }
42824821 }
....@@ -4468,6 +5007,26 @@
44685007 makeSomething(csg);
44695008 }
44705009
5010
+ void Ungroup(Object3D g)
5011
+ {
5012
+ if (g instanceof HiddenObject)
5013
+ {
5014
+ HiddenObject h = (HiddenObject) g;
5015
+
5016
+ for (int i=0; i<h.ActualSize(); i++)
5017
+ {
5018
+ objEditor.makeSomething(h.get(i), false);
5019
+ }
5020
+ }
5021
+ else
5022
+ {
5023
+ for (int i=0; i<g.Size(); i++)
5024
+ {
5025
+ objEditor.makeSomething(g.get(i), false);
5026
+ }
5027
+ }
5028
+ }
5029
+
44715030 void ungroup()
44725031 {
44735032 /*
....@@ -4661,21 +5220,6 @@
46615220 }
46625221 */
46635222
4664
- void ImportGFD()
4665
- {
4666
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4667
- browser.show();
4668
- String filename = browser.getFile();
4669
- if (filename != null && filename.length() > 0)
4670
- {
4671
- String fullname = browser.getDirectory() + filename;
4672
-
4673
- //Object3D readobj =
4674
- objEditor.ReadGFD(fullname, objEditor);
4675
- //makeSomething(readobj);
4676
- }
4677
- }
4678
-
46795223 /*
46805224 public void Callback(Object obj)
46815225 {
....@@ -4699,26 +5243,9 @@
46995243 }
47005244 */
47015245
4702
- void ImportVRMLX3D()
4703
- {
4704
- if (GrafreeD.standAlone)
4705
- {
4706
- /**/
4707
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4708
- browser.show();
4709
- String filename = browser.getFile();
4710
- if (filename != null && filename.length() > 0)
4711
- {
4712
- String fullname = browser.getDirectory() + filename;
4713
- LoadVRMLX3D(fullname);
4714
- }
4715
- /**/
4716
- }
4717
- }
4718
-
47195246 String GetFile(String dialogName)
47205247 {
4721
- if (GrafreeD.standAlone)
5248
+ if (Grafreed.standAlone)
47225249 {
47235250 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47245251 browser.show();
....@@ -4782,10 +5309,18 @@
47825309 cButton flashSelectionButton;
47835310 cButton editButton;
47845311 cButton uneditButton;
5312
+ JCheckBox allParamsButton;
47855313 cButton clearpanelButton;
4786
- cButton allParamsButton;
47875314 cButton unselectButton;
47885315
5316
+ cButton minButton;
5317
+ cButton maxButton;
5318
+ cButton fullButton;
5319
+ cButton undoButton;
5320
+ cButton redoButton;
5321
+ cButton saveButton;
5322
+ cButton oneStepButton;
5323
+
47895324 cButton screenfitButton;
47905325 cButton screenfitpointButton;
47915326 cButton snapobjectButton;
....@@ -4796,14 +5331,6 @@
47965331 cButton closeButton;
47975332
47985333 cButton setsupportButton;
4799
-
4800
- cButton twoButton;
4801
- cButton sixButton;
4802
- cButton threeButton;
4803
- cButton sevenButton;
4804
- cButton fourButton; // full panel
4805
- cButton oneButton; // full XYZ
4806
- //cButton currentLayout;
48075334
48085335 //
48095336 //Composite
....@@ -4816,6 +5343,8 @@
48165343 private MenuItem lookFromItem;
48175344 private MenuItem switchItem;
48185345 private MenuItem cutItem;
5346
+ private MenuItem undoItem;
5347
+ private MenuItem redoItem;
48195348 private MenuItem duplicateItem;
48205349 private MenuItem cloneItem;
48215350 private MenuItem cloneSupportItem;
....@@ -4827,8 +5356,9 @@
48275356 private MenuItem resetsupportItem;
48285357 private MenuItem resetreferencesItem;
48295358 private MenuItem linkverticesItem;
5359
+ private MenuItem relinkverticesItem;
48305360 private MenuItem setMasterItem;
4831
- private MenuItem resetMeshItem;
5361
+ private MenuItem resetAllItem;
48325362 private MenuItem stepAllItem;
48335363 private MenuItem revertMeshItem;
48345364 private MenuItem poseMeshItem;
....@@ -4839,14 +5369,17 @@
48395369 private MenuItem mergeGeometriesItem;
48405370 private MenuItem copyItem;
48415371 private MenuItem pasteItem;
5372
+ private MenuItem pasteIntoItem;
48425373 private MenuItem pasteLinkItem;
48435374 private MenuItem pasteCloneItem;
48445375 private MenuItem pasteExpandItem;
48455376 private MenuItem clearItem;
48465377 private MenuItem clearAllItem;
48475378 private MenuItem genUVItem;
5379
+ private MenuItem genNormalsMESHItem;
48485380 private MenuItem genNormalsCADItem;
48495381 private MenuItem genNormalsORGANItem;
5382
+ private MenuItem genNormalsMINEItem;
48505383 private MenuItem stripifyItem;
48515384 private MenuItem unstripifyItem;
48525385 private MenuItem trimItem;
....@@ -4875,6 +5408,10 @@
48755408 private MenuItem showleavesItem;
48765409 private MenuItem markleavesItem;
48775410 private MenuItem unmarkleavesItem;
5411
+ private MenuItem rewindleavesItem;
5412
+ private MenuItem unrewindleavesItem;
5413
+ private MenuItem randomleavesItem;
5414
+ private MenuItem unrandomleavesItem;
48785415
48795416 private MenuItem flipVItem;
48805417 private MenuItem unflipVItem;
....@@ -4886,8 +5423,11 @@
48865423 private MenuItem panoTexturesItem;
48875424
48885425 private MenuItem resetCentroidItem;
4889
- private MenuItem transformgeometryItem;
5426
+ private MenuItem resetCentroidXZItem;
48905427 private MenuItem resetTransformItem;
5428
+ private MenuItem transformGeometryItem;
5429
+ private MenuItem transformChildrenItem;
5430
+ private MenuItem hideItem;
48915431 private MenuItem grabItem;
48925432 private MenuItem backItem;
48935433 private MenuItem frontItem;
....@@ -4908,6 +5448,7 @@
49085448
49095449 private MenuItem resetParentItem;
49105450 private MenuItem repairParentItem;
5451
+ private MenuItem repairShadowItem;
49115452 private MenuItem sortbysizeItem;
49125453 private MenuItem sortbynameItem;
49135454
....@@ -4928,10 +5469,11 @@
49285469 private MenuItem coneItem;
49295470 private MenuItem torusItem;
49305471 private MenuItem superItem;
5472
+ private MenuItem kleinItem;
49315473 private MenuItem blobItem;
49325474 private MenuItem latheItem;
49335475 private MenuItem bezierItem;
4934
- private MenuItem checkerItem;
5476
+ private MenuItem overlayItem;
49355477 private MenuItem meshItem;
49365478 // private MenuItem meshGroupItem;
49375479 private MenuItem springItem;
....@@ -4940,6 +5482,7 @@
49405482 private MenuItem csgItem;
49415483 private MenuItem templateItem;
49425484 private MenuItem textureItem;
5485
+ private MenuItem billboardItem;
49435486 private MenuItem shadowXItem;
49445487 private MenuItem shadowYItem;
49455488 private MenuItem shadowZItem;
....@@ -4952,11 +5495,6 @@
49525495 private MenuItem doubleItem;
49535496 private MenuItem tripleItem;
49545497
4955
- private MenuItem importGFDItem;
4956
- private MenuItem importVRMLX3DItem;
4957
- private MenuItem import3DSItem;
4958
- private MenuItem importOBJItem;
4959
-
49605498 private MenuItem computeAOItem;
49615499 private MenuItem recompileItem;
49625500 private MenuItem editScriptItem;
....@@ -4966,4 +5504,8 @@
49665504 private MenuItem analyzeItem;
49675505 private MenuItem dumpItem;
49685506 //boolean freezemodel = false;
5507
+
5508
+ Menu cameraMenu;
5509
+ MenuItem editCameraItem;
5510
+ MenuItem revertCameraItem;
49695511 }