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"));
....@@ -287,6 +407,11 @@
287407 genNormalsCADItem.addActionListener(this);
288408 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
289409 genNormalsMESHItem.addActionListener(this);
410
+ if (Globals.ADVANCED)
411
+ {
412
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
413
+ genNormalsMINEItem.addActionListener(this);
414
+ }
290415 stripifyItem = menu.add(new MenuItem("Stripify"));
291416 stripifyItem.addActionListener(this);
292417 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -308,23 +433,34 @@
308433 reduce34MeshItem.addActionListener(this);
309434 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
310435 increaseMeshItem.addActionListener(this);
311
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
312
- smoothMeshItem.addActionListener(this);
313436 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
314437 clipMeshItem.addActionListener(this);
438
+
439
+ if (Globals.ADVANCED)
440
+ {
441
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
442
+ smoothMeshItem.addActionListener(this);
443
+ }
315444
316445 oe.menuBar.add(menu = new Menu("Attributes"));
317446 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
318447 clearMaterialsItem.addActionListener(this);
448
+ resetAllItem = menu.add(new MenuItem("Reset All"));
449
+ resetAllItem.addActionListener(this);
450
+ stepAllItem = menu.add(new MenuItem("Step All"));
451
+ stepAllItem.addActionListener(this);
319452 menu.add("-");
320453 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
321454 liveleavesItem.addActionListener(this);
322455 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
323456 unliveleavesItem.addActionListener(this);
457
+ if (Globals.ADVANCED)
458
+ {
324459 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
325460 supportleavesItem.addActionListener(this);
326461 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
327462 unsupportleavesItem.addActionListener(this);
463
+ }
328464 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
329465 hideleavesItem.addActionListener(this);
330466 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -333,6 +469,14 @@
333469 markleavesItem.addActionListener(this);
334470 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
335471 unmarkleavesItem.addActionListener(this);
472
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
473
+ rewindleavesItem.addActionListener(this);
474
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
475
+ unrewindleavesItem.addActionListener(this);
476
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
477
+ randomleavesItem.addActionListener(this);
478
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
479
+ unrandomleavesItem.addActionListener(this);
336480 menu.add("-");
337481 flipVItem = menu.add(new MenuItem("Flip V"));
338482 flipVItem.addActionListener(this);
....@@ -368,35 +512,40 @@
368512 sortbynameItem = menu.add(new MenuItem("Sort by name"));
369513 sortbynameItem.addActionListener(this);
370514 menu.add("-");
515
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
516
+ shareGeometriesItem.addActionListener(this);
517
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
518
+ mergeGeometriesItem.addActionListener(this);
519
+ if (Globals.ADVANCED)
520
+ {
521
+ // Pretty much the same as duplicate and clone.
371522 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
372523 extractGeometriesItem.addActionListener(this);
373524 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
374525 cloneGeometriesItem.addActionListener(this);
375
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
376
- shareGeometriesItem.addActionListener(this);
377
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
378
- mergeGeometriesItem.addActionListener(this);
526
+ }
379527
380528 oe.menuBar.add(menu = new Menu("Insert"));
381529 buildCreateMenu(menu);
382530
383
-
384
- oe.menuBar.add(menu = new Menu("Include"));
385
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
386
- importGFDItem.addActionListener(this);
387
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
388
- importVRMLX3DItem.addActionListener(this);
389
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
390
- importOBJItem.addActionListener(this);
391
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
392
- import3DSItem.addActionListener(this);
393
-
394531 oe.menuBar.add(menu = new Menu("Tools"));
395532 buildToolsMenu(menu);
396533 }
397534
398535 void SetupUI2(ObjEditor oe)
399536 {
537
+ // June 2019
538
+ if (oe == null)
539
+ {
540
+ //super.SetupUI2(this);
541
+ //return;
542
+ }
543
+
544
+ if (copy != group)
545
+ {
546
+ //super.SetupUI2(this);
547
+ }
548
+
400549 //new Exception().printStackTrace();
401550
402551 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -425,150 +574,120 @@
425574 oe.radioPanel.add(dummyButton);
426575 oe.buttonGroup.add(dummyButton);
427576 */
428
- aConstraints.gridy += 1;
429
- oe.aConstraints.gridwidth = 1;
430
- oe.aConstraints.gridx = 0;
577
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
431578
432
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
579
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580
+ //minButton.setToolTipText("Minimize window");
581
+ //minButton.addActionListener(this);
582
+
583
+ oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
+ maxButton.setToolTipText("Maximize window");
585
+ maxButton.addActionListener(this);
586
+
587
+ oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ fullButton.setToolTipText("Full-screen window");
589
+ fullButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ undoButton.setToolTipText("Undo changes");
593
+ undoButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ redoButton.setToolTipText("Redo changes");
597
+ redoButton.addActionListener(this);
598
+
599
+ oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ saveButton.setToolTipText("Save changes");
601
+ saveButton.addActionListener(this);
602
+
603
+ oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
604
+ liveCB.setToolTipText("Enable animation");
433605 liveCB.addItemListener(this);
434606
435
- oe.aConstraints.gridx += 1;
436
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
437
- supportCB.addItemListener(this);
438
-
439
- // oe.aConstraints.gridx += 1;
440
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
441
- // localCB.addItemListener(this);
442
-
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
445
- crowdCB.addItemListener(this);
446
-
447
- oe.aConstraints.gridx += 1;
448
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
449
- smoothCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
607
+ oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ oneStepButton.setToolTipText("Animate one step forward");
609
+ oneStepButton.addActionListener(this);
610
+
611
+ oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
612
+ fastCB.setToolTipText("Fast mode");
453613 fastCB.addItemListener(this);
454
- oe.aConstraints.gridx += 1;
455
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
456
- slowCB.addItemListener(this);
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
459
- boxCB.addItemListener(this);
460
-
461
-// oe.aConstraints.gridx += 1;
462
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
463
-// speakerMocapCB.addItemListener(this);
464
-
465
- if (false)
466
- {
467
- // handled in scripts
468
- oe.aConstraints.gridx += 1;
469
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
470
- speakerCameraCB.addItemListener(this);
471
-
472
- oe.aConstraints.gridx += 1;
473
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
474
- speakerFocusCB.addItemListener(this);
475
-
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
478
- smoothfocusCB.addItemListener(this);
479
- }
480
-
481
-//oe.aConstraints.gridx += 1;
482
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
483
-// debugCB.addItemListener(this);
484
-
485
- oe.aConstraints.gridx += 1;
486
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
487
- oeilCB.addItemListener(this);
488
-
489
- oe.aConstraints.gridx += 1;
490
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
491
- lookAtCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
614
+
615
+ oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
616
+ trackCB.setToolTipText("Enable tracking");
495617 trackCB.addItemListener(this);
496618
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ screenfitButton.setToolTipText("Screen fit");
499621 screenfitButton.addActionListener(this);
500
- oe.aConstraints.gridx += 1;
622
+
501623 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
502624 // screenfitpointButton.addActionListener(this);
503
-// oe.aConstraints.gridx += 1;
504
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
505
- snapobjectButton.addActionListener(this);
506
- oe.aConstraints.gridx += 1;
507625
508
- //aConstraints.gridx = 0;
509
- //aConstraints.gridy += 1;
510
- oe.aConstraints.weighty = 0;
511
- oe.aConstraints.gridwidth = 1;
512
-
513
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
626
+ if (Globals.ADVANCED)
627
+ {
628
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ snapobjectButton.addActionListener(this);
630
+ snapobjectButton.setToolTipText("Snap Object");
631
+ }
632
+
633
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ flashSelectionButton.setToolTipText("Show selection");
514635 flashSelectionButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.aConstraints.weighty = 0;
517
- oe.aConstraints.gridwidth = 1;
518636
519
- //
520
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
637
+ oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
638
+
639
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
640
+ twoButton.setToolTipText("Show center view only");
521641 twoButton.addActionListener(this);
522
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
642
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
523643 fourButton.addActionListener(this);
524
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
644
+ fourButton.setToolTipText("Show left panel only");
645
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646
+ sixButton.setToolTipText("2-column layout left");
525647 sixButton.addActionListener(this);
526
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
648
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ threeButton.setToolTipText("2-column layout right");
527650 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
651
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
+ sevenButton.setToolTipText("3-column layout");
529653 sevenButton.addActionListener(this);
530654 //
531655
532
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
656
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
+ rootButton.setToolTipText("Edit selection in new tab");
533658 rootButton.addActionListener(this);
534
- oe.aConstraints.gridx += 1;
535
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
659
+
660
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
+ closeButton.setToolTipText("Close tab");
536662 closeButton.addActionListener(this);
537663 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
538664 //clearButton.addActionListener(this);
539
- oe.aConstraints.gridx += 1;
540665
541
- oe.aConstraints.gridx = 1; //
542
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
666
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
+ editButton.setToolTipText("Edit selection");
543668 editButton.addActionListener(this);
544
- oe.aConstraints.gridx += 1;
545
- oe.aConstraints.weighty = 0;
546
- oe.aConstraints.gridwidth = 1;
547669
548
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
670
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
+ uneditButton.setToolTipText("Unedit selection");
549672 uneditButton.addActionListener(this);
550673
551
- oe.aConstraints.gridx += 1;
552
- oe.aConstraints.weighty = 0;
553
- oe.aConstraints.gridwidth = 1;
554
-
555
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
556
- clearPanelButton.addActionListener(this);
557
-
558
- oe.aConstraints.gridx += 1;
559
- oe.aConstraints.weighty = 0;
560
- oe.aConstraints.gridwidth = 1;
561
-
562
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
674
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
+ allParamsButton.setToolTipText("Edit all params");
563676 allParamsButton.addActionListener(this);
564677
565
- oe.aConstraints.gridx += 1;
566
- oe.aConstraints.weighty = 0;
567
- oe.aConstraints.gridwidth = 1;
568
-
569
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
678
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
+ clearPanelButton.setToolTipText("Clear edit panel");
680
+ clearPanelButton.addActionListener(this);
681
+
682
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
683
+ unselectButton.setToolTipText("Unselect");
570684 unselectButton.addActionListener(this);
571685
686
+ editCommandsPanel.preferredHeight = 1;
687
+
688
+// oe.treePanel.add(commandsPanel);
689
+// oe.treePanel.Return();
690
+
572691 // oe.aConstraints.gridx += 1;
573692 // oe.aConstraints.weighty = 0;
574693 // oe.aConstraints.gridwidth = 1;
....@@ -580,40 +699,37 @@
580699 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
581700 // gcButton.addActionListener(this);
582701
583
- oe.aConstraints.gridx = 0;
584
- oe.aConstraints.gridy += 1;
585
-
586
- //ctrlPanel.add(objList = new List(5, true));
587
- oe.aConstraints.gridwidth = 100;
588
- // oe.aConstraints.gridheight = 100;
589
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
590
- oe.aConstraints.gridheight = 1;
591
- oe.aConstraints.weighty = 0.5;
592
- oe.aConstraints.gridx = 0;
593
- JScrollPane jSP;
702
+ cGridBag jSPPanel = new cGridBag();
703
+
704
+ JScrollPane jSP;
594705 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
595
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
706
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
596707 ResetModel();
597
- oe.aConstraints.weighty = 0.5;
598
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
599
- oe.aConstraints.gridy += 1;
600
- oe.aConstraints.gridwidth = 1;
708
+
709
+ oe.treePanel.add(jSPPanel);
710
+ oe.treePanel.Return();
601711
602
- oe.aConstraints.weighty = 0;
603
- oe.aConstraints.gridwidth = 2;
604
-
605
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
712
+ cGridBag copyOptionsPanel = new cGridBag();
713
+
714
+ copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
715
+ colorCB.setToolTipText("Copy color when dropped");
606716 colorCB.addItemListener(this);
607
- oe.aConstraints.gridx += 2;
608
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
717
+
718
+ copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
719
+ materialCB.setToolTipText("Copy material when dropped");
609720 materialCB.addItemListener(this);
610
- oe.aConstraints.gridx += 2;
611
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
721
+
722
+ copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
723
+ textureCB.setToolTipText("Copy texture when dropped");
612724 textureCB.addItemListener(this);
613725
614
- oe.aConstraints.gridx = 0;
615
- oe.aConstraints.gridy += 1;
726
+ copyOptionsPanel.preferredHeight = 1;
727
+ oe.treePanel.add(copyOptionsPanel);
728
+ oe.treePanel.Return();
616729
730
+// mainPanel.setDividerLocation(0.5); //1.0);
731
+// mainPanel.setResizeWeight(0.5);
732
+
617733 //jList.addListSelectionListener(this);
618734 oe.jTree.addTreeSelectionListener(this);
619735 //jTree.setRootVisible(false);
....@@ -635,20 +751,111 @@
635751 radio.layout = sevenButton;
636752 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
637753 }
754
+
755
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
756
+ {
757
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
758
+ boxCB.setToolTipText("Display bounding boxes");
759
+ boxCB.addItemListener(this);
760
+
761
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
+ zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
763
+ zoomBoxCB.addItemListener(this);
764
+
765
+ if (true) // Globals.ADVANCED)
766
+ {
767
+ panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
+ supportCB.setToolTipText("Enable rigging");
769
+ supportCB.addItemListener(this);
770
+
771
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
772
+ // localCB.addItemListener(this);
773
+
774
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
775
+ crowdCB.setToolTipText("Used for crowds");
776
+ crowdCB.addItemListener(this);
777
+
778
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
779
+ smoothCB.setToolTipText("Snapping delay");
780
+ smoothCB.addItemListener(this);
781
+
782
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
783
+ slowCB.setToolTipText("Smooth interpolation");
784
+ slowCB.addItemListener(this);
785
+
786
+// constraints.gridy += 1;
787
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
788
+// speakerMocapCB.addItemListener(this);
789
+
790
+ if (false)
791
+ {
792
+ // handled in scripts
793
+ //constraints.gridy += 1;
794
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
795
+ speakerCameraCB.addItemListener(this);
796
+
797
+ //constraints.gridy += 1;
798
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
799
+ speakerFocusCB.addItemListener(this);
800
+
801
+ //constraints.gridy += 1;
802
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
803
+ smoothfocusCB.addItemListener(this);
804
+ }
805
+
806
+//constraints.gridx += 1;
807
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
808
+// debugCB.addItemListener(this);
809
+
810
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
+ oeilCB.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
+ }
638834
639835 void EditObject(Object3D obj)
640836 {
641
- cRadio dummyButton = new cRadio(obj.name);
642
- dummyButton.SetObject(obj);
643
- dummyButton.layout = sevenButton;
644
- dummyButton.SetCamera(cameraView.renderCamera, false);
645
- dummyButton.addActionListener(this);
646
- radioPanel.add(dummyButton);
647
- buttonGroup.add(dummyButton);
648
- dummyButton.doClick();
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();
649853 }
854
+
650855 void SetupViews(ObjEditor oe)
651856 {
857
+ theFrame = this;
858
+
652859 oe.SetupViews();
653860
654861 System.out.println("SetupViews");
....@@ -665,13 +872,16 @@
665872 JCheckBox fastCB;
666873 JCheckBox slowCB;
667874 JCheckBox boxCB;
875
+ JCheckBox zoomBoxCB;
668876 JCheckBox trackCB;
669877 JCheckBox smoothfocusCB;
670878 // JCheckBox speakerMocapCB;
671879 JCheckBox speakerCameraCB;
672880 JCheckBox speakerFocusCB;
673881 JCheckBox debugCB;
882
+
674883 JCheckBox oeilCB;
884
+ JCheckBox shadowCB;
675885 JCheckBox lookAtCB;
676886
677887 // static int COLOR = 1;
....@@ -707,10 +917,10 @@
707917 dropAttributes |= Object3D.TEXTURE;
708918 else
709919 dropAttributes &= ~Object3D.TEXTURE;
710
- }
711
- else if(e.getSource() == liveCB)
920
+ } else if(e.getSource() == liveCB)
712921 {
713922 cameraView.ToggleLive();
923
+ refreshContents(false);
714924 }
715925 else if(e.getSource() == supportCB)
716926 {
....@@ -746,6 +956,10 @@
746956 cameraView.repaint();
747957 // refreshContents();
748958 }
959
+ else if(e.getSource() == zoomBoxCB)
960
+ {
961
+ cameraView.ToggleZoomBoxMode();
962
+ }
749963 else if(e.getSource() == smoothfocusCB)
750964 {
751965 cameraView.ToggleSmoothFocus();
....@@ -770,6 +984,10 @@
770984 else if(e.getSource() == oeilCB)
771985 {
772986 cameraView.ToggleOeil();
987
+ }
988
+ else if(e.getSource() == shadowCB)
989
+ {
990
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
773991 }
774992 else if(e.getSource() == lookAtCB)
775993 {
....@@ -859,7 +1077,9 @@
8591077 // objEditor.DropFile((java.io.File[]) object, true);
8601078 // return;
8611079 // }
862
- if (string.charAt(0) == '/')
1080
+
1081
+ // File path for Mac and Windows
1082
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8631083 {
8641084 // file(s)
8651085 String[] names = string.split("\n");
....@@ -886,7 +1106,7 @@
8861106
8871107 flashIt = false;
8881108 CameraPane pane = (CameraPane) target;
889
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1109
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8901110 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8911111
8921112 if (group.selection.size() == 1)
....@@ -913,11 +1133,11 @@
9131133 {
9141134 loadClipboard(true);
9151135 objEditor.jTree.setSelectionPath(destinationPath);
916
- pasteInto(false);
1136
+ pasteInto(false, false);
9171137 } else {
9181138 loadClipboard(false);
9191139 objEditor.jTree.setSelectionPath(destinationPath);
920
- pasteInto(false); // true); // ???
1140
+ pasteInto(false, false); // true); // ???
9211141 }
9221142 }
9231143 public void dropActionChanged(DropTargetDragEvent dtde)
....@@ -1035,29 +1255,37 @@
10351255 torusItem.addActionListener(this);
10361256 superItem = menu.add(new MenuItem("Superellipsoid"));
10371257 superItem.addActionListener(this);
1258
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1259
+ kleinItem.addActionListener(this);
10381260 particleItem = menu.add(new MenuItem("Particle system"));
10391261 particleItem.addActionListener(this);
1262
+ if (Globals.ADVANCED)
1263
+ {
10401264 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10411265 ragdollItem.addActionListener(this);
10421266 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10431267 ragdoll2Item.addActionListener(this);
1268
+ }
10441269 menu.add("-");
1045
- meshItem = menu.add(new MenuItem("Mesh"));
1270
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10461271 meshItem.addActionListener(this);
10471272 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10481273 // meshGroupItem.addActionListener(this);
1274
+ if (Globals.ADVANCED)
1275
+ {
10491276 springItem = menu.add(new MenuItem("Spring"));
10501277 springItem.addActionListener(this);
10511278 flagItem = menu.add(new MenuItem("Flag"));
10521279 flagItem.addActionListener(this);
1053
- bezierItem = menu.add(new MenuItem("Patch"));
1054
- bezierItem.addActionListener(this);
1055
- checkerItem = menu.add(new MenuItem("Checker"));
1056
- checkerItem.addActionListener(this);
10571280 blobItem = menu.add(new MenuItem("Blob"));
10581281 blobItem.addActionListener(this);
10591282 latheItem = menu.add(new MenuItem("Lathe"));
10601283 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);
10611289 lightItem = menu.add(new MenuItem("Light"));
10621290 lightItem.addActionListener(this);
10631291 menu.add("-");
....@@ -1067,39 +1295,44 @@
10671295 loopItem.addActionListener(this);
10681296 doubleItem = menu.add(new MenuItem("Fork"));
10691297 doubleItem.addActionListener(this);
1298
+ if (Globals.ADVANCED)
1299
+ {
10701300 tripleItem = menu.add(new MenuItem("Trident"));
10711301 tripleItem.addActionListener(this);
1302
+ }
10721303 }
10731304
10741305 void buildToolsMenu(Menu menu)
10751306 {
10761307 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10771308 animationItem.addItemListener(this);
1078
- animationItem.setState(CameraPane.ANIMATION);
1309
+ animationItem.setState(Globals.ANIMATION);
10791310
10801311 menu.add("-");
10811312 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10821313 parseverticesItem.addActionListener(this);
10831314 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10841315 textureFieldItem.addActionListener(this);
1085
- alignItem = menu.add(new MenuItem("Align"));
1316
+ alignItem = menu.add(new MenuItem("Align Objects"));
10861317 alignItem.addActionListener(this);
1087
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1088
- mirrorItem.addActionListener(this);
10891318 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10901319 reduceMorphItem.addActionListener(this);
10911320 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10921321 reduce34MorphItem.addActionListener(this);
1093
-
1322
+ menu.add("-");
10941323 menu.add(computeAOItem = new MenuItem("Compute AO"));
10951324 computeAOItem.addActionListener(this);
1096
- menu.add("-");
10971325
1326
+ if (Globals.ADVANCED)
1327
+ {
1328
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1329
+ mirrorItem.addActionListener(this);
1330
+ menu.add("-");
10981331 menu.add(memoryItem = new MenuItem("Memory Usage"));
10991332 memoryItem.addActionListener(this);
11001333 menu.add(analyzeItem = new MenuItem("Analyze"));
11011334 analyzeItem.addActionListener(this);
1102
- menu.add(dumpItem = new MenuItem("Dump"));
1335
+ menu.add(dumpItem = new MenuItem("Print"));
11031336 dumpItem.addActionListener(this);
11041337 // menu.add(pathItem = new MenuItem("From-to path"));
11051338 // pathItem.addActionListener(this);
....@@ -1108,6 +1341,8 @@
11081341 resetParentItem.addActionListener(this);
11091342 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11101343 repairParentItem.addActionListener(this);
1344
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1345
+ repairShadowItem.addActionListener(this);
11111346 menu.add(invariantsItem = new MenuItem("Invariants"));
11121347 invariantsItem.addActionListener(this);
11131348 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1115,6 +1350,7 @@
11151350 menu.add("-");
11161351 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11171352 editScriptItem.addActionListener(this);
1353
+ }
11181354 }
11191355
11201356 void ScreenFit()
....@@ -1237,6 +1473,7 @@
12371473 shadow.material = new cMaterial(obj.material);
12381474 shadow.material.diffuse = 0.0001f;
12391475 shadow.material.specular = 0.0001f;
1476
+ //shadow.projectedVertices[1].x = 300;
12401477
12411478 makeSomething(shadow);
12421479 }
....@@ -1443,9 +1680,9 @@
14431680
14441681 void Overwrite(int mask)
14451682 {
1446
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1683
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14471684 {
1448
- Object3D content = GrafreeD.clipboard.get(0);
1685
+ Object3D content = Grafreed.clipboard.get(0);
14491686
14501687 if (content instanceof cGroup && ((cGroup)content).transientlink )
14511688 content = ((cGroup)content).get(0);
....@@ -1468,6 +1705,7 @@
14681705 //
14691706 public void actionPerformed(ActionEvent event) // , Object arg)
14701707 {
1708
+ Object source = event.getSource();
14711709 /*
14721710 if (event.getSource() == nameField)
14731711 {
....@@ -1479,11 +1717,11 @@
14791717 }
14801718 else
14811719 */
1482
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1720
+ if (source == lookAtItem || source == lookFromItem)
14831721 {
14841722 ScreenFit();
14851723 } else
1486
- if (event.getSource() == switchItem)
1724
+ if (source == switchItem)
14871725 {
14881726 cVector v1 = new cVector();
14891727 cVector v2 = new cVector();
....@@ -1492,11 +1730,11 @@
14921730 objEditor.cameraView.renderCamera.setAim(v2, v1);
14931731 objEditor.cameraView.repaint();
14941732 } else
1495
- if (event.getSource() == rectoidItem)
1733
+ if (source == rectoidItem)
14961734 {
14971735 makeSomething(new Box());
14981736 } else
1499
- if (event.getSource() == particleItem)
1737
+ if (source == particleItem)
15001738 {
15011739 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15021740 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1517,9 +1755,9 @@
15171755 applyExample(particleGeom, "SMOKE");
15181756 makeSomething(particleGeom);
15191757 } else
1520
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1758
+ if (source == ragdollItem || source == ragdoll2Item)
15211759 {
1522
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1760
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15231761
15241762 ragdoll.toParent = LA.newMatrix();
15251763 ragdoll.fromParent = LA.newMatrix();
....@@ -1537,7 +1775,7 @@
15371775 } else
15381776 /*
15391777 */
1540
- if (event.getSource() == heightFieldItem)
1778
+ if (source == heightFieldItem)
15411779 {
15421780 Object3D obj = new Object3D();
15431781
....@@ -1575,27 +1813,31 @@
15751813
15761814 makeSomething(obj);
15771815 } else
1578
- if (event.getSource() == gridItem)
1816
+ if (source == gridItem)
15791817 {
15801818 makeSomething(new Grid());
15811819 } else
1582
- if (event.getSource() == ellipsoidItem)
1820
+ if (source == ellipsoidItem)
15831821 {
15841822 makeSomething(new Sphere());
15851823 } else
1586
- if (event.getSource() == coneItem)
1824
+ if (source == coneItem)
15871825 {
15881826 makeSomething(new Cone());
15891827 } else
1590
- if (event.getSource() == torusItem)
1828
+ if (source == torusItem)
15911829 {
15921830 makeSomething(new Torus());
15931831 } else
1594
- if (event.getSource() == superItem)
1832
+ if (source == superItem)
15951833 {
15961834 makeSomething(new Superellipsoid());
15971835 } else
1598
- if (event.getSource() == blobItem)
1836
+ if (source == kleinItem)
1837
+ {
1838
+ makeSomething(new Klein());
1839
+ } else
1840
+ if (source == blobItem)
15991841 {
16001842 Blob blob = new Blob();
16011843 BlobComponent comp = new BlobComponent();
....@@ -1603,15 +1845,15 @@
16031845 //blob.retile();
16041846 makeSomething(blob);
16051847 } else
1606
- if (event.getSource() == latheItem)
1848
+ if (source == latheItem)
16071849 {
16081850 makeSomething(new Lathe());
16091851 } else
1610
- if (event.getSource() == bezierItem)
1852
+ if (source == bezierItem)
16111853 {
16121854 makeSomething(new BezierSurface());
16131855 } else
1614
- if (event.getSource() == checkerItem)
1856
+ if (source == overlayItem)
16151857 {
16161858 /*
16171859 Object3D obj = new BezierSurface(5,8);
....@@ -1626,7 +1868,7 @@
16261868 */
16271869 makeSomething(new Checker());
16281870 } else
1629
- if (event.getSource() == meshItem)
1871
+ if (source == meshItem)
16301872 {
16311873 Object3D itemtomake = new Object3D();
16321874 Object3D child;
....@@ -1647,35 +1889,35 @@
16471889 makeSomething(child);
16481890 }
16491891 } else
1650
- if (event.getSource() == springItem)
1892
+ if (source == springItem)
16511893 {
16521894 cSpring s = new cSpring();
16531895 s.setup();
16541896 makeSomething(s);
16551897 } else
1656
- if (event.getSource() == flagItem)
1898
+ if (source == flagItem)
16571899 {
16581900 cSpring s = new cFlag();
16591901 s.setup();
16601902 makeSomething(s);
16611903 } else
1662
- if (event.getSource() == lightItem)
1904
+ if (source == lightItem)
16631905 {
16641906 makeSomething(new Light());
16651907 } else
1666
- if (event.getSource() == csgItem)
1908
+ if (source == csgItem)
16671909 {
16681910 group(new CSG());
16691911 } else
1670
- if (event.getSource() == templateItem)
1912
+ if (source == templateItem)
16711913 {
16721914 group(new cTemplate());
16731915 } else
1674
- if (event.getSource() == attributeItem)
1916
+ if (source == attributeItem)
16751917 {
16761918 makeSomething(new Attribute());
16771919 } else
1678
- if (event.getSource() == pointflowItem)
1920
+ if (source == pointflowItem)
16791921 {
16801922 makeSomething(new PointFlow());
16811923 } else
....@@ -1687,7 +1929,7 @@
16871929 } else
16881930 */
16891931
1690
- if (event.getSource() == superLoopItem)
1932
+ if (source == superLoopItem)
16911933 {
16921934 Composite g = new cGroup();
16931935 for (int i=0; i<15; i++)
....@@ -1709,7 +1951,7 @@
17091951
17101952 group(g);
17111953 } else
1712
- if (event.getSource() == loopItem)
1954
+ if (source == loopItem)
17131955 {
17141956 Composite csg = new GroupLeaf();
17151957 csg.count = 5;
....@@ -1718,7 +1960,7 @@
17181960 csg.addChild(child);
17191961 child.addChild(csg);
17201962 } else
1721
- if (event.getSource() == doubleItem)
1963
+ if (source == doubleItem)
17221964 {
17231965 Composite csg = new GroupLeaf();
17241966 csg.count = 5;
....@@ -1730,7 +1972,7 @@
17301972 csg.addChild(child);
17311973 child.addChild(csg);
17321974 } else
1733
- if (event.getSource() == tripleItem)
1975
+ if (source == tripleItem)
17341976 {
17351977 Composite csg = new GroupLeaf();
17361978 csg.count = 4;
....@@ -1745,71 +1987,83 @@
17451987 csg.addChild(child);
17461988 child.addChild(csg);
17471989 } else
1748
-
1749
- if (event.getSource() == importGFDItem)
1990
+ if (source == computeAOItem)
17501991 {
1751
- ImportGFD();
1992
+ Globals.drawMode = CameraPane.OCCLUSION;
1993
+ Globals.theRenderer.repaint();
17521994 } else
1753
- if (event.getSource() == importVRMLX3DItem)
1754
- {
1755
- ImportVRMLX3D();
1756
- } else
1757
- if (event.getSource() == import3DSItem)
1758
- {
1759
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1760
- } else
1761
- if (event.getSource() == importOBJItem)
1762
- {
1763
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1764
- } else
1765
- if (event.getSource() == computeAOItem)
1766
- {
1767
- CameraPane.drawMode = CameraPane.OCCLUSION;
1768
- CameraPane.theRenderer.repaint();
1769
- } else
1770
- if (event.getSource() == recompileItem)
1995
+ if (source == recompileItem)
17711996 {
17721997 Recompile();
17731998 refreshContents();
17741999 } else
1775
- if (event.getSource() == editScriptItem)
2000
+ if (source == editScriptItem)
17762001 {
17772002 OpenDialog();
17782003 refreshContents();
17792004 } else
1780
- if (event.getSource() == invariantsItem)
2005
+ if (source == invariantsItem)
17812006 {
17822007 System.out.println("Invariants:");
1783
- GrafreeD.theApplet3D.universe.invariants();
2008
+ Grafreed.grafreeD.universe.invariants();
17842009 } else
1785
- if (event.getSource() == memoryItem)
2010
+ if (source == memoryItem)
17862011 {
17872012 //System.out.println("Invariants:");
17882013 PrintMemory();
17892014 } else
1790
- if (event.getSource() == pathItem)
2015
+ if (source == pathItem)
17912016 {
17922017 PrintPath();
17932018 } else
1794
- if (event.getSource() == analyzeItem)
2019
+ if (source == analyzeItem)
17952020 {
17962021 AnalyzeObject();
17972022 } else
1798
- if (event.getSource() == dumpItem)
2023
+ if (source == dumpItem)
17992024 {
18002025 DumpObject();
18012026 } else
1802
- 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)
18032057 {
18042058 //Reload(lastConverter, lastFilename, true);
18052059 ScreenFit();
18062060 } else
1807
- if (event.getSource() == screenfitpointButton)
2061
+ if (source == screenfitpointButton)
18082062 {
18092063 //Reload(lastConverter, lastFilename, true);
18102064 ScreenFitPoint();
18112065 } else
1812
- if (event.getSource() == snapobjectButton)
2066
+ if (source == snapobjectButton)
18132067 {
18142068 //Reload(lastConverter, lastFilename, true);
18152069 SnapObject();
....@@ -1820,13 +2074,13 @@
18202074 // Recompile();
18212075 // refreshContents();
18222076 // } else
1823
- if (event.getSource() == gcButton)
2077
+ if (source == gcButton)
18242078 {
18252079 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262080 System.gc();
18272081 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18282082 } else
1829
- if (event.getSource() == editLeafItem)
2083
+ if (source == editLeafItem)
18302084 {
18312085 Object3D obj;
18322086 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1840,62 +2094,74 @@
18402094 }
18412095 refreshContents(true);
18422096 } else
1843
- if (event.getSource() == openWindowItem)
2097
+ if (source == openWindowItem)
18442098 {
18452099 EditSelection(true);
18462100 } else
1847
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2101
+ if (source == cutItem || source == clearButton)
18482102 {
18492103 loadClipboard(true);
18502104 } else
1851
- if (event.getSource() == duplicateItem)
2105
+ if (source == undoItem)
18522106 {
1853
- 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;
18542116 loadClipboard(false);
18552117 paste(false);
1856
- GrafreeD.clipboard = keep;
2118
+ Grafreed.clipboard = keep;
18572119 } else
1858
- if (event.getSource() == cloneItem)
2120
+ if (source == cloneItem)
18592121 {
18602122 CloneSelection(false);
18612123 } else
1862
- if (event.getSource() == cloneSupportItem)
2124
+ if (source == cloneSupportItem)
18632125 {
18642126 CloneSelection(true);
18652127 } else
1866
- if (event.getSource() == copyItem)
2128
+ if (source == copyItem)
18672129 {
18682130 loadClipboard(false);
18692131 } else
1870
- if (event.getSource() == pasteItem)
2132
+ if (source == pasteItem)
18712133 {
18722134 paste(false);
18732135 } else
1874
- if (event.getSource() == pasteLinkItem)
2136
+ if (source == pasteIntoItem)
18752137 {
1876
- pasteInto(false);
2138
+ pasteInto(true, false);
18772139 } else
1878
- if (event.getSource() == pasteCloneItem)
2140
+ if (source == pasteLinkItem)
18792141 {
1880
- pasteInto(true);
2142
+ pasteInto(false, false);
18812143 } else
1882
- if (event.getSource() == pasteExpandItem)
2144
+ if (source == pasteCloneItem)
2145
+ {
2146
+ pasteInto(true, true);
2147
+ } else
2148
+ if (source == pasteExpandItem)
18832149 {
18842150 paste(true);
18852151 } else
1886
- if (event.getSource() == synchronizeItem)
2152
+ if (source == synchronizeItem)
18872153 {
18882154 Overwrite(Object3D.TRANSFORM);
18892155 } else
1890
- if (event.getSource() == overwriteNameItem)
2156
+ if (source == overwriteNameItem)
18912157 {
18922158 Overwrite(Object3D.NAME);
18932159 } else
1894
- if (event.getSource() == overwriteUVItem)
2160
+ if (source == overwriteUVItem)
18952161 {
18962162 Overwrite(Object3D.UV);
18972163 } else
1898
- if (event.getSource() == overwriteMatItem)
2164
+ if (source == overwriteMatItem)
18992165 {
19002166 /* july 2015
19012167 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1915,7 +2181,7 @@
19152181
19162182 Overwrite(dropAttributes);
19172183 }
1918
- if (event.getSource() == overwriteGeoItem)
2184
+ if (source == overwriteGeoItem)
19192185 {
19202186 Overwrite(Object3D.GEOMETRY);
19212187 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1932,7 +2198,7 @@
19322198 // refreshContents();
19332199 // }
19342200 } else
1935
- if (event.getSource() == generateMeshItem)
2201
+ if (source == generateMeshItem)
19362202 {
19372203 //if (group.selection.size() == 1)
19382204 // for (int i=0; i<group.selection.size(); i++)
....@@ -1943,7 +2209,7 @@
19432209 ResetModel();
19442210 refreshContents();
19452211 } else
1946
- if (event.getSource() == extractGeometriesItem)
2212
+ if (source == extractGeometriesItem)
19472213 {
19482214 boolean one = false;
19492215
....@@ -1970,7 +2236,7 @@
19702236 ResetModel();
19712237 refreshContents();
19722238 } else
1973
- if (event.getSource() == cloneGeometriesItem)
2239
+ if (source == cloneGeometriesItem)
19742240 {
19752241 boolean one = false;
19762242
....@@ -1996,32 +2262,37 @@
19962262 ResetModel();
19972263 refreshContents();
19982264 } else
1999
- if (event.getSource() == shareGeometriesItem)
2265
+ if (source == shareGeometriesItem)
20002266 {
20012267 boolean one = false;
20022268
20032269 if (group.selection.size() == 1)
20042270 one = true;
20052271
2272
+ Object3D merge = null;
2273
+
20062274 Object3D content = new cGroup();
20072275
20082276 for (int i=0; i<group.selection.size(); i++)
20092277 {
2010
- Object3D sel = new Merge(group.selection.get(i));
2278
+ merge = new Merge(group.selection.get(i));
20112279
20122280 if (one)
2013
- makeSomething(sel, false);
2281
+ makeSomething(merge, false);
20142282 else
2015
- content.addChild(sel);
2283
+ content.addChild(merge);
20162284 }
20172285
20182286 if (!one)
2019
- makeSomething(content, false);
2020
-
2021
- ResetModel();
2022
- refreshContents();
2287
+ makeSomething(content, true);
2288
+ else
2289
+ {
2290
+ ResetModel();
2291
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2292
+ refreshContents();
2293
+ }
20232294 } else
2024
- if (event.getSource() == mergeGeometriesItem)
2295
+ if (source == mergeGeometriesItem)
20252296 {
20262297 boolean one = false;
20272298
....@@ -2051,7 +2322,7 @@
20512322 ResetModel();
20522323 refreshContents();
20532324 } else
2054
- if (event.getSource() == linkverticesItem)
2325
+ if (source == linkverticesItem)
20552326 {
20562327 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20572328 // {
....@@ -2064,39 +2335,48 @@
20642335 // group.selection.get(0).setMasterThis(content); // should be identity
20652336 // refreshContents();
20662337 // }
2067
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2338
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20682339 {
2069
- Object3D content = GrafreeD.clipboard.get(0);
2340
+ Object3D content = Grafreed.clipboard.get(0);
20702341
20712342 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722343 content = ((cGroup)content).get(0);
20732344
2074
- 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));
20752346 for (int i=0; i<group.selection.size(); i++)
20762347 {
2077
- boolean random = CameraPane.RANDOM;
2078
- CameraPane.RANDOM = false; // parse all random nodes
2348
+ boolean random = CameraPane.SWITCH;
2349
+ CameraPane.SWITCH = false; // parse all random nodes
20792350 group.selection.get(i).linkVerticesThis(content);
20802351 // group.selection.get(i).setMasterThis(content); // should be identity
2081
- CameraPane.RANDOM = random;
2352
+ CameraPane.SWITCH = random;
20822353 }
2083
- 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));
20842355 refreshContents();
20852356 }
20862357 } else
2087
- if (event.getSource() == resetsupportItem)
2358
+ if (source == resetsupportItem)
20882359 {
20892360 for (int i=0; i<group.selection.size(); i++)
20902361 {
2091
- boolean random = CameraPane.RANDOM;
2092
- CameraPane.RANDOM = false; // parse all random nodes
2362
+ boolean random = CameraPane.SWITCH;
2363
+ CameraPane.SWITCH = false; // parse all random nodes
20932364 group.selection.get(i).linkVerticesThis(null);
2094
- CameraPane.RANDOM = random;
2365
+ CameraPane.SWITCH = random;
20952366 }
20962367
20972368 refreshContents();
20982369 } else
2099
- 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)
21002380 {
21012381 for (int i=0; i<group.selection.size(); i++)
21022382 {
....@@ -2105,11 +2385,11 @@
21052385
21062386 refreshContents();
21072387 } else
2108
- if (event.getSource() == setMasterItem)
2388
+ if (source == setMasterItem)
21092389 {
2110
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2390
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21112391 {
2112
- Object3D content = GrafreeD.clipboard.get(0);
2392
+ Object3D content = Grafreed.clipboard.get(0);
21132393
21142394 if (content instanceof cGroup && ((cGroup)content).transientlink )
21152395 content = ((cGroup)content).get(0);
....@@ -2118,13 +2398,13 @@
21182398 refreshContents();
21192399 }
21202400 } else
2121
- if (event.getSource() == poseMeshItem)
2401
+ if (source == poseMeshItem)
21222402 {
21232403 if (group.selection.size() == 1)
21242404 {
2125
- if (GrafreeD.clipboard.size() == 1)
2405
+ if (Grafreed.clipboard.size() == 1)
21262406 {
2127
- Object3D content = GrafreeD.clipboard.get(0);
2407
+ Object3D content = Grafreed.clipboard.get(0);
21282408
21292409 if (content instanceof cGroup && ((cGroup)content).transientlink )
21302410 content = ((cGroup)content).get(0);
....@@ -2137,19 +2417,19 @@
21372417 }
21382418
21392419 } else
2140
- if (event.getSource() == revertMeshItem)
2420
+ if (source == revertMeshItem)
21412421 {
21422422 RevertMeshes();
21432423 } else
2144
- if (event.getSource() == resetMeshItem)
2424
+ if (source == resetAllItem)
21452425 {
21462426 ResetAll();
21472427 } else
2148
- if (event.getSource() == stepAllItem)
2428
+ if (source == stepAllItem)
21492429 {
21502430 StepAll();
21512431 } else
2152
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2432
+ if (source == clearItem) // || event.getSource() == clearButton)
21532433 {
21542434 //int indices[] = jList.getSelectedIndices();
21552435 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2157,42 +2437,46 @@
21572437
21582438 ClearSelection(false);
21592439 } else
2160
- if (event.getSource() == clearAllItem)
2440
+ if (source == clearAllItem)
21612441 {
21622442 ClearSelection(true);
21632443 } else
2164
- if (event.getSource() == grabItem)
2444
+ if (source == grabItem)
21652445 {
21662446 group(new cGroup(), true);
21672447 } else
2168
- if (event.getSource() == frontItem)
2448
+ if (source == hideItem)
2449
+ {
2450
+ group(new HiddenObject());
2451
+ } else
2452
+ if (source == frontItem)
21692453 {
21702454 front();
21712455 } else
2172
- if (event.getSource() == backItem)
2456
+ if (source == backItem)
21732457 {
21742458 back();
21752459 } else
2176
- if (event.getSource() == cameraItem)
2460
+ if (source == cameraItem)
21772461 {
21782462 makeSomething(new Camera());
21792463 } else
2180
- if (event.getSource() == compositeItem)
2464
+ if (source == compositeItem)
21812465 {
21822466 group(new Composite());
21832467 } else
2184
- if (event.getSource() == randomItem)
2468
+ if (source == randomItem)
21852469 {
21862470 RandomNode random = new RandomNode();
21872471 group(random);
21882472 if (random.size() > 0)
2189
- random.name = random.get(0).name + "Rnd";
2473
+ random.name = random.get(0).name + "Switch";
21902474 } else
2191
- if (event.getSource() == physicsItem)
2475
+ if (source == physicsItem)
21922476 {
21932477 group(new PhysicsNode());
21942478 } else
2195
- if (event.getSource() == frameselectorItem)
2479
+ if (source == frameselectorItem)
21962480 {
21972481 for (int i=0; i<group.selection.size(); i++)
21982482 {
....@@ -2204,7 +2488,7 @@
22042488 ResetModel();
22052489 refreshContents();
22062490 } else
2207
- if (event.getSource() == switchGeoItem)
2491
+ if (source == switchGeoItem)
22082492 {
22092493 for (int i=0; i<group.selection.size(); i++)
22102494 {
....@@ -2216,7 +2500,7 @@
22162500 ResetModel();
22172501 refreshContents();
22182502 } else
2219
- if (event.getSource() == switchTransfoItem)
2503
+ if (source == switchTransfoItem)
22202504 {
22212505 for (int i=0; i<group.selection.size(); i++)
22222506 {
....@@ -2228,7 +2512,7 @@
22282512 ResetModel();
22292513 refreshContents();
22302514 } else
2231
- if (event.getSource() == morphItem)
2515
+ if (source == morphItem)
22322516 {
22332517 for (int i=0; i<group.selection.size(); i++)
22342518 {
....@@ -2240,7 +2524,7 @@
22402524 ResetModel();
22412525 refreshContents();
22422526 } else
2243
- if (event.getSource() == scriptNodeItem)
2527
+ if (source == scriptNodeItem)
22442528 {
22452529 boolean atleastone = false;
22462530
....@@ -2279,199 +2563,239 @@
22792563 }
22802564 }
22812565 } else
2282
- if (event.getSource() == linkerItem)
2566
+ if (source == linkerItem)
22832567 {
22842568 group(new cLinker());
22852569 } else
2286
- if (event.getSource() == textureItem)
2570
+ if (source == textureItem)
22872571 {
22882572 group(new TextureNode());
22892573 } else
2290
- if (event.getSource() == shadowXItem)
2574
+ if (source == billboardItem)
2575
+ {
2576
+ group(new BillboardNode());
2577
+ } else
2578
+ if (source == shadowXItem)
22912579 {
22922580 CastShadow(0);
22932581 } else
2294
- if (event.getSource() == shadowYItem)
2582
+ if (source == shadowYItem)
22952583 {
22962584 CastShadow(1);
22972585 } else
2298
- if (event.getSource() == shadowZItem)
2586
+ if (source == shadowZItem)
22992587 {
23002588 CastShadow(2);
23012589 } else
2302
- if (event.getSource() == ungroupItem)
2590
+ if (source == ungroupItem)
23032591 {
2304
- 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();
23052601 } else
2306
- if (event.getSource() == genUVItem)
2602
+ if (source == genUVItem)
23072603 {
23082604 GenUV();
23092605 } else
2310
- if (event.getSource() == genNormalsCADItem)
2606
+ if (source == genNormalsCADItem)
23112607 {
23122608 GenNormals(true);
23132609 } else
2314
- if (event.getSource() == genNormalsMESHItem)
2610
+ if (source == genNormalsMESHItem)
23152611 {
2316
- GenNormals(true); // TODO
2612
+ GenNormalsMESH();
23172613 } else
2318
- if (event.getSource() == genNormalsORGANItem)
2614
+ if (source == genNormalsORGANItem)
23192615 {
23202616 GenNormals(false);
23212617 } else
2322
- if (event.getSource() == stripifyItem)
2618
+ if (source == genNormalsMINEItem)
2619
+ {
2620
+ GenNormalsMINE();
2621
+ } else
2622
+ if (source == stripifyItem)
23232623 {
23242624 Stripify();
23252625 } else
2326
- if (event.getSource() == unstripifyItem)
2626
+ if (source == unstripifyItem)
23272627 {
23282628 Unstripify();
23292629 } else
2330
- if (event.getSource() == trimItem)
2630
+ if (source == trimItem)
23312631 {
23322632 Trim();
23332633 } else
2334
- if (event.getSource() == untrimItem)
2634
+ if (source == untrimItem)
23352635 {
23362636 Untrim();
23372637 } else
2338
- if (event.getSource() == clearColorsItem)
2638
+ if (source == clearColorsItem)
23392639 {
23402640 ClearColors();
23412641 } else
2342
- if (event.getSource() == clearMaterialsItem)
2642
+ if (source == clearMaterialsItem)
23432643 {
23442644 ClearMaterials();
23452645 } else
2346
- if (event.getSource() == liveleavesItem)
2646
+ if (source == liveleavesItem)
23472647 {
23482648 LiveLeaves(true);
23492649 } else
2350
- if (event.getSource() == unliveleavesItem)
2650
+ if (source == unliveleavesItem)
23512651 {
23522652 LiveLeaves(false);
23532653 } else
2354
- if (event.getSource() == supportleavesItem)
2654
+ if (source == supportleavesItem)
23552655 {
23562656 SupportLeaves(true);
23572657 } else
2358
- if (event.getSource() == unsupportleavesItem)
2658
+ if (source == unsupportleavesItem)
23592659 {
23602660 SupportLeaves(false);
23612661 } else
2362
- if (event.getSource() == hideleavesItem)
2662
+ if (source == hideleavesItem)
23632663 {
23642664 HideLeaves(true);
23652665 } else
2366
- if (event.getSource() == showleavesItem)
2666
+ if (source == showleavesItem)
23672667 {
23682668 HideLeaves(false);
23692669 } else
2370
- if (event.getSource() == markleavesItem)
2670
+ if (source == markleavesItem)
23712671 {
23722672 MarkLeaves(true);
23732673 } else
2374
- if (event.getSource() == unmarkleavesItem)
2674
+ if (source == unmarkleavesItem)
23752675 {
23762676 MarkLeaves(false);
23772677 } else
2378
- 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)
23792695 {
23802696 FlipV(true);
23812697 } else
2382
- if (event.getSource() == unflipVItem)
2698
+ if (source == unflipVItem)
23832699 {
23842700 FlipV(false);
23852701 } else
2386
- if (event.getSource() == lowTexturesItem)
2702
+ if (source == lowTexturesItem)
23872703 {
23882704 SetTexRes(0);
23892705 } else
2390
- if (event.getSource() == normalTexturesItem)
2706
+ if (source == normalTexturesItem)
23912707 {
23922708 SetTexRes(1);
23932709 } else
2394
- if (event.getSource() == highTexturesItem)
2710
+ if (source == highTexturesItem)
23952711 {
23962712 SetTexRes(2);
23972713 } else
2398
- if (event.getSource() == veryhighTexturesItem)
2714
+ if (source == veryhighTexturesItem)
23992715 {
24002716 SetTexRes(3);
24012717 } else
2402
- if (event.getSource() == maxTexturesItem)
2718
+ if (source == maxTexturesItem)
24032719 {
24042720 SetTexRes(4);
24052721 } else
2406
- if (event.getSource() == panoTexturesItem)
2722
+ if (source == panoTexturesItem)
24072723 {
24082724 SetTexRes(5);
24092725 } else
2410
- if (event.getSource() == reverseNormalsItem)
2726
+ if (source == reverseNormalsItem)
24112727 {
24122728 ReverseNormals();
24132729 } else
2414
- if (event.getSource() == parseverticesItem)
2730
+ if (source == parseverticesItem)
24152731 {
24162732 ParseVertices();
24172733 } else
2418
- if (event.getSource() == textureFieldItem)
2734
+ if (source == textureFieldItem)
24192735 {
24202736 TextureVertices();
24212737 } else
2422
- if (event.getSource() == alignItem)
2738
+ if (source == alignItem)
24232739 {
24242740 Align();
24252741 } else
2426
- if (event.getSource() == mirrorItem)
2742
+ if (source == mirrorItem)
24272743 {
24282744 MirrorPoses();
24292745 } else
2430
- if (event.getSource() == reduceMorphItem)
2746
+ if (source == reduceMorphItem)
24312747 {
24322748 MeshReduction(false);
24332749 } else
2434
- if (event.getSource() == reduce34MorphItem)
2750
+ if (source == reduce34MorphItem)
24352751 {
24362752 MeshReduction(true);
24372753 } else
2438
- if (event.getSource() == reverseTrianglesItem)
2754
+ if (source == reverseTrianglesItem)
24392755 {
24402756 ReverseTriangles();
24412757 } else
2442
- if (event.getSource() == reduceMeshItem)
2758
+ if (source == reduceMeshItem)
24432759 {
24442760 ReduceMesh(false);
24452761 } else
2446
- if (event.getSource() == reduce34MeshItem)
2762
+ if (source == reduce34MeshItem)
24472763 {
24482764 ReduceMesh(true);
24492765 } else
2450
- if (event.getSource() == increaseMeshItem)
2766
+ if (source == increaseMeshItem)
24512767 {
24522768 IncreaseMesh();
24532769 } else
2454
- if (event.getSource() == clipMeshItem)
2770
+ if (source == clipMeshItem)
24552771 {
24562772 ClipMesh();
24572773 } else
2458
- if (event.getSource() == smoothMeshItem)
2774
+ if (source == smoothMeshItem)
24592775 {
24602776 SmoothMesh();
24612777 } else
2462
- if (event.getSource() == transformgeometryItem)
2778
+ if (source == transformGeometryItem)
24632779 {
24642780 TransformGeometry();
24652781 } else
2466
- if (event.getSource() == resetTransformItem)
2782
+ if (source == transformChildrenItem)
2783
+ {
2784
+ TransformChildren();
2785
+ } else
2786
+ if (source == resetTransformItem)
24672787 {
24682788 ResetTransform();
24692789 } else
2470
- if (event.getSource() == resetCentroidItem)
2790
+ if (source == resetCentroidItem)
24712791 {
2472
- ResetCentroid();
2792
+ ResetCentroid(true);
24732793 } else
2474
- if (event.getSource() == resetParentItem)
2794
+ if (source == resetCentroidXZItem)
2795
+ {
2796
+ ResetCentroid(false);
2797
+ } else
2798
+ if (source == resetParentItem)
24752799 {
24762800 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24772801 {
....@@ -2481,7 +2805,7 @@
24812805
24822806 refreshContents();
24832807 } else
2484
- if (event.getSource() == repairParentItem)
2808
+ if (source == repairParentItem)
24852809 {
24862810 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24872811 {
....@@ -2495,7 +2819,21 @@
24952819
24962820 refreshContents();
24972821 } else
2498
- 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)
24992837 {
25002838 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25012839 {
....@@ -2507,7 +2845,7 @@
25072845 ResetModel();
25082846 refreshContents();
25092847 } else
2510
- if (event.getSource() == sortbynameItem)
2848
+ if (source == sortbynameItem)
25112849 {
25122850 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25132851 {
....@@ -2519,7 +2857,7 @@
25192857 ResetModel();
25202858 refreshContents();
25212859 } else
2522
- if (event.getSource() == attachPigmentItem)
2860
+ if (source == attachPigmentItem)
25232861 {
25242862 String texture = GetFile("Attach pigment");
25252863 Object3D obj;
....@@ -2531,7 +2869,7 @@
25312869
25322870 refreshContents();
25332871 } else
2534
- if (event.getSource() == detachPigmentItem)
2872
+ if (source == detachPigmentItem)
25352873 {
25362874 Object3D obj;
25372875 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2542,7 +2880,7 @@
25422880
25432881 refreshContents();
25442882 } else
2545
- if (event.getSource() == attachBumpItem)
2883
+ if (source == attachBumpItem)
25462884 {
25472885 String texture = GetFile("Attach bump");
25482886 Object3D obj;
....@@ -2554,7 +2892,7 @@
25542892
25552893 refreshContents();
25562894 } else
2557
- if (event.getSource() == detachBumpItem)
2895
+ if (source == detachBumpItem)
25582896 {
25592897 Object3D obj;
25602898 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2565,7 +2903,7 @@
25652903
25662904 refreshContents();
25672905 } else
2568
- if (event.getSource() == pigmentBumpItem)
2906
+ if (source == pigmentBumpItem)
25692907 {
25702908 Object3D obj;
25712909 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2576,158 +2914,221 @@
25762914
25772915 refreshContents();
25782916 } else
2579
- if (event.getSource() == flashSelectionButton)
2917
+ if (source == flashSelectionButton)
25802918 {
25812919 CameraPane.flash = true;
25822920 refreshContents();
25832921 } else
2584
- if (event.getSource() == oneButton)
2922
+ if (source == oneButton)
25852923 {
25862924 } else
2587
- if (event.getSource() == twoButton)
2925
+ if (source == twoButton)
25882926 {
25892927 radio.layout = twoButton;
25902928 // bug
25912929 //gridPanel.setDividerLocation(1.0);
25922930 //bigPanel.setDividerLocation(0.0);
2593
- bigThree.remove(jtp);
2594
- bigThree.remove(cameraPanel);
2595
- bigThree.remove(XYZPanel);
2596
- aWindowConstraints.gridx = 0;
2597
- aWindowConstraints.gridy = 0;
2598
- aWindowConstraints.gridwidth = 1;
2599
- // aConstraints.gridheight = 3;
2600
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2601
- aWindowConstraints.weightx = 0;
2602
- aWindowConstraints.weighty = 1;
2603
- //bigThree.add(jtp, aWindowConstraints);
2604
- aWindowConstraints.weightx = 1;
2605
- aWindowConstraints.gridwidth = 3;
2606
- // aConstraints.gridheight = 3;
2607
- aWindowConstraints.gridx = 1;
2608
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2609
- bigThree.add(cameraPanel, aWindowConstraints);
2610
- aWindowConstraints.weightx = 0;
2611
- aWindowConstraints.gridx = 4;
2612
- aWindowConstraints.gridwidth = 1;
2613
- // aConstraints.gridheight = 3;
2614
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2615
- //bigThree.add(XYZPanel, aWindowConstraints);
2616
- bigThree.revalidate();
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
+
26172978 } else
2618
- if (event.getSource() == threeButton)
2979
+ if (source == threeButton)
26192980 {
26202981 radio.layout = threeButton;
2621
- bigThree.remove(jtp);
2622
- bigThree.remove(cameraPanel);
2623
- bigThree.remove(XYZPanel);
2624
- aWindowConstraints.gridx = 0;
2625
- aWindowConstraints.gridy = 0;
2626
- aWindowConstraints.gridwidth = 1;
2627
- // aConstraints.gridheight = 3;
2628
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2629
- aWindowConstraints.weightx = 0;
2630
- aWindowConstraints.weighty = 1;
2631
- //bigThree.add(jtp, aWindowConstraints);
2632
- aWindowConstraints.weightx = 1;
2633
- aWindowConstraints.gridwidth = 3;
2634
- // aConstraints.gridheight = 3;
2635
- aWindowConstraints.gridx = 1;
2636
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2637
- bigThree.add(cameraPanel, aWindowConstraints);
2638
- aWindowConstraints.weightx = 0;
2639
- aWindowConstraints.gridx = 4;
2640
- aWindowConstraints.gridwidth = 1;
2641
- // aConstraints.gridheight = 3;
2642
- aConstraints.fill = GridBagConstraints.VERTICAL;
2643
- bigThree.add(XYZPanel, aWindowConstraints);
2644
- bigThree.revalidate();
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();
26453016 } else
2646
- if (event.getSource() == fourButton)
3017
+ if (source == fourButton)
26473018 {
26483019 radio.layout = fourButton;
2649
- bigThree.remove(jtp);
2650
- bigThree.remove(cameraPanel);
2651
- bigThree.remove(XYZPanel);
2652
- aWindowConstraints.gridx = 0;
2653
- aWindowConstraints.gridy = 0;
2654
- aWindowConstraints.gridwidth = 1;
2655
- // aWindowConstraints.gridheight = 3;
2656
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2657
- aWindowConstraints.weightx = 1;
2658
- aWindowConstraints.weighty = 1;
2659
- bigThree.add(jtp, aWindowConstraints);
2660
- aWindowConstraints.weightx = 1;
2661
- aWindowConstraints.gridwidth = 3;
2662
- // aConstraints.gridheight = 3;
2663
- aWindowConstraints.gridx = 1;
2664
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2665
- //bigThree.add(cameraPanel, aWindowConstraints);
2666
- aWindowConstraints.weightx = 0;
2667
- aWindowConstraints.gridx = 4;
2668
- aWindowConstraints.gridwidth = 1;
2669
- // aWindowConstraints.gridheight = 3;
2670
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2671
- //bigThree.add(XYZPanel, aWindowConstraints);
2672
- bigThree.revalidate();
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();
26733053 } else
2674
- if (event.getSource() == sixButton)
3054
+ if (source == sixButton)
26753055 {
26763056 radio.layout = sixButton;
2677
- bigThree.remove(jtp);
2678
- bigThree.remove(cameraPanel);
2679
- bigThree.remove(XYZPanel);
2680
- aWindowConstraints.gridx = 0;
2681
- aWindowConstraints.gridy = 0;
2682
- aWindowConstraints.gridwidth = 1;
2683
- // aConstraints.gridheight = 3;
2684
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2685
- aWindowConstraints.weightx = 0;
2686
- aWindowConstraints.weighty = 1;
2687
- bigThree.add(jtp, aWindowConstraints);
2688
- aWindowConstraints.weightx = 1;
2689
- aWindowConstraints.gridwidth = 3;
2690
- // aWindowConstraints.gridheight = 3;
2691
- aWindowConstraints.gridx = 1;
2692
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2693
- bigThree.add(cameraPanel, aWindowConstraints);
2694
- aWindowConstraints.weightx = 0;
2695
- aWindowConstraints.gridx = 4;
2696
- aWindowConstraints.gridwidth = 1;
2697
- // aWindowConstraints.gridheight = 3;
2698
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2699
- //bigThree.add(XYZPanel, aConstraints);
2700
- bigThree.revalidate();
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();
27013091 } else
2702
- if (event.getSource() == sevenButton)
3092
+ if (source == sevenButton)
27033093 {
27043094 radio.layout = sevenButton;
2705
- bigThree.remove(jtp);
2706
- bigThree.remove(cameraPanel);
2707
- bigThree.remove(XYZPanel);
2708
- aWindowConstraints.gridx = 0;
2709
- aWindowConstraints.gridy = 0;
2710
- aWindowConstraints.gridwidth = 1;
2711
- // aWindowConstraints.gridheight = 3;
2712
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2713
- aWindowConstraints.weightx = 0;
2714
- aWindowConstraints.weighty = 1;
2715
- bigThree.add(jtp, aWindowConstraints);
2716
- aWindowConstraints.weightx = 1;
2717
- aWindowConstraints.gridwidth = 3;
2718
- // aWindowConstraints.gridheight = 3;
2719
- aWindowConstraints.gridx = 1;
2720
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2721
- bigThree.add(cameraPanel, aWindowConstraints);
2722
- aWindowConstraints.weightx = 0;
2723
- aWindowConstraints.gridx = 4;
2724
- aWindowConstraints.gridwidth = 1;
2725
- // aConstraints.gridheight = 3;
2726
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2727
- bigThree.add(XYZPanel, aWindowConstraints);
2728
- bigThree.revalidate();
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();
27293130 } else
2730
- if (event.getSource() == rootButton)
3131
+ if (source == rootButton)
27313132 {
27323133 Object3D obj;
27333134 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2737,17 +3138,24 @@
27373138 EditObject(obj);
27383139 }
27393140
3141
+ cameraView.requestFocusInWindow();
27403142 refreshContents(true);
27413143 } else
2742
- if (event.getSource() == closeButton)
3144
+ if (source == closeButton)
27433145 {
27443146 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27453147 cRadio ab;
27463148 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27473149 {
27483150 ab = (cRadio)e.nextElement();
2749
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3151
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27503152 {
3153
+ // Patch to avoid bug with transparency.
3154
+ if (!ab.hadMaterial)
3155
+ {
3156
+ ab.object.material = null;
3157
+ }
3158
+
27513159 buttonGroup.remove(ab);
27523160 radioPanel.remove(ab);
27533161
....@@ -2758,13 +3166,15 @@
27583166 break;
27593167 }
27603168 }
3169
+
3170
+ cameraView.requestFocusInWindow();
27613171 refreshContents(true);
27623172 } else
2763
- if (event.getSource() == editItem || event.getSource() == editButton)
3173
+ if (source == editItem || source == editButton)
27643174 {
27653175 EditSelection(false);
27663176 } else
2767
- if (event.getSource() == uneditButton)
3177
+ if (source == uneditButton)
27683178 {
27693179 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27703180 {
....@@ -2774,14 +3184,14 @@
27743184 child.CloseUI();
27753185 listUI.remove(child);
27763186
2777
- child.editWindow = null; // ???????????
3187
+ //child.editWindow = null; // ???????????
27783188 }
2779
- objEditor.ctrlPanel.revalidate();
3189
+ objEditor.ctrlPanel.FlushUI();
27803190 //objEditor.jTree.clearSelection();
27813191 //objEditor.ResetSliders();
27823192 refreshContents(true);
27833193 } else
2784
- if (event.getSource() == clearPanelButton)
3194
+ if (source == clearPanelButton)
27853195 {
27863196 assert(copy == group);
27873197 //copy.ClearUI();
....@@ -2792,7 +3202,7 @@
27923202 listUI.clear();
27933203 refreshContents(true);
27943204 } else
2795
- if (event.getSource() == allParamsButton)
3205
+ if (source == allParamsButton)
27963206 {
27973207 assert(copy == group);
27983208
....@@ -2813,19 +3223,19 @@
28133223
28143224 refreshContents(true);
28153225 } else
2816
- if (event.getSource() == unselectButton)
3226
+ if (source == unselectButton)
28173227 {
28183228 objEditor.jTree.clearSelection();
28193229 // ?? oct 2012 GrafreeD.clipboard.clear();
28203230 objEditor.ResetSliders();
28213231 refreshContents(true);
28223232 } else
2823
- if(event.getSource() instanceof cRadio)
3233
+ if(source instanceof cRadio)
28243234 {
28253235 group.parent = keepparent;
28263236 group.attributes = 0;
28273237 //group.editWindow = null;
2828
- /*cRadio*/ radio = (cRadio)event.getSource();
3238
+ /*cRadio*/ radio = (cRadio)source;
28293239 Object3D obj = radio.GetObject();
28303240 System.out.println("Edit " + obj);
28313241 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2845,7 +3255,7 @@
28453255 }
28463256
28473257 copy = group;
2848
- //CameraPane.theRenderer.object = group;
3258
+ //Globals.theRenderer.object = group;
28493259 if(!useclient)
28503260 {
28513261 cameraView.renderCamera = radio.camera;
....@@ -2854,12 +3264,16 @@
28543264 cameraView.cameras[cameraView.cameracount] = radio.camera;
28553265 cameraView.targetLookAt.set(radio.camera.lookAt);
28563266 cameraView.object = group;
2857
- cameraView.lighttouched = true;
3267
+ //cameraView.lighttouched = true;
3268
+ Globals.lighttouched = true;
28583269 topView.object = group;
28593270 frontView.object = group;
28603271 sideView.object = group;
28613272 }
2862
- group.editWindow = this;
3273
+
3274
+// fix "+" issue
3275
+ //group.editWindow = this;
3276
+
28633277 /*
28643278 currentLayout = radio.layout;
28653279 if (currentLayout == null)
....@@ -2871,8 +3285,23 @@
28713285 //group.parent = null; // ROOT
28723286 //group.attributes = -1;
28733287 ResetModel();
3288
+
3289
+ cameraView.requestFocusInWindow();
28743290 refreshContents(true);
2875
- }
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
+ }
28763305 else
28773306 {
28783307 //return super.action(event, arg);
....@@ -2881,7 +3310,6 @@
28813310 }
28823311
28833312 boolean useclient = false;
2884
- cRadio radio;
28853313
28863314 void ToggleRoot()
28873315 {
....@@ -2890,7 +3318,7 @@
28903318 if (useclient)
28913319 {
28923320 cameraView.object = client;
2893
- cameraView.lighttouched = true;
3321
+ Globals.lighttouched = true;
28943322 //topView.object = client;
28953323 //frontView.object = client;
28963324 //sideView.object = client;
....@@ -2898,7 +3326,7 @@
28983326 else
28993327 {
29003328 cameraView.object = group;
2901
- cameraView.lighttouched = true;
3329
+ Globals.lighttouched = true;
29023330 //topView.object = group;
29033331 //frontView.object = group;
29043332 //sideView.object = group;
....@@ -2933,6 +3361,28 @@
29333361 refreshContents();
29343362 }
29353363
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
+ }
29363386
29373387 void ResetTransform()
29383388 {
....@@ -3045,7 +3495,7 @@
30453495 refreshContents();
30463496 }
30473497
3048
- void ResetCentroid()
3498
+ void ResetCentroid(boolean full)
30493499 {
30503500 Object3D obj;
30513501 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3060,12 +3510,16 @@
30603510 LA.matIdentity(Object3D.mat);
30613511 obj.getBounds(minima, maxima, false);
30623512 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3063
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3513
+ if (full)
3514
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30643515 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30653516 obj.TransformMesh(Object3D.mat);
3517
+
30663518 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3067
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3519
+ if (full)
3520
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30683521 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3522
+
30693523 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30703524 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30713525 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3094,7 +3548,8 @@
30943548
30953549 int size = obj.MemorySize();
30963550
3097
- 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)");
30983553 }
30993554 }
31003555 catch (Exception e)
....@@ -3131,9 +3586,9 @@
31313586 obj = (Object3D)e.nextElement();
31323587
31333588 System.out.println("Object is: " + obj);
3134
- GrafreeD.AnalyzeObject(obj);
3589
+ Grafreed.AnalyzeObject(obj);
31353590 System.out.println("Boundary rep: " + obj.bRep);
3136
- GrafreeD.AnalyzeObject(obj.bRep);
3591
+ Grafreed.AnalyzeObject(obj.bRep);
31373592
31383593 // System.err.println((size/1024) + " KB is the size of " + obj);
31393594 }
....@@ -3175,6 +3630,20 @@
31753630 void GenNormals(boolean crease)
31763631 {
31773632 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();
31783647
31793648 refreshContents();
31803649 }
....@@ -3340,8 +3809,8 @@
33403809
33413810 void ParseVertices()
33423811 {
3343
- boolean epsequal = GrafreeD.epsequal;
3344
- GrafreeD.epsequal = true;
3812
+ boolean epsequal = Grafreed.epsequal;
3813
+ Grafreed.epsequal = true;
33453814
33463815 for (int i=0; i<group.selection.size(); i++)
33473816 {
....@@ -3366,7 +3835,7 @@
33663835 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33673836 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33683837
3369
- g.add(GrafreeD.clipboard);
3838
+ g.add(Grafreed.clipboard);
33703839
33713840 buffer.add(g);
33723841 }
....@@ -3381,7 +3850,7 @@
33813850 makeSomething(buffer, i==group.selection.size()-1);
33823851 }
33833852
3384
- GrafreeD.epsequal = epsequal;
3853
+ Grafreed.epsequal = epsequal;
33853854
33863855 refreshContents();
33873856 }
....@@ -3399,7 +3868,16 @@
33993868 String pigment = Object3D.GetPigment(tex);
34003869 //String bump = Object3D.GetBump(tex);
34013870
3402
- 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
+ }
34033881
34043882 double s = v.s;
34053883
....@@ -3447,12 +3925,26 @@
34473925
34483926 void Align()
34493927 {
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
+
34503942 for (int i=0; i<group.selection.size(); i++)
34513943 {
34523944 Object3D obj = group.selection.get(i);
34533945
3454
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3455
- 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);
34563948 }
34573949
34583950 refreshContents();
....@@ -3473,11 +3965,11 @@
34733965
34743966 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34753967
3476
- boolean random = CameraPane.RANDOM;
3477
- CameraPane.RANDOM = false; // parse all random nodes
3968
+ boolean random = CameraPane.SWITCH;
3969
+ CameraPane.SWITCH = false; // parse all random nodes
34783970 lowres.linkVerticesThis(null);
34793971 lowres.linkVerticesThis(sn);
3480
- CameraPane.RANDOM = random;
3972
+ CameraPane.SWITCH = random;
34813973
34823974 System.err.flush();
34833975
....@@ -3517,7 +4009,7 @@
35174009 return;
35184010
35194011 Object3D poses = group.selection.get(0);
3520
- Object3D ref = GrafreeD.clipboard.get(0);
4012
+ Object3D ref = Grafreed.clipboard.get(0);
35214013
35224014 Object3D newgroup = new Object3D("Po:" + poses.name);
35234015
....@@ -3686,7 +4178,7 @@
36864178 group.selection.RelinkToSupport(); // july 2014
36874179 System.out.println("DONE.");
36884180 refreshContents();
3689
- 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));
36904182 }
36914183
36924184 void ReduceMesh(boolean reduction34)
....@@ -3711,9 +4203,9 @@
37114203
37124204 void ClipMesh()
37134205 {
3714
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4206
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37154207 {
3716
- Object3D content = GrafreeD.clipboard.get(0);
4208
+ Object3D content = Grafreed.clipboard.get(0);
37174209
37184210 if (content instanceof cGroup && ((cGroup)content).transientlink )
37194211 content = ((cGroup)content).get(0);
....@@ -3722,7 +4214,7 @@
37224214 // {
37234215 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37244216 // }
3725
- group.selection.ClipMesh(GrafreeD.clipboard);
4217
+ group.selection.ClipMesh(Grafreed.clipboard);
37264218 }
37274219 // group.selection.ClipMesh(GrafreeD.clipboard);
37284220 System.out.println("DONE.");
....@@ -3769,6 +4261,18 @@
37694261 void MarkLeaves(boolean hide)
37704262 {
37714263 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);
37724276 refreshContents();
37734277 }
37744278
....@@ -3857,7 +4361,7 @@
38574361 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38584362
38594363 Object3D elem = (Object3D)group.selection.elementAt(i);
3860
- if(elem != group)
4364
+ if(elem != group || !newWindow)
38614365 {
38624366 // if (!(elem instanceof Composite))
38634367 // newWindow = false;
....@@ -3947,7 +4451,6 @@
39474451 //case 702: // Event.LIST_DESELECT
39484452 group.deselectAll();
39494453 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3950
- objEditor.ClearInfo(); // .GetMaterial());
39514454 if (tps != null)
39524455 {
39534456 for (int i=0; i < tps.length; i++)
....@@ -3956,31 +4459,30 @@
39564459
39574460 //if (child.parent != null)
39584461 //child.parent.addSelectee(child);
4462
+ objEditor.SetMaterial(child);
39594463 group.addSelectee(child);
3960
- objEditor.SetMaterial(child); // .GetMaterial());
3961
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3962
- System.err.println("info : " + child.GetPath());
39634464 }
39644465 }
3965
- else
3966
- {
3967
- objEditor.SetMaterial(group); // .GetMaterial());
3968
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3969
- System.err.println("info : " + group.GetPath());
3970
- }
4466
+// else
4467
+// {
4468
+// objEditor.SetMaterial(group); // .GetMaterial());
4469
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4470
+// System.err.println("info : " + group.GetPath());
4471
+// }
39714472
3972
- objEditor.SetText(); // jan 2014
3973
-
3974
- 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))
39754474 CameraPane.flash = true;
39764475
3977
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4476
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39784477 // a camera
39794478 {
3980
- CameraPane.camerachangeframe = 0; // don't refuse it
3981
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3982
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3983
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
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;
39844486 }
39854487
39864488 refreshContents();
....@@ -3991,6 +4493,26 @@
39914493
39924494 freezemodel = false;
39934495 }
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
+ }
39944516
39954517 void linkSomething(Object3D thing)
39964518 {
....@@ -4062,16 +4584,18 @@
40624584 {
40634585 if (group.selection.isEmpty())
40644586 return;
4065
- GrafreeD.clipboardIsTempGroup = false;
4587
+
4588
+ Grafreed.clipboardIsTempGroup = false;
40664589 Composite tGroup = null;
40674590 if (group.selection.size() > 0) // 1)
40684591 {
40694592 tGroup = new cGroup();
4070
- GrafreeD.clipboardIsTempGroup = true;
4593
+ Grafreed.clipboardIsTempGroup = true;
40714594 }
40724595
40734596 if (cut)
40744597 {
4598
+ Save();
40754599 //int indices[] = jList.getSelectedIndices();
40764600 //for (int i = indices.length - 1; i >= 0; i--)
40774601 //jList.remove(indices[i]);
....@@ -4107,16 +4631,16 @@
41074631 //System.out.println("cut " + child);
41084632 //System.out.println("parent = " + child.parent);
41094633 // tmp.addChild(child);
4110
- if (GrafreeD.clipboardIsTempGroup)
4634
+ if (Grafreed.clipboardIsTempGroup)
41114635 tGroup.add/*Child*/(tmp);
41124636 else
4113
- GrafreeD.clipboard = tmp;
4637
+ Grafreed.clipboard = tmp;
41144638 }
41154639 else
4116
- if (GrafreeD.clipboardIsTempGroup)
4640
+ if (Grafreed.clipboardIsTempGroup)
41174641 tGroup.add/*Child*/(child);
41184642 else
4119
- GrafreeD.clipboard = child;
4643
+ Grafreed.clipboard = child;
41204644 }
41214645
41224646 //ResetModel();
....@@ -4148,21 +4672,23 @@
41484672 //System.out.println("cut " + elem);
41494673 //System.out.println("parent = " + elem.parent);
41504674 // tmp.addChild(elem);
4151
- if (GrafreeD.clipboardIsTempGroup)
4675
+ if (Grafreed.clipboardIsTempGroup)
41524676 tGroup.add/*Child*/(tmp);
41534677 else
4154
- GrafreeD.clipboard = tmp;
4678
+ Grafreed.clipboard = tmp;
41554679 }
41564680 else
4157
- if (GrafreeD.clipboardIsTempGroup)
4681
+ if (Grafreed.clipboardIsTempGroup)
41584682 tGroup.add/*Child*/(child);
41594683 else
4160
- GrafreeD.clipboard = child;
4684
+ Grafreed.clipboard = child;
41614685 }
41624686
41634687 }
4164
- if (GrafreeD.clipboardIsTempGroup)
4165
- GrafreeD.clipboard = tGroup;
4688
+
4689
+ if (Grafreed.clipboardIsTempGroup)
4690
+ Grafreed.clipboard = tGroup;
4691
+
41664692 if (cut)
41674693 {
41684694 ResetModel();
....@@ -4176,7 +4702,7 @@
41764702 // return;
41774703 boolean first = true;
41784704
4179
- if (GrafreeD.clipboardIsTempGroup)
4705
+ if (Grafreed.clipboardIsTempGroup)
41804706 {
41814707 Composite temp;
41824708
....@@ -4187,7 +4713,7 @@
41874713 temp = (Composite)Applet3D.clipboard.deepCopy();
41884714 */
41894715 Object3D elem;
4190
- 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))
41914717 {
41924718 Object3D child = (Object3D)e.nextElement();
41934719
....@@ -4221,21 +4747,21 @@
42214747 //Object3D cb = Applet3D.clipboard;
42224748 //temp.addChild(cb);
42234749 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4224
- assert(GrafreeD.clipboard.parent == null);
4225
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4226
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4227
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4228
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
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());
42294755 else
4230
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4231
- GrafreeD.clipboard.get(0).parent = keepparent;
4756
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4757
+ Grafreed.clipboard.get(0).parent = keepparent;
42324758 }
42334759
42344760 ResetModel();
42354761 refreshContents();
42364762 }
42374763
4238
- void pasteInto(boolean copyit)
4764
+ void pasteInto(boolean copyit, boolean clone)
42394765 {
42404766 // if (GrafreeD.clipboard == null)
42414767 // return;
....@@ -4264,15 +4790,22 @@
42644790 if (copyit)
42654791 {
42664792 // paste(false);
4267
- CloneClipboard(false); // sept 2014
4793
+ if (clone)
4794
+ {
4795
+ CloneClipboard(false); // sept 2014
4796
+ }
4797
+ else
4798
+ {
4799
+ paste(false);
4800
+ }
42684801 }
42694802 else
42704803 {
42714804 boolean first = true;
42724805
4273
- if (GrafreeD.clipboardIsTempGroup)
4806
+ if (Grafreed.clipboardIsTempGroup)
42744807 {
4275
- Composite temp = (Composite)GrafreeD.clipboard;
4808
+ Composite temp = (Composite)Grafreed.clipboard;
42764809 Object3D copy;
42774810 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42784811 {
....@@ -4282,7 +4815,7 @@
42824815 }
42834816 } else
42844817 {
4285
- linkSomething(GrafreeD.clipboard); //.get(0));
4818
+ linkSomething(Grafreed.clipboard); //.get(0));
42864819 }
42874820 }
42884821 }
....@@ -4474,6 +5007,26 @@
44745007 makeSomething(csg);
44755008 }
44765009
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
+
44775030 void ungroup()
44785031 {
44795032 /*
....@@ -4667,21 +5220,6 @@
46675220 }
46685221 */
46695222
4670
- void ImportGFD()
4671
- {
4672
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4673
- browser.show();
4674
- String filename = browser.getFile();
4675
- if (filename != null && filename.length() > 0)
4676
- {
4677
- String fullname = browser.getDirectory() + filename;
4678
-
4679
- //Object3D readobj =
4680
- objEditor.ReadGFD(fullname, objEditor);
4681
- //makeSomething(readobj);
4682
- }
4683
- }
4684
-
46855223 /*
46865224 public void Callback(Object obj)
46875225 {
....@@ -4705,26 +5243,9 @@
47055243 }
47065244 */
47075245
4708
- void ImportVRMLX3D()
4709
- {
4710
- if (GrafreeD.standAlone)
4711
- {
4712
- /**/
4713
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4714
- browser.show();
4715
- String filename = browser.getFile();
4716
- if (filename != null && filename.length() > 0)
4717
- {
4718
- String fullname = browser.getDirectory() + filename;
4719
- LoadVRMLX3D(fullname);
4720
- }
4721
- /**/
4722
- }
4723
- }
4724
-
47255246 String GetFile(String dialogName)
47265247 {
4727
- if (GrafreeD.standAlone)
5248
+ if (Grafreed.standAlone)
47285249 {
47295250 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47305251 browser.show();
....@@ -4788,10 +5309,18 @@
47885309 cButton flashSelectionButton;
47895310 cButton editButton;
47905311 cButton uneditButton;
5312
+ JCheckBox allParamsButton;
47915313 cButton clearpanelButton;
4792
- cButton allParamsButton;
47935314 cButton unselectButton;
47945315
5316
+ cButton minButton;
5317
+ cButton maxButton;
5318
+ cButton fullButton;
5319
+ cButton undoButton;
5320
+ cButton redoButton;
5321
+ cButton saveButton;
5322
+ cButton oneStepButton;
5323
+
47955324 cButton screenfitButton;
47965325 cButton screenfitpointButton;
47975326 cButton snapobjectButton;
....@@ -4802,14 +5331,6 @@
48025331 cButton closeButton;
48035332
48045333 cButton setsupportButton;
4805
-
4806
- cButton twoButton;
4807
- cButton sixButton;
4808
- cButton threeButton;
4809
- cButton sevenButton;
4810
- cButton fourButton; // full panel
4811
- cButton oneButton; // full XYZ
4812
- //cButton currentLayout;
48135334
48145335 //
48155336 //Composite
....@@ -4822,6 +5343,8 @@
48225343 private MenuItem lookFromItem;
48235344 private MenuItem switchItem;
48245345 private MenuItem cutItem;
5346
+ private MenuItem undoItem;
5347
+ private MenuItem redoItem;
48255348 private MenuItem duplicateItem;
48265349 private MenuItem cloneItem;
48275350 private MenuItem cloneSupportItem;
....@@ -4833,8 +5356,9 @@
48335356 private MenuItem resetsupportItem;
48345357 private MenuItem resetreferencesItem;
48355358 private MenuItem linkverticesItem;
5359
+ private MenuItem relinkverticesItem;
48365360 private MenuItem setMasterItem;
4837
- private MenuItem resetMeshItem;
5361
+ private MenuItem resetAllItem;
48385362 private MenuItem stepAllItem;
48395363 private MenuItem revertMeshItem;
48405364 private MenuItem poseMeshItem;
....@@ -4845,6 +5369,7 @@
48455369 private MenuItem mergeGeometriesItem;
48465370 private MenuItem copyItem;
48475371 private MenuItem pasteItem;
5372
+ private MenuItem pasteIntoItem;
48485373 private MenuItem pasteLinkItem;
48495374 private MenuItem pasteCloneItem;
48505375 private MenuItem pasteExpandItem;
....@@ -4854,6 +5379,7 @@
48545379 private MenuItem genNormalsMESHItem;
48555380 private MenuItem genNormalsCADItem;
48565381 private MenuItem genNormalsORGANItem;
5382
+ private MenuItem genNormalsMINEItem;
48575383 private MenuItem stripifyItem;
48585384 private MenuItem unstripifyItem;
48595385 private MenuItem trimItem;
....@@ -4882,6 +5408,10 @@
48825408 private MenuItem showleavesItem;
48835409 private MenuItem markleavesItem;
48845410 private MenuItem unmarkleavesItem;
5411
+ private MenuItem rewindleavesItem;
5412
+ private MenuItem unrewindleavesItem;
5413
+ private MenuItem randomleavesItem;
5414
+ private MenuItem unrandomleavesItem;
48855415
48865416 private MenuItem flipVItem;
48875417 private MenuItem unflipVItem;
....@@ -4893,8 +5423,11 @@
48935423 private MenuItem panoTexturesItem;
48945424
48955425 private MenuItem resetCentroidItem;
4896
- private MenuItem transformgeometryItem;
5426
+ private MenuItem resetCentroidXZItem;
48975427 private MenuItem resetTransformItem;
5428
+ private MenuItem transformGeometryItem;
5429
+ private MenuItem transformChildrenItem;
5430
+ private MenuItem hideItem;
48985431 private MenuItem grabItem;
48995432 private MenuItem backItem;
49005433 private MenuItem frontItem;
....@@ -4915,6 +5448,7 @@
49155448
49165449 private MenuItem resetParentItem;
49175450 private MenuItem repairParentItem;
5451
+ private MenuItem repairShadowItem;
49185452 private MenuItem sortbysizeItem;
49195453 private MenuItem sortbynameItem;
49205454
....@@ -4935,10 +5469,11 @@
49355469 private MenuItem coneItem;
49365470 private MenuItem torusItem;
49375471 private MenuItem superItem;
5472
+ private MenuItem kleinItem;
49385473 private MenuItem blobItem;
49395474 private MenuItem latheItem;
49405475 private MenuItem bezierItem;
4941
- private MenuItem checkerItem;
5476
+ private MenuItem overlayItem;
49425477 private MenuItem meshItem;
49435478 // private MenuItem meshGroupItem;
49445479 private MenuItem springItem;
....@@ -4947,6 +5482,7 @@
49475482 private MenuItem csgItem;
49485483 private MenuItem templateItem;
49495484 private MenuItem textureItem;
5485
+ private MenuItem billboardItem;
49505486 private MenuItem shadowXItem;
49515487 private MenuItem shadowYItem;
49525488 private MenuItem shadowZItem;
....@@ -4959,11 +5495,6 @@
49595495 private MenuItem doubleItem;
49605496 private MenuItem tripleItem;
49615497
4962
- private MenuItem importGFDItem;
4963
- private MenuItem importVRMLX3DItem;
4964
- private MenuItem import3DSItem;
4965
- private MenuItem importOBJItem;
4966
-
49675498 private MenuItem computeAOItem;
49685499 private MenuItem recompileItem;
49695500 private MenuItem editScriptItem;
....@@ -4973,4 +5504,8 @@
49735504 private MenuItem analyzeItem;
49745505 private MenuItem dumpItem;
49755506 //boolean freezemodel = false;
5507
+
5508
+ Menu cameraMenu;
5509
+ MenuItem editCameraItem;
5510
+ MenuItem revertCameraItem;
49765511 }