Normand Briere
2019-06-24 914255f70cf047897212839cbf3a6722703f4457
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,19 +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);
222319 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223320 relinkverticesItem.addActionListener(this);
321
+
322
+ if (Globals.ADVANCED)
323
+ {
224324 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225325 setMasterItem.addActionListener(this);
326
+ }
226327
227328 oe.menuBar.add(menu = new Menu("Group"));
228329 grabItem = menu.add(new MenuItem("Grab"));
....@@ -233,27 +334,32 @@
233334 frontItem.addActionListener(this);
234335 compositeItem = menu.add(new MenuItem("Composite"));
235336 compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
337
+ hideItem = menu.add(new MenuItem("Hidden Group"));
237338 hideItem.addActionListener(this);
238339 ungroupItem = menu.add(new MenuItem("Ungroup"));
239340 ungroupItem.addActionListener(this);
240341 menu.add("-");
241
- randomItem = menu.add(new MenuItem("Random"));
342
+ randomItem = menu.add(new MenuItem("Switch node"));
242343 randomItem.addActionListener(this);
243
- physicsItem = menu.add(new MenuItem("Physics"));
244
- physicsItem.addActionListener(this);
245
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
246
- frameselectorItem.addActionListener(this);
247344 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248345 switchGeoItem.addActionListener(this);
249346 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250347 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
348
+ morphItem = menu.add(new MenuItem("Morph Group"));
252349 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);
253358 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254359 scriptNodeItem.addActionListener(this);
255360 cameraItem = menu.add(new MenuItem("Camera"));
256361 cameraItem.addActionListener(this);
362
+ }
257363
258364 oe.menuBar.add(menu = new Menu("Object"));
259365 textureItem = menu.add(new MenuItem("Texture"));
....@@ -262,27 +368,35 @@
262368 billboardItem.addActionListener(this);
263369 csgItem = menu.add(new MenuItem("CSG"));
264370 csgItem.addActionListener(this);
265
- shadowXItem = menu.add(new MenuItem("Shadow X"));
371
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
266372 shadowXItem.addActionListener(this);
267
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
373
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
268374 shadowYItem.addActionListener(this);
269
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
375
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
270376 shadowZItem.addActionListener(this);
377
+ if (Globals.ADVANCED)
378
+ {
379
+ menu.add("-");
271380 linkerItem = menu.add(new MenuItem("Linker"));
272381 linkerItem.addActionListener(this);
273
- templateItem = menu.add(new MenuItem("Template"));
274
- templateItem.addActionListener(this);
275382 attributeItem = menu.add(new MenuItem("Attribute"));
276383 attributeItem.addActionListener(this);
384
+ templateItem = menu.add(new MenuItem("Template"));
385
+ templateItem.addActionListener(this);
277386 pointflowItem = menu.add(new MenuItem("Point Flow"));
278387 pointflowItem.addActionListener(this);
388
+ }
279389 menu.add("-");
280390 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281391 resetTransformItem.addActionListener(this);
282392 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283393 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- transformgeometryItem.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);
286400
287401 oe.menuBar.add(menu = new Menu("Geometry"));
288402 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +407,11 @@
293407 genNormalsCADItem.addActionListener(this);
294408 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295409 genNormalsMESHItem.addActionListener(this);
410
+ if (Globals.ADVANCED)
411
+ {
296412 genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
297413 genNormalsMINEItem.addActionListener(this);
414
+ }
298415 stripifyItem = menu.add(new MenuItem("Stripify"));
299416 stripifyItem.addActionListener(this);
300417 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +433,34 @@
316433 reduce34MeshItem.addActionListener(this);
317434 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318435 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321436 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322437 clipMeshItem.addActionListener(this);
438
+
439
+ if (Globals.ADVANCED)
440
+ {
441
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
442
+ smoothMeshItem.addActionListener(this);
443
+ }
323444
324445 oe.menuBar.add(menu = new Menu("Attributes"));
325446 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326447 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);
327452 menu.add("-");
328453 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329454 liveleavesItem.addActionListener(this);
330455 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331456 unliveleavesItem.addActionListener(this);
457
+ if (Globals.ADVANCED)
458
+ {
332459 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333460 supportleavesItem.addActionListener(this);
334461 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335462 unsupportleavesItem.addActionListener(this);
463
+ }
336464 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337465 hideleavesItem.addActionListener(this);
338466 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -341,6 +469,14 @@
341469 markleavesItem.addActionListener(this);
342470 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
343471 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);
344480 menu.add("-");
345481 flipVItem = menu.add(new MenuItem("Flip V"));
346482 flipVItem.addActionListener(this);
....@@ -376,35 +512,40 @@
376512 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377513 sortbynameItem.addActionListener(this);
378514 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.
379522 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380523 extractGeometriesItem.addActionListener(this);
381524 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382525 cloneGeometriesItem.addActionListener(this);
383
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
- shareGeometriesItem.addActionListener(this);
385
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
- mergeGeometriesItem.addActionListener(this);
526
+ }
387527
388528 oe.menuBar.add(menu = new Menu("Insert"));
389529 buildCreateMenu(menu);
390530
391
-
392
- oe.menuBar.add(menu = new Menu("Include"));
393
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
- importGFDItem.addActionListener(this);
395
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
- importVRMLX3DItem.addActionListener(this);
397
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
398
- importOBJItem.addActionListener(this);
399
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
- import3DSItem.addActionListener(this);
401
-
402531 oe.menuBar.add(menu = new Menu("Tools"));
403532 buildToolsMenu(menu);
404533 }
405534
406535 void SetupUI2(ObjEditor oe)
407536 {
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
+
408549 //new Exception().printStackTrace();
409550
410551 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -433,150 +574,120 @@
433574 oe.radioPanel.add(dummyButton);
434575 oe.buttonGroup.add(dummyButton);
435576 */
436
- aConstraints.gridy += 1;
437
- oe.aConstraints.gridwidth = 1;
438
- oe.aConstraints.gridx = 0;
577
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
439578
440
- 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 = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
+ maxButton.setToolTipText("Maximize window");
585
+ maxButton.addActionListener(this);
586
+
587
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ fullButton.setToolTipText("Full-screen window");
589
+ fullButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ undoButton.setToolTipText("Undo changes");
593
+ undoButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ redoButton.setToolTipText("Redo changes");
597
+ redoButton.addActionListener(this);
598
+
599
+ oe.toolbarPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ saveButton.setToolTipText("Save changes");
601
+ saveButton.addActionListener(this);
602
+
603
+ oe.toolbarPanel.add(liveCB = GetCheckBox("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604
+ liveCB.setToolTipText("Enable animation");
441605 liveCB.addItemListener(this);
442606
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
445
- supportCB.addItemListener(this);
446
-
447
- // oe.aConstraints.gridx += 1;
448
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
449
- // localCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
453
- crowdCB.addItemListener(this);
454
-
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
457
- smoothCB.addItemListener(this);
458
-
459
- oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
607
+ oe.toolbarPanel.add(fastCB = GetCheckBox("icons/runfast.png", CameraPane.FAST)); //, constraints);
608
+ fastCB.setToolTipText("Fast mode");
461609 fastCB.addItemListener(this);
462
- oe.aConstraints.gridx += 1;
463
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
464
- slowCB.addItemListener(this);
465
- oe.aConstraints.gridx += 1;
466
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
467
- boxCB.addItemListener(this);
468
-
469
-// oe.aConstraints.gridx += 1;
470
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
471
-// speakerMocapCB.addItemListener(this);
472
-
473
- if (false)
474
- {
475
- // handled in scripts
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
478
- speakerCameraCB.addItemListener(this);
479
-
480
- oe.aConstraints.gridx += 1;
481
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
482
- speakerFocusCB.addItemListener(this);
483
-
484
- oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
486
- smoothfocusCB.addItemListener(this);
487
- }
488
-
489
-//oe.aConstraints.gridx += 1;
490
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
491
-// debugCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
495
- oeilCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
499
- lookAtCB.addItemListener(this);
500
-
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
610
+
611
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ oneStepButton.setToolTipText("Animate one step forward");
613
+ oneStepButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(trackCB = GetCheckBox("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
616
+ trackCB.setToolTipText("Enable tracking");
503617 trackCB.addItemListener(this);
504618
505
- oe.aConstraints.gridx += 1;
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ screenfitButton.setToolTipText("Screen fit");
507621 screenfitButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
622
+
509623 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
510624 // screenfitpointButton.addActionListener(this);
511
-// oe.aConstraints.gridx += 1;
512
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
513
- snapobjectButton.addActionListener(this);
514
- oe.aConstraints.gridx += 1;
515625
516
- //aConstraints.gridx = 0;
517
- //aConstraints.gridy += 1;
518
- oe.aConstraints.weighty = 0;
519
- oe.aConstraints.gridwidth = 1;
520
-
521
- 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 = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ flashSelectionButton.setToolTipText("Highlight selection");
522635 flashSelectionButton.addActionListener(this);
523
- oe.aConstraints.gridx += 1;
524
- oe.aConstraints.weighty = 0;
525
- oe.aConstraints.gridwidth = 1;
526636
527
- //
528
- 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");
529641 twoButton.addActionListener(this);
530
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
642
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
531643 fourButton.addActionListener(this);
532
- 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");
533647 sixButton.addActionListener(this);
534
- 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");
535650 threeButton.addActionListener(this);
536
- 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");
537653 sevenButton.addActionListener(this);
538654 //
539655
540
- 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");
541658 rootButton.addActionListener(this);
542
- oe.aConstraints.gridx += 1;
543
- 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");
544662 closeButton.addActionListener(this);
545663 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
546664 //clearButton.addActionListener(this);
547
- oe.aConstraints.gridx += 1;
548665
549
- oe.aConstraints.gridx = 1; //
550
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
666
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
+ editButton.setToolTipText("Edit selection");
551668 editButton.addActionListener(this);
552
- oe.aConstraints.gridx += 1;
553
- oe.aConstraints.weighty = 0;
554
- oe.aConstraints.gridwidth = 1;
555669
556
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
670
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
+ uneditButton.setToolTipText("Unedit selection");
557672 uneditButton.addActionListener(this);
558673
559
- oe.aConstraints.gridx += 1;
560
- oe.aConstraints.weighty = 0;
561
- oe.aConstraints.gridwidth = 1;
562
-
563
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
564
- clearPanelButton.addActionListener(this);
565
-
566
- oe.aConstraints.gridx += 1;
567
- oe.aConstraints.weighty = 0;
568
- oe.aConstraints.gridwidth = 1;
569
-
570
- 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");
571676 allParamsButton.addActionListener(this);
572677
573
- oe.aConstraints.gridx += 1;
574
- oe.aConstraints.weighty = 0;
575
- oe.aConstraints.gridwidth = 1;
576
-
577
- 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");
578684 unselectButton.addActionListener(this);
579685
686
+ editCommandsPanel.preferredHeight = 1;
687
+
688
+// oe.treePanel.add(commandsPanel);
689
+// oe.treePanel.Return();
690
+
580691 // oe.aConstraints.gridx += 1;
581692 // oe.aConstraints.weighty = 0;
582693 // oe.aConstraints.gridwidth = 1;
....@@ -588,40 +699,37 @@
588699 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
589700 // gcButton.addActionListener(this);
590701
591
- oe.aConstraints.gridx = 0;
592
- oe.aConstraints.gridy += 1;
593
-
594
- //ctrlPanel.add(objList = new List(5, true));
595
- oe.aConstraints.gridwidth = 100;
596
- // oe.aConstraints.gridheight = 100;
597
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
598
- oe.aConstraints.gridheight = 1;
599
- oe.aConstraints.weighty = 0.5;
600
- oe.aConstraints.gridx = 0;
601
- JScrollPane jSP;
702
+ cGridBag jSPPanel = new cGridBag();
703
+
704
+ JScrollPane jSP;
602705 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
603
- 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);
604707 ResetModel();
605
- oe.aConstraints.weighty = 0.5;
606
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
607
- oe.aConstraints.gridy += 1;
608
- oe.aConstraints.gridwidth = 1;
708
+
709
+ oe.treePanel.add(jSPPanel);
710
+ oe.treePanel.Return();
609711
610
- oe.aConstraints.weighty = 0;
611
- oe.aConstraints.gridwidth = 2;
612
-
613
- 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");
614716 colorCB.addItemListener(this);
615
- oe.aConstraints.gridx += 2;
616
- 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");
617720 materialCB.addItemListener(this);
618
- oe.aConstraints.gridx += 2;
619
- 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");
620724 textureCB.addItemListener(this);
621725
622
- oe.aConstraints.gridx = 0;
623
- oe.aConstraints.gridy += 1;
726
+ copyOptionsPanel.preferredHeight = 1;
727
+ oe.treePanel.add(copyOptionsPanel);
728
+ oe.treePanel.Return();
624729
730
+// mainPanel.setDividerLocation(0.5); //1.0);
731
+// mainPanel.setResizeWeight(0.5);
732
+
625733 //jList.addListSelectionListener(this);
626734 oe.jTree.addTreeSelectionListener(this);
627735 //jTree.setRootVisible(false);
....@@ -643,20 +751,115 @@
643751 radio.layout = sevenButton;
644752 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
645753 }
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
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
819
+ autosaveCB.setToolTipText("Auto-save on structure change");
820
+ autosaveCB.addItemListener(this);
821
+
822
+ if (Globals.ADVANCED)
823
+ {
824
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
825
+ lookAtCB.setToolTipText("Look-at target");
826
+ lookAtCB.addItemListener(this);
827
+ }
828
+
829
+ }
830
+
831
+ cGridBag fill = new cGridBag();
832
+
833
+ fill.preferredHeight = 200;
834
+
835
+ panel.add(fill);
836
+
837
+ }
646838
647839 void EditObject(Object3D obj)
648840 {
649
- cRadio dummyButton = new cRadio(obj.name);
650
- dummyButton.SetObject(obj);
651
- dummyButton.layout = sevenButton;
652
- dummyButton.SetCamera(cameraView.renderCamera, false);
653
- dummyButton.addActionListener(this);
654
- radioPanel.add(dummyButton);
655
- buttonGroup.add(dummyButton);
656
- dummyButton.doClick();
841
+ cRadio radioButton = new cRadio(obj.name);
842
+
843
+ // Patch to avoid bug with transparency.
844
+ radioButton.hadMaterial = obj.material != null;
845
+ if (!radioButton.hadMaterial)
846
+ {
847
+ obj.material = new cMaterial();
848
+ }
849
+
850
+ radioButton.SetObject(obj);
851
+ radioButton.layout = sevenButton;
852
+ radioButton.SetCamera(cameraView.renderCamera, false);
853
+ radioButton.addActionListener(this);
854
+ radioPanel.add(radioButton);
855
+ buttonGroup.add(radioButton);
856
+ radioButton.doClick();
657857 }
858
+
658859 void SetupViews(ObjEditor oe)
659860 {
861
+ theFrame = this;
862
+
660863 oe.SetupViews();
661864
662865 System.out.println("SetupViews");
....@@ -665,22 +868,26 @@
665868 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
666869 }
667870
668
- JCheckBox liveCB;
669
- JCheckBox supportCB;
670
- JCheckBox localCB;
671
- JCheckBox crowdCB;
672
- JCheckBox smoothCB;
673
- JCheckBox fastCB;
674
- JCheckBox slowCB;
675
- JCheckBox boxCB;
676
- JCheckBox trackCB;
677
- JCheckBox smoothfocusCB;
871
+ cCheckBox liveCB;
872
+ cCheckBox supportCB;
873
+ cCheckBox localCB;
874
+ cCheckBox crowdCB;
875
+ cCheckBox smoothCB;
876
+ cCheckBox fastCB;
877
+ cCheckBox slowCB;
878
+ cCheckBox boxCB;
879
+ cCheckBox zoomBoxCB;
880
+ cCheckBox trackCB;
881
+ cCheckBox smoothfocusCB;
678882 // JCheckBox speakerMocapCB;
679
- JCheckBox speakerCameraCB;
680
- JCheckBox speakerFocusCB;
681
- JCheckBox debugCB;
682
- JCheckBox oeilCB;
683
- JCheckBox lookAtCB;
883
+ cCheckBox speakerCameraCB;
884
+ cCheckBox speakerFocusCB;
885
+ cCheckBox debugCB;
886
+
887
+ cCheckBox oeilCB;
888
+ cCheckBox shadowCB;
889
+ cCheckBox autosaveCB;
890
+ cCheckBox lookAtCB;
684891
685892 // static int COLOR = 1;
686893 // static int MATERIAL = 2;
....@@ -688,9 +895,9 @@
688895
689896 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
690897
691
- JCheckBox colorCB;
692
- JCheckBox materialCB;
693
- JCheckBox textureCB;
898
+ cCheckBox colorCB;
899
+ cCheckBox materialCB;
900
+ cCheckBox textureCB;
694901
695902 public void itemStateChanged(ItemEvent e)
696903 {
....@@ -715,10 +922,10 @@
715922 dropAttributes |= Object3D.TEXTURE;
716923 else
717924 dropAttributes &= ~Object3D.TEXTURE;
718
- }
719
- else if(e.getSource() == liveCB)
925
+ } else if(e.getSource() == liveCB)
720926 {
721927 cameraView.ToggleLive();
928
+ refreshContents(false);
722929 }
723930 else if(e.getSource() == supportCB)
724931 {
....@@ -754,6 +961,10 @@
754961 cameraView.repaint();
755962 // refreshContents();
756963 }
964
+ else if(e.getSource() == zoomBoxCB)
965
+ {
966
+ cameraView.ToggleZoomBoxMode();
967
+ }
757968 else if(e.getSource() == smoothfocusCB)
758969 {
759970 cameraView.ToggleSmoothFocus();
....@@ -778,6 +989,14 @@
778989 else if(e.getSource() == oeilCB)
779990 {
780991 cameraView.ToggleOeil();
992
+ }
993
+ else if(e.getSource() == shadowCB)
994
+ {
995
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
996
+ }
997
+ else if(e.getSource() == autosaveCB)
998
+ {
999
+ Globals.SAVEONMAKE ^= true;
7811000 }
7821001 else if(e.getSource() == lookAtCB)
7831002 {
....@@ -867,7 +1086,9 @@
8671086 // objEditor.DropFile((java.io.File[]) object, true);
8681087 // return;
8691088 // }
870
- if (string.charAt(0) == '/')
1089
+
1090
+ // File path for Mac and Windows
1091
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8711092 {
8721093 // file(s)
8731094 String[] names = string.split("\n");
....@@ -894,7 +1115,7 @@
8941115
8951116 flashIt = false;
8961117 CameraPane pane = (CameraPane) target;
897
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1118
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8981119 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8991120
9001121 if (group.selection.size() == 1)
....@@ -921,11 +1142,11 @@
9211142 {
9221143 loadClipboard(true);
9231144 objEditor.jTree.setSelectionPath(destinationPath);
924
- pasteInto(false);
1145
+ pasteInto(false, false);
9251146 } else {
9261147 loadClipboard(false);
9271148 objEditor.jTree.setSelectionPath(destinationPath);
928
- pasteInto(false); // true); // ???
1149
+ pasteInto(false, false); // true); // ???
9291150 }
9301151 }
9311152 public void dropActionChanged(DropTargetDragEvent dtde)
....@@ -1047,27 +1268,33 @@
10471268 kleinItem.addActionListener(this);
10481269 particleItem = menu.add(new MenuItem("Particle system"));
10491270 particleItem.addActionListener(this);
1271
+ if (Globals.ADVANCED)
1272
+ {
10501273 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10511274 ragdollItem.addActionListener(this);
10521275 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10531276 ragdoll2Item.addActionListener(this);
1277
+ }
10541278 menu.add("-");
1055
- meshItem = menu.add(new MenuItem("Mesh"));
1279
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10561280 meshItem.addActionListener(this);
10571281 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10581282 // meshGroupItem.addActionListener(this);
1283
+ if (Globals.ADVANCED)
1284
+ {
10591285 springItem = menu.add(new MenuItem("Spring"));
10601286 springItem.addActionListener(this);
10611287 flagItem = menu.add(new MenuItem("Flag"));
10621288 flagItem.addActionListener(this);
1063
- bezierItem = menu.add(new MenuItem("Patch"));
1064
- bezierItem.addActionListener(this);
1065
- checkerItem = menu.add(new MenuItem("Checker"));
1066
- checkerItem.addActionListener(this);
10671289 blobItem = menu.add(new MenuItem("Blob"));
10681290 blobItem.addActionListener(this);
10691291 latheItem = menu.add(new MenuItem("Lathe"));
10701292 latheItem.addActionListener(this);
1293
+ }
1294
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1295
+ bezierItem.addActionListener(this);
1296
+ overlayItem = menu.add(new MenuItem("Overlay"));
1297
+ overlayItem.addActionListener(this);
10711298 lightItem = menu.add(new MenuItem("Light"));
10721299 lightItem.addActionListener(this);
10731300 menu.add("-");
....@@ -1077,39 +1304,44 @@
10771304 loopItem.addActionListener(this);
10781305 doubleItem = menu.add(new MenuItem("Fork"));
10791306 doubleItem.addActionListener(this);
1307
+ if (Globals.ADVANCED)
1308
+ {
10801309 tripleItem = menu.add(new MenuItem("Trident"));
10811310 tripleItem.addActionListener(this);
1311
+ }
10821312 }
10831313
10841314 void buildToolsMenu(Menu menu)
10851315 {
10861316 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10871317 animationItem.addItemListener(this);
1088
- animationItem.setState(CameraPane.ANIMATION);
1318
+ animationItem.setState(Globals.ANIMATION);
10891319
10901320 menu.add("-");
10911321 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10921322 parseverticesItem.addActionListener(this);
10931323 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10941324 textureFieldItem.addActionListener(this);
1095
- alignItem = menu.add(new MenuItem("Align"));
1325
+ alignItem = menu.add(new MenuItem("Align Objects"));
10961326 alignItem.addActionListener(this);
1097
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1098
- mirrorItem.addActionListener(this);
10991327 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11001328 reduceMorphItem.addActionListener(this);
11011329 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11021330 reduce34MorphItem.addActionListener(this);
1103
-
1331
+ menu.add("-");
11041332 menu.add(computeAOItem = new MenuItem("Compute AO"));
11051333 computeAOItem.addActionListener(this);
1106
- menu.add("-");
11071334
1335
+ if (Globals.ADVANCED)
1336
+ {
1337
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1338
+ mirrorItem.addActionListener(this);
1339
+ menu.add("-");
11081340 menu.add(memoryItem = new MenuItem("Memory Usage"));
11091341 memoryItem.addActionListener(this);
11101342 menu.add(analyzeItem = new MenuItem("Analyze"));
11111343 analyzeItem.addActionListener(this);
1112
- menu.add(dumpItem = new MenuItem("Dump"));
1344
+ menu.add(dumpItem = new MenuItem("Print"));
11131345 dumpItem.addActionListener(this);
11141346 // menu.add(pathItem = new MenuItem("From-to path"));
11151347 // pathItem.addActionListener(this);
....@@ -1118,6 +1350,8 @@
11181350 resetParentItem.addActionListener(this);
11191351 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11201352 repairParentItem.addActionListener(this);
1353
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1354
+ repairShadowItem.addActionListener(this);
11211355 menu.add(invariantsItem = new MenuItem("Invariants"));
11221356 invariantsItem.addActionListener(this);
11231357 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1125,6 +1359,7 @@
11251359 menu.add("-");
11261360 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11271361 editScriptItem.addActionListener(this);
1362
+ }
11281363 }
11291364
11301365 void ScreenFit()
....@@ -1247,6 +1482,7 @@
12471482 shadow.material = new cMaterial(obj.material);
12481483 shadow.material.diffuse = 0.0001f;
12491484 shadow.material.specular = 0.0001f;
1485
+ //shadow.projectedVertices[1].x = 300;
12501486
12511487 makeSomething(shadow);
12521488 }
....@@ -1453,9 +1689,9 @@
14531689
14541690 void Overwrite(int mask)
14551691 {
1456
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1692
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14571693 {
1458
- Object3D content = GrafreeD.clipboard.get(0);
1694
+ Object3D content = Grafreed.clipboard.get(0);
14591695
14601696 if (content instanceof cGroup && ((cGroup)content).transientlink )
14611697 content = ((cGroup)content).get(0);
....@@ -1478,6 +1714,7 @@
14781714 //
14791715 public void actionPerformed(ActionEvent event) // , Object arg)
14801716 {
1717
+ Object source = event.getSource();
14811718 /*
14821719 if (event.getSource() == nameField)
14831720 {
....@@ -1489,11 +1726,11 @@
14891726 }
14901727 else
14911728 */
1492
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1729
+ if (source == lookAtItem || source == lookFromItem)
14931730 {
14941731 ScreenFit();
14951732 } else
1496
- if (event.getSource() == switchItem)
1733
+ if (source == switchItem)
14971734 {
14981735 cVector v1 = new cVector();
14991736 cVector v2 = new cVector();
....@@ -1502,11 +1739,11 @@
15021739 objEditor.cameraView.renderCamera.setAim(v2, v1);
15031740 objEditor.cameraView.repaint();
15041741 } else
1505
- if (event.getSource() == rectoidItem)
1742
+ if (source == rectoidItem)
15061743 {
15071744 makeSomething(new Box());
15081745 } else
1509
- if (event.getSource() == particleItem)
1746
+ if (source == particleItem)
15101747 {
15111748 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15121749 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1527,9 +1764,9 @@
15271764 applyExample(particleGeom, "SMOKE");
15281765 makeSomething(particleGeom);
15291766 } else
1530
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1767
+ if (source == ragdollItem || source == ragdoll2Item)
15311768 {
1532
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1769
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15331770
15341771 ragdoll.toParent = LA.newMatrix();
15351772 ragdoll.fromParent = LA.newMatrix();
....@@ -1547,7 +1784,7 @@
15471784 } else
15481785 /*
15491786 */
1550
- if (event.getSource() == heightFieldItem)
1787
+ if (source == heightFieldItem)
15511788 {
15521789 Object3D obj = new Object3D();
15531790
....@@ -1585,31 +1822,31 @@
15851822
15861823 makeSomething(obj);
15871824 } else
1588
- if (event.getSource() == gridItem)
1825
+ if (source == gridItem)
15891826 {
15901827 makeSomething(new Grid());
15911828 } else
1592
- if (event.getSource() == ellipsoidItem)
1829
+ if (source == ellipsoidItem)
15931830 {
15941831 makeSomething(new Sphere());
15951832 } else
1596
- if (event.getSource() == coneItem)
1833
+ if (source == coneItem)
15971834 {
15981835 makeSomething(new Cone());
15991836 } else
1600
- if (event.getSource() == torusItem)
1837
+ if (source == torusItem)
16011838 {
16021839 makeSomething(new Torus());
16031840 } else
1604
- if (event.getSource() == superItem)
1841
+ if (source == superItem)
16051842 {
16061843 makeSomething(new Superellipsoid());
16071844 } else
1608
- if (event.getSource() == kleinItem)
1845
+ if (source == kleinItem)
16091846 {
16101847 makeSomething(new Klein());
16111848 } else
1612
- if (event.getSource() == blobItem)
1849
+ if (source == blobItem)
16131850 {
16141851 Blob blob = new Blob();
16151852 BlobComponent comp = new BlobComponent();
....@@ -1617,15 +1854,15 @@
16171854 //blob.retile();
16181855 makeSomething(blob);
16191856 } else
1620
- if (event.getSource() == latheItem)
1857
+ if (source == latheItem)
16211858 {
16221859 makeSomething(new Lathe());
16231860 } else
1624
- if (event.getSource() == bezierItem)
1861
+ if (source == bezierItem)
16251862 {
16261863 makeSomething(new BezierSurface());
16271864 } else
1628
- if (event.getSource() == checkerItem)
1865
+ if (source == overlayItem)
16291866 {
16301867 /*
16311868 Object3D obj = new BezierSurface(5,8);
....@@ -1640,7 +1877,7 @@
16401877 */
16411878 makeSomething(new Checker());
16421879 } else
1643
- if (event.getSource() == meshItem)
1880
+ if (source == meshItem)
16441881 {
16451882 Object3D itemtomake = new Object3D();
16461883 Object3D child;
....@@ -1661,35 +1898,35 @@
16611898 makeSomething(child);
16621899 }
16631900 } else
1664
- if (event.getSource() == springItem)
1901
+ if (source == springItem)
16651902 {
16661903 cSpring s = new cSpring();
16671904 s.setup();
16681905 makeSomething(s);
16691906 } else
1670
- if (event.getSource() == flagItem)
1907
+ if (source == flagItem)
16711908 {
16721909 cSpring s = new cFlag();
16731910 s.setup();
16741911 makeSomething(s);
16751912 } else
1676
- if (event.getSource() == lightItem)
1913
+ if (source == lightItem)
16771914 {
16781915 makeSomething(new Light());
16791916 } else
1680
- if (event.getSource() == csgItem)
1917
+ if (source == csgItem)
16811918 {
16821919 group(new CSG());
16831920 } else
1684
- if (event.getSource() == templateItem)
1921
+ if (source == templateItem)
16851922 {
16861923 group(new cTemplate());
16871924 } else
1688
- if (event.getSource() == attributeItem)
1925
+ if (source == attributeItem)
16891926 {
16901927 makeSomething(new Attribute());
16911928 } else
1692
- if (event.getSource() == pointflowItem)
1929
+ if (source == pointflowItem)
16931930 {
16941931 makeSomething(new PointFlow());
16951932 } else
....@@ -1701,7 +1938,7 @@
17011938 } else
17021939 */
17031940
1704
- if (event.getSource() == superLoopItem)
1941
+ if (source == superLoopItem)
17051942 {
17061943 Composite g = new cGroup();
17071944 for (int i=0; i<15; i++)
....@@ -1723,7 +1960,7 @@
17231960
17241961 group(g);
17251962 } else
1726
- if (event.getSource() == loopItem)
1963
+ if (source == loopItem)
17271964 {
17281965 Composite csg = new GroupLeaf();
17291966 csg.count = 5;
....@@ -1732,7 +1969,7 @@
17321969 csg.addChild(child);
17331970 child.addChild(csg);
17341971 } else
1735
- if (event.getSource() == doubleItem)
1972
+ if (source == doubleItem)
17361973 {
17371974 Composite csg = new GroupLeaf();
17381975 csg.count = 5;
....@@ -1744,7 +1981,7 @@
17441981 csg.addChild(child);
17451982 child.addChild(csg);
17461983 } else
1747
- if (event.getSource() == tripleItem)
1984
+ if (source == tripleItem)
17481985 {
17491986 Composite csg = new GroupLeaf();
17501987 csg.count = 4;
....@@ -1759,71 +1996,83 @@
17591996 csg.addChild(child);
17601997 child.addChild(csg);
17611998 } else
1762
-
1763
- if (event.getSource() == importGFDItem)
1999
+ if (source == computeAOItem)
17642000 {
1765
- ImportGFD();
2001
+ Globals.drawMode = CameraPane.OCCLUSION;
2002
+ Globals.theRenderer.repaint();
17662003 } else
1767
- if (event.getSource() == importVRMLX3DItem)
1768
- {
1769
- ImportVRMLX3D();
1770
- } else
1771
- if (event.getSource() == import3DSItem)
1772
- {
1773
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1774
- } else
1775
- if (event.getSource() == importOBJItem)
1776
- {
1777
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1778
- } else
1779
- if (event.getSource() == computeAOItem)
1780
- {
1781
- CameraPane.drawMode = CameraPane.OCCLUSION;
1782
- CameraPane.theRenderer.repaint();
1783
- } else
1784
- if (event.getSource() == recompileItem)
2004
+ if (source == recompileItem)
17852005 {
17862006 Recompile();
17872007 refreshContents();
17882008 } else
1789
- if (event.getSource() == editScriptItem)
2009
+ if (source == editScriptItem)
17902010 {
17912011 OpenDialog();
17922012 refreshContents();
17932013 } else
1794
- if (event.getSource() == invariantsItem)
2014
+ if (source == invariantsItem)
17952015 {
17962016 System.out.println("Invariants:");
1797
- GrafreeD.grafreeD.universe.invariants();
2017
+ Grafreed.grafreeD.universe.invariants();
17982018 } else
1799
- if (event.getSource() == memoryItem)
2019
+ if (source == memoryItem)
18002020 {
18012021 //System.out.println("Invariants:");
18022022 PrintMemory();
18032023 } else
1804
- if (event.getSource() == pathItem)
2024
+ if (source == pathItem)
18052025 {
18062026 PrintPath();
18072027 } else
1808
- if (event.getSource() == analyzeItem)
2028
+ if (source == analyzeItem)
18092029 {
18102030 AnalyzeObject();
18112031 } else
1812
- if (event.getSource() == dumpItem)
2032
+ if (source == dumpItem)
18132033 {
18142034 DumpObject();
18152035 } else
1816
- if (event.getSource() == screenfitButton)
2036
+ if (source == minButton)
2037
+ {
2038
+ Minimize();
2039
+ } else
2040
+ if (source == maxButton)
2041
+ {
2042
+ Maximize();
2043
+ } else
2044
+ if (source == fullButton)
2045
+ {
2046
+ ToggleFullScreen();
2047
+ } else
2048
+ if (source == undoButton)
2049
+ {
2050
+ Undo();
2051
+ } else
2052
+ if (source == redoButton)
2053
+ {
2054
+ Redo();
2055
+ } else
2056
+ if (source == saveButton)
2057
+ {
2058
+ Save();
2059
+ } else
2060
+ if (source == oneStepButton)
2061
+ {
2062
+ Globals.ONESTEP = true;
2063
+ cameraView.repaint();
2064
+ } else
2065
+ if (source == screenfitButton)
18172066 {
18182067 //Reload(lastConverter, lastFilename, true);
18192068 ScreenFit();
18202069 } else
1821
- if (event.getSource() == screenfitpointButton)
2070
+ if (source == screenfitpointButton)
18222071 {
18232072 //Reload(lastConverter, lastFilename, true);
18242073 ScreenFitPoint();
18252074 } else
1826
- if (event.getSource() == snapobjectButton)
2075
+ if (source == snapobjectButton)
18272076 {
18282077 //Reload(lastConverter, lastFilename, true);
18292078 SnapObject();
....@@ -1834,13 +2083,13 @@
18342083 // Recompile();
18352084 // refreshContents();
18362085 // } else
1837
- if (event.getSource() == gcButton)
2086
+ if (source == gcButton)
18382087 {
18392088 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18402089 System.gc();
18412090 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18422091 } else
1843
- if (event.getSource() == editLeafItem)
2092
+ if (source == editLeafItem)
18442093 {
18452094 Object3D obj;
18462095 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1854,62 +2103,74 @@
18542103 }
18552104 refreshContents(true);
18562105 } else
1857
- if (event.getSource() == openWindowItem)
2106
+ if (source == openWindowItem)
18582107 {
18592108 EditSelection(true);
18602109 } else
1861
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2110
+ if (source == cutItem || source == clearButton)
18622111 {
18632112 loadClipboard(true);
18642113 } else
1865
- if (event.getSource() == duplicateItem)
2114
+ if (source == undoItem)
18662115 {
1867
- Object3D keep = GrafreeD.clipboard;
2116
+ Undo();
2117
+ } else
2118
+ if (source == redoItem)
2119
+ {
2120
+ Redo();
2121
+ } else
2122
+ if (source == duplicateItem)
2123
+ {
2124
+ Object3D keep = Grafreed.clipboard;
18682125 loadClipboard(false);
18692126 paste(false);
1870
- GrafreeD.clipboard = keep;
2127
+ Grafreed.clipboard = keep;
18712128 } else
1872
- if (event.getSource() == cloneItem)
2129
+ if (source == cloneItem)
18732130 {
18742131 CloneSelection(false);
18752132 } else
1876
- if (event.getSource() == cloneSupportItem)
2133
+ if (source == cloneSupportItem)
18772134 {
18782135 CloneSelection(true);
18792136 } else
1880
- if (event.getSource() == copyItem)
2137
+ if (source == copyItem)
18812138 {
18822139 loadClipboard(false);
18832140 } else
1884
- if (event.getSource() == pasteItem)
2141
+ if (source == pasteItem)
18852142 {
18862143 paste(false);
18872144 } else
1888
- if (event.getSource() == pasteLinkItem)
2145
+ if (source == pasteIntoItem)
18892146 {
1890
- pasteInto(false);
2147
+ pasteInto(true, false);
18912148 } else
1892
- if (event.getSource() == pasteCloneItem)
2149
+ if (source == pasteLinkItem)
18932150 {
1894
- pasteInto(true);
2151
+ pasteInto(false, false);
18952152 } else
1896
- if (event.getSource() == pasteExpandItem)
2153
+ if (source == pasteCloneItem)
2154
+ {
2155
+ pasteInto(true, true);
2156
+ } else
2157
+ if (source == pasteExpandItem)
18972158 {
18982159 paste(true);
18992160 } else
1900
- if (event.getSource() == synchronizeItem)
2161
+ if (source == synchronizeItem)
19012162 {
19022163 Overwrite(Object3D.TRANSFORM);
19032164 } else
1904
- if (event.getSource() == overwriteNameItem)
2165
+ if (source == overwriteNameItem)
19052166 {
19062167 Overwrite(Object3D.NAME);
19072168 } else
1908
- if (event.getSource() == overwriteUVItem)
2169
+ if (source == overwriteUVItem)
19092170 {
19102171 Overwrite(Object3D.UV);
19112172 } else
1912
- if (event.getSource() == overwriteMatItem)
2173
+ if (source == overwriteMatItem)
19132174 {
19142175 /* july 2015
19152176 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1929,7 +2190,7 @@
19292190
19302191 Overwrite(dropAttributes);
19312192 }
1932
- if (event.getSource() == overwriteGeoItem)
2193
+ if (source == overwriteGeoItem)
19332194 {
19342195 Overwrite(Object3D.GEOMETRY);
19352196 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1946,7 +2207,7 @@
19462207 // refreshContents();
19472208 // }
19482209 } else
1949
- if (event.getSource() == generateMeshItem)
2210
+ if (source == generateMeshItem)
19502211 {
19512212 //if (group.selection.size() == 1)
19522213 // for (int i=0; i<group.selection.size(); i++)
....@@ -1957,7 +2218,7 @@
19572218 ResetModel();
19582219 refreshContents();
19592220 } else
1960
- if (event.getSource() == extractGeometriesItem)
2221
+ if (source == extractGeometriesItem)
19612222 {
19622223 boolean one = false;
19632224
....@@ -1984,7 +2245,7 @@
19842245 ResetModel();
19852246 refreshContents();
19862247 } else
1987
- if (event.getSource() == cloneGeometriesItem)
2248
+ if (source == cloneGeometriesItem)
19882249 {
19892250 boolean one = false;
19902251
....@@ -2010,7 +2271,7 @@
20102271 ResetModel();
20112272 refreshContents();
20122273 } else
2013
- if (event.getSource() == shareGeometriesItem)
2274
+ if (source == shareGeometriesItem)
20142275 {
20152276 boolean one = false;
20162277
....@@ -2040,7 +2301,7 @@
20402301 refreshContents();
20412302 }
20422303 } else
2043
- if (event.getSource() == mergeGeometriesItem)
2304
+ if (source == mergeGeometriesItem)
20442305 {
20452306 boolean one = false;
20462307
....@@ -2070,7 +2331,7 @@
20702331 ResetModel();
20712332 refreshContents();
20722333 } else
2073
- if (event.getSource() == linkverticesItem)
2334
+ if (source == linkverticesItem)
20742335 {
20752336 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20762337 // {
....@@ -2083,48 +2344,48 @@
20832344 // group.selection.get(0).setMasterThis(content); // should be identity
20842345 // refreshContents();
20852346 // }
2086
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2347
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20872348 {
2088
- Object3D content = GrafreeD.clipboard.get(0);
2349
+ Object3D content = Grafreed.clipboard.get(0);
20892350
20902351 if (content instanceof cGroup && ((cGroup)content).transientlink )
20912352 content = ((cGroup)content).get(0);
20922353
2093
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2354
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20942355 for (int i=0; i<group.selection.size(); i++)
20952356 {
2096
- boolean random = CameraPane.RANDOM;
2097
- CameraPane.RANDOM = false; // parse all random nodes
2357
+ boolean random = CameraPane.SWITCH;
2358
+ CameraPane.SWITCH = false; // parse all random nodes
20982359 group.selection.get(i).linkVerticesThis(content);
20992360 // group.selection.get(i).setMasterThis(content); // should be identity
2100
- CameraPane.RANDOM = random;
2361
+ CameraPane.SWITCH = random;
21012362 }
2102
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2363
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21032364 refreshContents();
21042365 }
21052366 } else
2106
- if (event.getSource() == resetsupportItem)
2367
+ if (source == resetsupportItem)
21072368 {
21082369 for (int i=0; i<group.selection.size(); i++)
21092370 {
2110
- boolean random = CameraPane.RANDOM;
2111
- CameraPane.RANDOM = false; // parse all random nodes
2371
+ boolean random = CameraPane.SWITCH;
2372
+ CameraPane.SWITCH = false; // parse all random nodes
21122373 group.selection.get(i).linkVerticesThis(null);
2113
- CameraPane.RANDOM = random;
2374
+ CameraPane.SWITCH = random;
21142375 }
21152376
21162377 refreshContents();
21172378 } else
2118
- if (event.getSource() == relinkverticesItem)
2379
+ if (source == relinkverticesItem)
21192380 {
2120
- boolean random = CameraPane.RANDOM;
2121
- CameraPane.RANDOM = false; // parse all random nodes
2381
+ boolean random = CameraPane.SWITCH;
2382
+ CameraPane.SWITCH = false; // parse all random nodes
21222383 group.selection.RelinkToSupport();
2123
- CameraPane.RANDOM = random;
2384
+ CameraPane.SWITCH = random;
21242385
21252386 refreshContents();
21262387 } else
2127
- if (event.getSource() == resetreferencesItem)
2388
+ if (source == resetreferencesItem)
21282389 {
21292390 for (int i=0; i<group.selection.size(); i++)
21302391 {
....@@ -2133,11 +2394,11 @@
21332394
21342395 refreshContents();
21352396 } else
2136
- if (event.getSource() == setMasterItem)
2397
+ if (source == setMasterItem)
21372398 {
2138
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2399
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21392400 {
2140
- Object3D content = GrafreeD.clipboard.get(0);
2401
+ Object3D content = Grafreed.clipboard.get(0);
21412402
21422403 if (content instanceof cGroup && ((cGroup)content).transientlink )
21432404 content = ((cGroup)content).get(0);
....@@ -2146,13 +2407,13 @@
21462407 refreshContents();
21472408 }
21482409 } else
2149
- if (event.getSource() == poseMeshItem)
2410
+ if (source == poseMeshItem)
21502411 {
21512412 if (group.selection.size() == 1)
21522413 {
2153
- if (GrafreeD.clipboard.size() == 1)
2414
+ if (Grafreed.clipboard.size() == 1)
21542415 {
2155
- Object3D content = GrafreeD.clipboard.get(0);
2416
+ Object3D content = Grafreed.clipboard.get(0);
21562417
21572418 if (content instanceof cGroup && ((cGroup)content).transientlink )
21582419 content = ((cGroup)content).get(0);
....@@ -2165,19 +2426,19 @@
21652426 }
21662427
21672428 } else
2168
- if (event.getSource() == revertMeshItem)
2429
+ if (source == revertMeshItem)
21692430 {
21702431 RevertMeshes();
21712432 } else
2172
- if (event.getSource() == resetMeshItem)
2433
+ if (source == resetAllItem)
21732434 {
21742435 ResetAll();
21752436 } else
2176
- if (event.getSource() == stepAllItem)
2437
+ if (source == stepAllItem)
21772438 {
21782439 StepAll();
21792440 } else
2180
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2441
+ if (source == clearItem) // || event.getSource() == clearButton)
21812442 {
21822443 //int indices[] = jList.getSelectedIndices();
21832444 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2185,46 +2446,46 @@
21852446
21862447 ClearSelection(false);
21872448 } else
2188
- if (event.getSource() == clearAllItem)
2449
+ if (source == clearAllItem)
21892450 {
21902451 ClearSelection(true);
21912452 } else
2192
- if (event.getSource() == grabItem)
2453
+ if (source == grabItem)
21932454 {
21942455 group(new cGroup(), true);
21952456 } else
2196
- if (event.getSource() == hideItem)
2457
+ if (source == hideItem)
21972458 {
21982459 group(new HiddenObject());
21992460 } else
2200
- if (event.getSource() == frontItem)
2461
+ if (source == frontItem)
22012462 {
22022463 front();
22032464 } else
2204
- if (event.getSource() == backItem)
2465
+ if (source == backItem)
22052466 {
22062467 back();
22072468 } else
2208
- if (event.getSource() == cameraItem)
2469
+ if (source == cameraItem)
22092470 {
22102471 makeSomething(new Camera());
22112472 } else
2212
- if (event.getSource() == compositeItem)
2473
+ if (source == compositeItem)
22132474 {
22142475 group(new Composite());
22152476 } else
2216
- if (event.getSource() == randomItem)
2477
+ if (source == randomItem)
22172478 {
22182479 RandomNode random = new RandomNode();
22192480 group(random);
22202481 if (random.size() > 0)
2221
- random.name = random.get(0).name + "Rnd";
2482
+ random.name = random.get(0).name + "Switch";
22222483 } else
2223
- if (event.getSource() == physicsItem)
2484
+ if (source == physicsItem)
22242485 {
22252486 group(new PhysicsNode());
22262487 } else
2227
- if (event.getSource() == frameselectorItem)
2488
+ if (source == frameselectorItem)
22282489 {
22292490 for (int i=0; i<group.selection.size(); i++)
22302491 {
....@@ -2236,7 +2497,7 @@
22362497 ResetModel();
22372498 refreshContents();
22382499 } else
2239
- if (event.getSource() == switchGeoItem)
2500
+ if (source == switchGeoItem)
22402501 {
22412502 for (int i=0; i<group.selection.size(); i++)
22422503 {
....@@ -2248,7 +2509,7 @@
22482509 ResetModel();
22492510 refreshContents();
22502511 } else
2251
- if (event.getSource() == switchTransfoItem)
2512
+ if (source == switchTransfoItem)
22522513 {
22532514 for (int i=0; i<group.selection.size(); i++)
22542515 {
....@@ -2260,7 +2521,7 @@
22602521 ResetModel();
22612522 refreshContents();
22622523 } else
2263
- if (event.getSource() == morphItem)
2524
+ if (source == morphItem)
22642525 {
22652526 for (int i=0; i<group.selection.size(); i++)
22662527 {
....@@ -2272,7 +2533,7 @@
22722533 ResetModel();
22732534 refreshContents();
22742535 } else
2275
- if (event.getSource() == scriptNodeItem)
2536
+ if (source == scriptNodeItem)
22762537 {
22772538 boolean atleastone = false;
22782539
....@@ -2311,31 +2572,31 @@
23112572 }
23122573 }
23132574 } else
2314
- if (event.getSource() == linkerItem)
2575
+ if (source == linkerItem)
23152576 {
23162577 group(new cLinker());
23172578 } else
2318
- if (event.getSource() == textureItem)
2579
+ if (source == textureItem)
23192580 {
23202581 group(new TextureNode());
23212582 } else
2322
- if (event.getSource() == billboardItem)
2583
+ if (source == billboardItem)
23232584 {
23242585 group(new BillboardNode());
23252586 } else
2326
- if (event.getSource() == shadowXItem)
2587
+ if (source == shadowXItem)
23272588 {
23282589 CastShadow(0);
23292590 } else
2330
- if (event.getSource() == shadowYItem)
2591
+ if (source == shadowYItem)
23312592 {
23322593 CastShadow(1);
23332594 } else
2334
- if (event.getSource() == shadowZItem)
2595
+ if (source == shadowZItem)
23352596 {
23362597 CastShadow(2);
23372598 } else
2338
- if (event.getSource() == ungroupItem)
2599
+ if (source == ungroupItem)
23392600 {
23402601 //ungroup();
23412602 for (int i=0; i<group.selection.size(); i++)
....@@ -2347,179 +2608,203 @@
23472608
23482609 refreshContents();
23492610 } else
2350
- if (event.getSource() == genUVItem)
2611
+ if (source == genUVItem)
23512612 {
23522613 GenUV();
23532614 } else
2354
- if (event.getSource() == genNormalsCADItem)
2615
+ if (source == genNormalsCADItem)
23552616 {
23562617 GenNormals(true);
23572618 } else
2358
- if (event.getSource() == genNormalsMESHItem)
2619
+ if (source == genNormalsMESHItem)
23592620 {
2360
- GenNormals(true); // TODO
2621
+ GenNormalsMESH();
23612622 } else
2362
- if (event.getSource() == genNormalsORGANItem)
2623
+ if (source == genNormalsORGANItem)
23632624 {
23642625 GenNormals(false);
23652626 } else
2366
- if (event.getSource() == genNormalsMINEItem)
2627
+ if (source == genNormalsMINEItem)
23672628 {
23682629 GenNormalsMINE();
23692630 } else
2370
- if (event.getSource() == stripifyItem)
2631
+ if (source == stripifyItem)
23712632 {
23722633 Stripify();
23732634 } else
2374
- if (event.getSource() == unstripifyItem)
2635
+ if (source == unstripifyItem)
23752636 {
23762637 Unstripify();
23772638 } else
2378
- if (event.getSource() == trimItem)
2639
+ if (source == trimItem)
23792640 {
23802641 Trim();
23812642 } else
2382
- if (event.getSource() == untrimItem)
2643
+ if (source == untrimItem)
23832644 {
23842645 Untrim();
23852646 } else
2386
- if (event.getSource() == clearColorsItem)
2647
+ if (source == clearColorsItem)
23872648 {
23882649 ClearColors();
23892650 } else
2390
- if (event.getSource() == clearMaterialsItem)
2651
+ if (source == clearMaterialsItem)
23912652 {
23922653 ClearMaterials();
23932654 } else
2394
- if (event.getSource() == liveleavesItem)
2655
+ if (source == liveleavesItem)
23952656 {
23962657 LiveLeaves(true);
23972658 } else
2398
- if (event.getSource() == unliveleavesItem)
2659
+ if (source == unliveleavesItem)
23992660 {
24002661 LiveLeaves(false);
24012662 } else
2402
- if (event.getSource() == supportleavesItem)
2663
+ if (source == supportleavesItem)
24032664 {
24042665 SupportLeaves(true);
24052666 } else
2406
- if (event.getSource() == unsupportleavesItem)
2667
+ if (source == unsupportleavesItem)
24072668 {
24082669 SupportLeaves(false);
24092670 } else
2410
- if (event.getSource() == hideleavesItem)
2671
+ if (source == hideleavesItem)
24112672 {
24122673 HideLeaves(true);
24132674 } else
2414
- if (event.getSource() == showleavesItem)
2675
+ if (source == showleavesItem)
24152676 {
24162677 HideLeaves(false);
24172678 } else
2418
- if (event.getSource() == markleavesItem)
2679
+ if (source == markleavesItem)
24192680 {
24202681 MarkLeaves(true);
24212682 } else
2422
- if (event.getSource() == unmarkleavesItem)
2683
+ if (source == unmarkleavesItem)
24232684 {
24242685 MarkLeaves(false);
24252686 } else
2426
- if (event.getSource() == flipVItem)
2687
+ if (source == rewindleavesItem)
2688
+ {
2689
+ RewindLeaves(true);
2690
+ } else
2691
+ if (source == unrewindleavesItem)
2692
+ {
2693
+ RewindLeaves(false);
2694
+ } else
2695
+ if (source == randomleavesItem)
2696
+ {
2697
+ RandomLeaves(true);
2698
+ } else
2699
+ if (source == unrandomleavesItem)
2700
+ {
2701
+ RandomLeaves(false);
2702
+ } else
2703
+ if (source == flipVItem)
24272704 {
24282705 FlipV(true);
24292706 } else
2430
- if (event.getSource() == unflipVItem)
2707
+ if (source == unflipVItem)
24312708 {
24322709 FlipV(false);
24332710 } else
2434
- if (event.getSource() == lowTexturesItem)
2711
+ if (source == lowTexturesItem)
24352712 {
24362713 SetTexRes(0);
24372714 } else
2438
- if (event.getSource() == normalTexturesItem)
2715
+ if (source == normalTexturesItem)
24392716 {
24402717 SetTexRes(1);
24412718 } else
2442
- if (event.getSource() == highTexturesItem)
2719
+ if (source == highTexturesItem)
24432720 {
24442721 SetTexRes(2);
24452722 } else
2446
- if (event.getSource() == veryhighTexturesItem)
2723
+ if (source == veryhighTexturesItem)
24472724 {
24482725 SetTexRes(3);
24492726 } else
2450
- if (event.getSource() == maxTexturesItem)
2727
+ if (source == maxTexturesItem)
24512728 {
24522729 SetTexRes(4);
24532730 } else
2454
- if (event.getSource() == panoTexturesItem)
2731
+ if (source == panoTexturesItem)
24552732 {
24562733 SetTexRes(5);
24572734 } else
2458
- if (event.getSource() == reverseNormalsItem)
2735
+ if (source == reverseNormalsItem)
24592736 {
24602737 ReverseNormals();
24612738 } else
2462
- if (event.getSource() == parseverticesItem)
2739
+ if (source == parseverticesItem)
24632740 {
24642741 ParseVertices();
24652742 } else
2466
- if (event.getSource() == textureFieldItem)
2743
+ if (source == textureFieldItem)
24672744 {
24682745 TextureVertices();
24692746 } else
2470
- if (event.getSource() == alignItem)
2747
+ if (source == alignItem)
24712748 {
24722749 Align();
24732750 } else
2474
- if (event.getSource() == mirrorItem)
2751
+ if (source == mirrorItem)
24752752 {
24762753 MirrorPoses();
24772754 } else
2478
- if (event.getSource() == reduceMorphItem)
2755
+ if (source == reduceMorphItem)
24792756 {
24802757 MeshReduction(false);
24812758 } else
2482
- if (event.getSource() == reduce34MorphItem)
2759
+ if (source == reduce34MorphItem)
24832760 {
24842761 MeshReduction(true);
24852762 } else
2486
- if (event.getSource() == reverseTrianglesItem)
2763
+ if (source == reverseTrianglesItem)
24872764 {
24882765 ReverseTriangles();
24892766 } else
2490
- if (event.getSource() == reduceMeshItem)
2767
+ if (source == reduceMeshItem)
24912768 {
24922769 ReduceMesh(false);
24932770 } else
2494
- if (event.getSource() == reduce34MeshItem)
2771
+ if (source == reduce34MeshItem)
24952772 {
24962773 ReduceMesh(true);
24972774 } else
2498
- if (event.getSource() == increaseMeshItem)
2775
+ if (source == increaseMeshItem)
24992776 {
25002777 IncreaseMesh();
25012778 } else
2502
- if (event.getSource() == clipMeshItem)
2779
+ if (source == clipMeshItem)
25032780 {
25042781 ClipMesh();
25052782 } else
2506
- if (event.getSource() == smoothMeshItem)
2783
+ if (source == smoothMeshItem)
25072784 {
25082785 SmoothMesh();
25092786 } else
2510
- if (event.getSource() == transformgeometryItem)
2787
+ if (source == transformGeometryItem)
25112788 {
25122789 TransformGeometry();
25132790 } else
2514
- if (event.getSource() == resetTransformItem)
2791
+ if (source == transformChildrenItem)
2792
+ {
2793
+ TransformChildren();
2794
+ } else
2795
+ if (source == resetTransformItem)
25152796 {
25162797 ResetTransform();
25172798 } else
2518
- if (event.getSource() == resetCentroidItem)
2799
+ if (source == resetCentroidItem)
25192800 {
2520
- ResetCentroid();
2801
+ ResetCentroid(true);
25212802 } else
2522
- if (event.getSource() == resetParentItem)
2803
+ if (source == resetCentroidXZItem)
2804
+ {
2805
+ ResetCentroid(false);
2806
+ } else
2807
+ if (source == resetParentItem)
25232808 {
25242809 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25252810 {
....@@ -2529,7 +2814,7 @@
25292814
25302815 refreshContents();
25312816 } else
2532
- if (event.getSource() == repairParentItem)
2817
+ if (source == repairParentItem)
25332818 {
25342819 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25352820 {
....@@ -2543,7 +2828,21 @@
25432828
25442829 refreshContents();
25452830 } else
2546
- if (event.getSource() == sortbysizeItem)
2831
+ if (source == repairShadowItem)
2832
+ {
2833
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
2834
+ {
2835
+ Object3D obj = (Object3D)e.nextElement();
2836
+ obj.RepairShadow();
2837
+// for (int i=0; i<obj.size(); i++)
2838
+// {
2839
+// obj.get(i).parent = obj;
2840
+// }
2841
+ }
2842
+
2843
+ refreshContents();
2844
+ } else
2845
+ if (source == sortbysizeItem)
25472846 {
25482847 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25492848 {
....@@ -2555,7 +2854,7 @@
25552854 ResetModel();
25562855 refreshContents();
25572856 } else
2558
- if (event.getSource() == sortbynameItem)
2857
+ if (source == sortbynameItem)
25592858 {
25602859 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25612860 {
....@@ -2567,7 +2866,7 @@
25672866 ResetModel();
25682867 refreshContents();
25692868 } else
2570
- if (event.getSource() == attachPigmentItem)
2869
+ if (source == attachPigmentItem)
25712870 {
25722871 String texture = GetFile("Attach pigment");
25732872 Object3D obj;
....@@ -2579,7 +2878,7 @@
25792878
25802879 refreshContents();
25812880 } else
2582
- if (event.getSource() == detachPigmentItem)
2881
+ if (source == detachPigmentItem)
25832882 {
25842883 Object3D obj;
25852884 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2590,7 +2889,7 @@
25902889
25912890 refreshContents();
25922891 } else
2593
- if (event.getSource() == attachBumpItem)
2892
+ if (source == attachBumpItem)
25942893 {
25952894 String texture = GetFile("Attach bump");
25962895 Object3D obj;
....@@ -2602,7 +2901,7 @@
26022901
26032902 refreshContents();
26042903 } else
2605
- if (event.getSource() == detachBumpItem)
2904
+ if (source == detachBumpItem)
26062905 {
26072906 Object3D obj;
26082907 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2613,7 +2912,7 @@
26132912
26142913 refreshContents();
26152914 } else
2616
- if (event.getSource() == pigmentBumpItem)
2915
+ if (source == pigmentBumpItem)
26172916 {
26182917 Object3D obj;
26192918 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2624,158 +2923,221 @@
26242923
26252924 refreshContents();
26262925 } else
2627
- if (event.getSource() == flashSelectionButton)
2926
+ if (source == flashSelectionButton)
26282927 {
26292928 CameraPane.flash = true;
26302929 refreshContents();
26312930 } else
2632
- if (event.getSource() == oneButton)
2931
+ if (source == oneButton)
26332932 {
26342933 } else
2635
- if (event.getSource() == twoButton)
2934
+ if (source == twoButton)
26362935 {
26372936 radio.layout = twoButton;
26382937 // bug
26392938 //gridPanel.setDividerLocation(1.0);
26402939 //bigPanel.setDividerLocation(0.0);
2641
- bigThree.remove(scenePanel);
2642
- bigThree.remove(cameraPanel);
2643
- bigThree.remove(XYZPanel);
2644
- aWindowConstraints.gridx = 0;
2645
- aWindowConstraints.gridy = 0;
2646
- aWindowConstraints.gridwidth = 1;
2647
- // aConstraints.gridheight = 3;
2648
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2649
- aWindowConstraints.weightx = 0;
2650
- aWindowConstraints.weighty = 1;
2651
- //bigThree.add(jtp, aWindowConstraints);
2652
- aWindowConstraints.weightx = 1;
2653
- aWindowConstraints.gridwidth = 3;
2654
- // aConstraints.gridheight = 3;
2655
- aWindowConstraints.gridx = 1;
2656
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2657
- bigThree.add(cameraPanel, aWindowConstraints);
2658
- aWindowConstraints.weightx = 0;
2659
- aWindowConstraints.gridx = 4;
2660
- aWindowConstraints.gridwidth = 1;
2661
- // aConstraints.gridheight = 3;
2662
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2663
- //bigThree.add(XYZPanel, aWindowConstraints);
2664
- bigThree.revalidate();
2940
+// bigThree.remove(scenePanel);
2941
+// bigThree.remove(centralPanel);
2942
+// bigThree.remove(XYZPanel);
2943
+// aWindowConstraints.gridx = 0;
2944
+// aWindowConstraints.gridy = 0;
2945
+// aWindowConstraints.gridwidth = 1;
2946
+// // aConstraints.gridheight = 3;
2947
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2948
+// aWindowConstraints.weightx = 0;
2949
+// aWindowConstraints.weighty = 1;
2950
+// //bigThree.add(jtp, aWindowConstraints);
2951
+// aWindowConstraints.weightx = 1;
2952
+// aWindowConstraints.gridwidth = 3;
2953
+// // aConstraints.gridheight = 3;
2954
+// aWindowConstraints.gridx = 1;
2955
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2956
+// bigThree.add(centralPanel, aWindowConstraints);
2957
+// aWindowConstraints.weightx = 0;
2958
+// aWindowConstraints.gridx = 4;
2959
+// aWindowConstraints.gridwidth = 1;
2960
+// // aConstraints.gridheight = 3;
2961
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2962
+// //bigThree.add(XYZPanel, aWindowConstraints);
2963
+// scenePanel.setVisible(false);
2964
+// centralPanel.setVisible(true);
2965
+// XYZPanel.setVisible(false);
2966
+ bigThree.ClearUI();
2967
+ bigThree.add(centralPanel);
2968
+ bigThree.FlushUI();
2969
+
2970
+ cameraView.requestFocusInWindow();
2971
+
2972
+// refreshContents(true);
2973
+//
2974
+// try
2975
+// {
2976
+// java.awt.Robot bot = new java.awt.Robot();
2977
+// int mask = InputEvent.BUTTON1_MASK;
2978
+// bot.mouseMove(100, 100);
2979
+// bot.mousePress(mask);
2980
+// bot.mouseRelease(mask);
2981
+// }
2982
+// catch (Exception e)
2983
+// {
2984
+//
2985
+// }
2986
+
26652987 } else
2666
- if (event.getSource() == threeButton)
2988
+ if (source == threeButton)
26672989 {
26682990 radio.layout = threeButton;
2669
- bigThree.remove(scenePanel);
2670
- bigThree.remove(cameraPanel);
2671
- bigThree.remove(XYZPanel);
2672
- aWindowConstraints.gridx = 0;
2673
- aWindowConstraints.gridy = 0;
2674
- aWindowConstraints.gridwidth = 1;
2675
- // aConstraints.gridheight = 3;
2676
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2677
- aWindowConstraints.weightx = 0;
2678
- aWindowConstraints.weighty = 1;
2679
- //bigThree.add(jtp, aWindowConstraints);
2680
- aWindowConstraints.weightx = 1;
2681
- aWindowConstraints.gridwidth = 3;
2682
- // aConstraints.gridheight = 3;
2683
- aWindowConstraints.gridx = 1;
2684
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2685
- bigThree.add(cameraPanel, aWindowConstraints);
2686
- aWindowConstraints.weightx = 0;
2687
- aWindowConstraints.gridx = 4;
2688
- aWindowConstraints.gridwidth = 1;
2689
- // aConstraints.gridheight = 3;
2690
- aConstraints.fill = GridBagConstraints.VERTICAL;
2691
- bigThree.add(XYZPanel, aWindowConstraints);
2692
- bigThree.revalidate();
2991
+
2992
+// bigThree.remove(scenePanel);
2993
+// bigThree.remove(centralPanel);
2994
+// bigThree.remove(XYZPanel);
2995
+// aWindowConstraints.gridx = 0;
2996
+// aWindowConstraints.gridy = 0;
2997
+// aWindowConstraints.gridwidth = 1;
2998
+// // aConstraints.gridheight = 3;
2999
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3000
+// aWindowConstraints.weightx = 0;
3001
+// aWindowConstraints.weighty = 1;
3002
+// //bigThree.add(jtp, aWindowConstraints);
3003
+// aWindowConstraints.weightx = 1;
3004
+// aWindowConstraints.gridwidth = 3;
3005
+// // aConstraints.gridheight = 3;
3006
+// aWindowConstraints.gridx = 1;
3007
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3008
+// bigThree.add(centralPanel, aWindowConstraints);
3009
+// aWindowConstraints.weightx = 0;
3010
+// aWindowConstraints.gridx = 4;
3011
+// aWindowConstraints.gridwidth = 1;
3012
+// // aConstraints.gridheight = 3;
3013
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3014
+// bigThree.add(XYZPanel, aWindowConstraints);
3015
+// bigThree.validate();
3016
+// scenePanel.setVisible(false);
3017
+// centralPanel.setVisible(true);
3018
+// XYZPanel.setVisible(true);
3019
+ bigThree.ClearUI();
3020
+ bigThree.add(centralPanel);
3021
+ bigThree.add(XYZPanel);
3022
+ bigThree.FlushUI();
3023
+
3024
+ cameraView.requestFocusInWindow();
26933025 } else
2694
- if (event.getSource() == fourButton)
3026
+ if (source == fourButton)
26953027 {
26963028 radio.layout = fourButton;
2697
- bigThree.remove(scenePanel);
2698
- bigThree.remove(cameraPanel);
2699
- bigThree.remove(XYZPanel);
2700
- aWindowConstraints.gridx = 0;
2701
- aWindowConstraints.gridy = 0;
2702
- aWindowConstraints.gridwidth = 1;
2703
- // aWindowConstraints.gridheight = 3;
2704
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2705
- aWindowConstraints.weightx = 1;
2706
- aWindowConstraints.weighty = 1;
2707
- bigThree.add(scenePanel, aWindowConstraints);
2708
- aWindowConstraints.weightx = 1;
2709
- aWindowConstraints.gridwidth = 3;
2710
- // aConstraints.gridheight = 3;
2711
- aWindowConstraints.gridx = 1;
2712
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2713
- //bigThree.add(cameraPanel, aWindowConstraints);
2714
- aWindowConstraints.weightx = 0;
2715
- aWindowConstraints.gridx = 4;
2716
- aWindowConstraints.gridwidth = 1;
2717
- // aWindowConstraints.gridheight = 3;
2718
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2719
- //bigThree.add(XYZPanel, aWindowConstraints);
2720
- bigThree.revalidate();
3029
+
3030
+// bigThree.remove(scenePanel);
3031
+// bigThree.remove(centralPanel);
3032
+// bigThree.remove(XYZPanel);
3033
+// aWindowConstraints.gridx = 0;
3034
+// aWindowConstraints.gridy = 0;
3035
+// aWindowConstraints.gridwidth = 1;
3036
+// // aWindowConstraints.gridheight = 3;
3037
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3038
+// aWindowConstraints.weightx = 1;
3039
+// aWindowConstraints.weighty = 1;
3040
+// bigThree.add(scenePanel, aWindowConstraints);
3041
+// aWindowConstraints.weightx = 1;
3042
+// aWindowConstraints.gridwidth = 3;
3043
+// // aConstraints.gridheight = 3;
3044
+// aWindowConstraints.gridx = 1;
3045
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3046
+// //bigThree.add(cameraPanel, aWindowConstraints);
3047
+// aWindowConstraints.weightx = 0;
3048
+// aWindowConstraints.gridx = 4;
3049
+// aWindowConstraints.gridwidth = 1;
3050
+// // aWindowConstraints.gridheight = 3;
3051
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3052
+// //bigThree.add(XYZPanel, aWindowConstraints);
3053
+// bigThree.validate();
3054
+// scenePanel.setVisible(true);
3055
+// centralPanel.setVisible(false);
3056
+// XYZPanel.setVisible(false);
3057
+ bigThree.ClearUI();
3058
+ bigThree.add(scenePanel);
3059
+ bigThree.FlushUI();
3060
+
3061
+ cameraView.requestFocusInWindow();
27213062 } else
2722
- if (event.getSource() == sixButton)
3063
+ if (source == sixButton)
27233064 {
27243065 radio.layout = sixButton;
2725
- bigThree.remove(scenePanel);
2726
- bigThree.remove(cameraPanel);
2727
- bigThree.remove(XYZPanel);
2728
- aWindowConstraints.gridx = 0;
2729
- aWindowConstraints.gridy = 0;
2730
- aWindowConstraints.gridwidth = 1;
2731
- // aConstraints.gridheight = 3;
2732
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2733
- aWindowConstraints.weightx = 0;
2734
- aWindowConstraints.weighty = 1;
2735
- bigThree.add(scenePanel, aWindowConstraints);
2736
- aWindowConstraints.weightx = 1;
2737
- aWindowConstraints.gridwidth = 3;
2738
- // aWindowConstraints.gridheight = 3;
2739
- aWindowConstraints.gridx = 1;
2740
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2741
- bigThree.add(cameraPanel, aWindowConstraints);
2742
- aWindowConstraints.weightx = 0;
2743
- aWindowConstraints.gridx = 4;
2744
- aWindowConstraints.gridwidth = 1;
2745
- // aWindowConstraints.gridheight = 3;
2746
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2747
- //bigThree.add(XYZPanel, aConstraints);
2748
- bigThree.revalidate();
3066
+
3067
+// bigThree.remove(scenePanel);
3068
+// bigThree.remove(centralPanel);
3069
+// bigThree.remove(XYZPanel);
3070
+// aWindowConstraints.gridx = 0;
3071
+// aWindowConstraints.gridy = 0;
3072
+// aWindowConstraints.gridwidth = 1;
3073
+// // aConstraints.gridheight = 3;
3074
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3075
+// aWindowConstraints.weightx = 0;
3076
+// aWindowConstraints.weighty = 1;
3077
+// bigThree.add(scenePanel, aWindowConstraints);
3078
+// aWindowConstraints.weightx = 1;
3079
+// aWindowConstraints.gridwidth = 3;
3080
+// // aWindowConstraints.gridheight = 3;
3081
+// aWindowConstraints.gridx = 1;
3082
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3083
+// bigThree.add(centralPanel, aWindowConstraints);
3084
+// aWindowConstraints.weightx = 0;
3085
+// aWindowConstraints.gridx = 4;
3086
+// aWindowConstraints.gridwidth = 1;
3087
+// // aWindowConstraints.gridheight = 3;
3088
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3089
+// //bigThree.add(XYZPanel, aConstraints);
3090
+// bigThree.validate();
3091
+// scenePanel.setVisible(true);
3092
+// centralPanel.setVisible(true);
3093
+// XYZPanel.setVisible(false);
3094
+ bigThree.ClearUI();
3095
+ bigThree.add(scenePanel);
3096
+ bigThree.add(centralPanel);
3097
+ bigThree.FlushUI();
3098
+
3099
+ cameraView.requestFocusInWindow();
27493100 } else
2750
- if (event.getSource() == sevenButton)
3101
+ if (source == sevenButton)
27513102 {
27523103 radio.layout = sevenButton;
2753
- bigThree.remove(scenePanel);
2754
- bigThree.remove(cameraPanel);
2755
- bigThree.remove(XYZPanel);
2756
- aWindowConstraints.gridx = 0;
2757
- aWindowConstraints.gridy = 0;
2758
- aWindowConstraints.gridwidth = 1;
2759
- // aWindowConstraints.gridheight = 3;
2760
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2761
- aWindowConstraints.weightx = 0;
2762
- aWindowConstraints.weighty = 1;
2763
- bigThree.add(scenePanel, aWindowConstraints);
2764
- aWindowConstraints.weightx = 1;
2765
- aWindowConstraints.gridwidth = 3;
2766
- // aWindowConstraints.gridheight = 3;
2767
- aWindowConstraints.gridx = 1;
2768
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2769
- bigThree.add(cameraPanel, aWindowConstraints);
2770
- aWindowConstraints.weightx = 0;
2771
- aWindowConstraints.gridx = 4;
2772
- aWindowConstraints.gridwidth = 1;
2773
- // aConstraints.gridheight = 3;
2774
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2775
- bigThree.add(XYZPanel, aWindowConstraints);
2776
- bigThree.revalidate();
3104
+
3105
+// bigThree.remove(scenePanel);
3106
+// bigThree.remove(centralPanel);
3107
+// bigThree.remove(XYZPanel);
3108
+// aWindowConstraints.gridx = 0;
3109
+// aWindowConstraints.gridy = 0;
3110
+// aWindowConstraints.gridwidth = 1;
3111
+// // aWindowConstraints.gridheight = 3;
3112
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3113
+// aWindowConstraints.weightx = 0;
3114
+// aWindowConstraints.weighty = 1;
3115
+// bigThree.add(scenePanel, aWindowConstraints);
3116
+// aWindowConstraints.weightx = 1;
3117
+// aWindowConstraints.gridwidth = 3;
3118
+// // aWindowConstraints.gridheight = 3;
3119
+// aWindowConstraints.gridx = 1;
3120
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3121
+// bigThree.add(centralPanel, aWindowConstraints);
3122
+// aWindowConstraints.weightx = 0;
3123
+// aWindowConstraints.gridx = 4;
3124
+// aWindowConstraints.gridwidth = 1;
3125
+// // aConstraints.gridheight = 3;
3126
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3127
+// bigThree.add(XYZPanel, aWindowConstraints);
3128
+// bigThree.validate();
3129
+// scenePanel.setVisible(true);
3130
+// centralPanel.setVisible(true);
3131
+// XYZPanel.setVisible(true);
3132
+ bigThree.ClearUI();
3133
+ bigThree.add(scenePanel);
3134
+ bigThree.add(centralPanel);
3135
+ bigThree.add(XYZPanel);
3136
+ bigThree.FlushUI();
3137
+
3138
+ cameraView.requestFocusInWindow();
27773139 } else
2778
- if (event.getSource() == rootButton)
3140
+ if (source == rootButton)
27793141 {
27803142 Object3D obj;
27813143 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2785,34 +3147,44 @@
27853147 EditObject(obj);
27863148 }
27873149
3150
+ cameraView.requestFocusInWindow();
27883151 refreshContents(true);
27893152 } else
2790
- if (event.getSource() == closeButton)
3153
+ if (source == closeButton)
27913154 {
27923155 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27933156 cRadio ab;
27943157 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27953158 {
27963159 ab = (cRadio)e.nextElement();
2797
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3160
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27983161 {
3162
+ // Patch to avoid bug with transparency.
3163
+ if (!ab.hadMaterial)
3164
+ {
3165
+ ab.object.material = null;
3166
+ }
3167
+
27993168 buttonGroup.remove(ab);
28003169 radioPanel.remove(ab);
28013170
2802
- ab.GetObject().editWindow = null;
3171
+ //ab.GetObject().editWindow = null;
3172
+ ab.GetObject().manipWindow = null;
28033173 // ab.GetObject().objectUI = null; // ?????????
28043174
28053175 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28063176 break;
28073177 }
28083178 }
3179
+
3180
+ cameraView.requestFocusInWindow();
28093181 refreshContents(true);
28103182 } else
2811
- if (event.getSource() == editItem || event.getSource() == editButton)
3183
+ if (source == editItem || source == editButton)
28123184 {
28133185 EditSelection(false);
28143186 } else
2815
- if (event.getSource() == uneditButton)
3187
+ if (source == uneditButton)
28163188 {
28173189 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28183190 {
....@@ -2822,14 +3194,14 @@
28223194 child.CloseUI();
28233195 listUI.remove(child);
28243196
2825
- child.editWindow = null; // ???????????
3197
+ //child.editWindow = null; // ???????????
28263198 }
2827
- objEditor.ctrlPanel.revalidate();
3199
+ objEditor.ctrlPanel.FlushUI();
28283200 //objEditor.jTree.clearSelection();
28293201 //objEditor.ResetSliders();
28303202 refreshContents(true);
28313203 } else
2832
- if (event.getSource() == clearPanelButton)
3204
+ if (source == clearPanelButton)
28333205 {
28343206 assert(copy == group);
28353207 //copy.ClearUI();
....@@ -2840,7 +3212,7 @@
28403212 listUI.clear();
28413213 refreshContents(true);
28423214 } else
2843
- if (event.getSource() == allParamsButton)
3215
+ if (source == allParamsButton)
28443216 {
28453217 assert(copy == group);
28463218
....@@ -2861,19 +3233,19 @@
28613233
28623234 refreshContents(true);
28633235 } else
2864
- if (event.getSource() == unselectButton)
3236
+ if (source == unselectButton)
28653237 {
28663238 objEditor.jTree.clearSelection();
28673239 // ?? oct 2012 GrafreeD.clipboard.clear();
28683240 objEditor.ResetSliders();
28693241 refreshContents(true);
28703242 } else
2871
- if(event.getSource() instanceof cRadio)
3243
+ if(source instanceof cRadio)
28723244 {
28733245 group.parent = keepparent;
28743246 group.attributes = 0;
28753247 //group.editWindow = null;
2876
- /*cRadio*/ radio = (cRadio)event.getSource();
3248
+ /*cRadio*/ radio = (cRadio)source;
28773249 Object3D obj = radio.GetObject();
28783250 System.out.println("Edit " + obj);
28793251 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2893,7 +3265,7 @@
28933265 }
28943266
28953267 copy = group;
2896
- //CameraPane.theRenderer.object = group;
3268
+ //Globals.theRenderer.object = group;
28973269 if(!useclient)
28983270 {
28993271 cameraView.renderCamera = radio.camera;
....@@ -2902,12 +3274,17 @@
29023274 cameraView.cameras[cameraView.cameracount] = radio.camera;
29033275 cameraView.targetLookAt.set(radio.camera.lookAt);
29043276 cameraView.object = group;
2905
- cameraView.lighttouched = true;
3277
+ //cameraView.lighttouched = true;
3278
+ Globals.lighttouched = true;
29063279 topView.object = group;
29073280 frontView.object = group;
29083281 sideView.object = group;
29093282 }
2910
- group.editWindow = this;
3283
+
3284
+// fix "+" issue
3285
+ //group.editWindow = this;
3286
+ group.manipWindow = this;
3287
+
29113288 /*
29123289 currentLayout = radio.layout;
29133290 if (currentLayout == null)
....@@ -2919,8 +3296,23 @@
29193296 //group.parent = null; // ROOT
29203297 //group.attributes = -1;
29213298 ResetModel();
3299
+
3300
+ cameraView.requestFocusInWindow();
29223301 refreshContents(true);
2923
- }
3302
+ } else if (event.getSource() == editCameraItem)
3303
+ {
3304
+ cameraView.ProtectCamera();
3305
+ cameraView.repaint();
3306
+ return;
3307
+ } else if (event.getSource() == revertCameraItem)
3308
+ {
3309
+ cameraView.RevertCamera();
3310
+ cameraView.repaint();
3311
+ return;
3312
+ // } else if (event.getSource() == textureButton)
3313
+ // {
3314
+ // return; // true;
3315
+ }
29243316 else
29253317 {
29263318 //return super.action(event, arg);
....@@ -2929,7 +3321,6 @@
29293321 }
29303322
29313323 boolean useclient = false;
2932
- cRadio radio;
29333324
29343325 void ToggleRoot()
29353326 {
....@@ -2938,7 +3329,7 @@
29383329 if (useclient)
29393330 {
29403331 cameraView.object = client;
2941
- cameraView.lighttouched = true;
3332
+ Globals.lighttouched = true;
29423333 //topView.object = client;
29433334 //frontView.object = client;
29443335 //sideView.object = client;
....@@ -2946,7 +3337,7 @@
29463337 else
29473338 {
29483339 cameraView.object = group;
2949
- cameraView.lighttouched = true;
3340
+ Globals.lighttouched = true;
29503341 //topView.object = group;
29513342 //frontView.object = group;
29523343 //sideView.object = group;
....@@ -2981,6 +3372,28 @@
29813372 refreshContents();
29823373 }
29833374
3375
+ void TransformChildren()
3376
+ {
3377
+ Object3D obj;
3378
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3379
+ {
3380
+ obj = (Object3D)e.nextElement();
3381
+ obj.KeepTextureMatrices();
3382
+ obj.TransformChildren();
3383
+ obj.RestoreTextureMatrices();
3384
+
3385
+// if (obj.parent == null)
3386
+// {
3387
+// System.out.println("NULL PARENT!");
3388
+// new Exception().printStackTrace();
3389
+// }
3390
+// else
3391
+// TouchTransform(obj);
3392
+// //obj.parent.Touch();
3393
+ }
3394
+
3395
+ refreshContents();
3396
+ }
29843397
29853398 void ResetTransform()
29863399 {
....@@ -3093,7 +3506,7 @@
30933506 refreshContents();
30943507 }
30953508
3096
- void ResetCentroid()
3509
+ void ResetCentroid(boolean full)
30973510 {
30983511 Object3D obj;
30993512 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3108,12 +3521,16 @@
31083521 LA.matIdentity(Object3D.mat);
31093522 obj.getBounds(minima, maxima, false);
31103523 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3111
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3524
+ if (full)
3525
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31123526 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31133527 obj.TransformMesh(Object3D.mat);
3528
+
31143529 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3115
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3530
+ if (full)
3531
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31163532 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3533
+
31173534 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31183535 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31193536 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3142,7 +3559,8 @@
31423559
31433560 int size = obj.MemorySize();
31443561
3145
- System.err.println((size/1024) + " KB is the size of " + obj);
3562
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3563
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
31463564 }
31473565 }
31483566 catch (Exception e)
....@@ -3179,9 +3597,9 @@
31793597 obj = (Object3D)e.nextElement();
31803598
31813599 System.out.println("Object is: " + obj);
3182
- GrafreeD.AnalyzeObject(obj);
3600
+ Grafreed.AnalyzeObject(obj);
31833601 System.out.println("Boundary rep: " + obj.bRep);
3184
- GrafreeD.AnalyzeObject(obj.bRep);
3602
+ Grafreed.AnalyzeObject(obj.bRep);
31853603
31863604 // System.err.println((size/1024) + " KB is the size of " + obj);
31873605 }
....@@ -3223,6 +3641,13 @@
32233641 void GenNormals(boolean crease)
32243642 {
32253643 group.GenNormalsS(crease);
3644
+
3645
+ refreshContents();
3646
+ }
3647
+
3648
+ void GenNormalsMESH()
3649
+ {
3650
+ group.GenNormalsMeshS();
32263651
32273652 refreshContents();
32283653 }
....@@ -3395,8 +3820,8 @@
33953820
33963821 void ParseVertices()
33973822 {
3398
- boolean epsequal = GrafreeD.epsequal;
3399
- GrafreeD.epsequal = true;
3823
+ boolean epsequal = Grafreed.epsequal;
3824
+ Grafreed.epsequal = true;
34003825
34013826 for (int i=0; i<group.selection.size(); i++)
34023827 {
....@@ -3421,7 +3846,7 @@
34213846 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34223847 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34233848
3424
- g.add(GrafreeD.clipboard);
3849
+ g.add(Grafreed.clipboard);
34253850
34263851 buffer.add(g);
34273852 }
....@@ -3436,7 +3861,7 @@
34363861 makeSomething(buffer, i==group.selection.size()-1);
34373862 }
34383863
3439
- GrafreeD.epsequal = epsequal;
3864
+ Grafreed.epsequal = epsequal;
34403865
34413866 refreshContents();
34423867 }
....@@ -3454,7 +3879,16 @@
34543879 String pigment = Object3D.GetPigment(tex);
34553880 //String bump = Object3D.GetBump(tex);
34563881
3457
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
3882
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3883
+
3884
+ try
3885
+ {
3886
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3887
+ }
3888
+ catch (Exception e)
3889
+ {
3890
+ System.err.println("FAIL: " + node);
3891
+ }
34583892
34593893 double s = v.s;
34603894
....@@ -3542,11 +3976,11 @@
35423976
35433977 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35443978
3545
- boolean random = CameraPane.RANDOM;
3546
- CameraPane.RANDOM = false; // parse all random nodes
3979
+ boolean random = CameraPane.SWITCH;
3980
+ CameraPane.SWITCH = false; // parse all random nodes
35473981 lowres.linkVerticesThis(null);
35483982 lowres.linkVerticesThis(sn);
3549
- CameraPane.RANDOM = random;
3983
+ CameraPane.SWITCH = random;
35503984
35513985 System.err.flush();
35523986
....@@ -3586,7 +4020,7 @@
35864020 return;
35874021
35884022 Object3D poses = group.selection.get(0);
3589
- Object3D ref = GrafreeD.clipboard.get(0);
4023
+ Object3D ref = Grafreed.clipboard.get(0);
35904024
35914025 Object3D newgroup = new Object3D("Po:" + poses.name);
35924026
....@@ -3755,7 +4189,7 @@
37554189 group.selection.RelinkToSupport(); // july 2014
37564190 System.out.println("DONE.");
37574191 refreshContents();
3758
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4192
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
37594193 }
37604194
37614195 void ReduceMesh(boolean reduction34)
....@@ -3780,9 +4214,9 @@
37804214
37814215 void ClipMesh()
37824216 {
3783
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4217
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37844218 {
3785
- Object3D content = GrafreeD.clipboard.get(0);
4219
+ Object3D content = Grafreed.clipboard.get(0);
37864220
37874221 if (content instanceof cGroup && ((cGroup)content).transientlink )
37884222 content = ((cGroup)content).get(0);
....@@ -3791,7 +4225,7 @@
37914225 // {
37924226 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37934227 // }
3794
- group.selection.ClipMesh(GrafreeD.clipboard);
4228
+ group.selection.ClipMesh(Grafreed.clipboard);
37954229 }
37964230 // group.selection.ClipMesh(GrafreeD.clipboard);
37974231 System.out.println("DONE.");
....@@ -3838,6 +4272,18 @@
38384272 void MarkLeaves(boolean hide)
38394273 {
38404274 group.selection.MarkLeaves(hide);
4275
+ refreshContents();
4276
+ }
4277
+
4278
+ void RewindLeaves(boolean hide)
4279
+ {
4280
+ group.selection.RewindLeaves(hide);
4281
+ refreshContents();
4282
+ }
4283
+
4284
+ void RandomLeaves(boolean hide)
4285
+ {
4286
+ group.selection.RandomLeaves(hide);
38414287 refreshContents();
38424288 }
38434289
....@@ -3926,7 +4372,7 @@
39264372 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39274373
39284374 Object3D elem = (Object3D)group.selection.elementAt(i);
3929
- if(elem != group)
4375
+ if(elem != group || !newWindow)
39304376 {
39314377 // if (!(elem instanceof Composite))
39324378 // newWindow = false;
....@@ -4016,7 +4462,6 @@
40164462 //case 702: // Event.LIST_DESELECT
40174463 group.deselectAll();
40184464 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4019
- objEditor.ClearInfo(); // .GetMaterial());
40204465 if (tps != null)
40214466 {
40224467 for (int i=0; i < tps.length; i++)
....@@ -4025,31 +4470,30 @@
40254470
40264471 //if (child.parent != null)
40274472 //child.parent.addSelectee(child);
4473
+ objEditor.SetMaterial(child);
40284474 group.addSelectee(child);
4029
- objEditor.SetMaterial(child); // .GetMaterial());
4030
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4031
- System.err.println("info : " + child.GetPath());
40324475 }
40334476 }
4034
- else
4035
- {
4036
- objEditor.SetMaterial(group); // .GetMaterial());
4037
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4038
- System.err.println("info : " + group.GetPath());
4039
- }
4477
+// else
4478
+// {
4479
+// objEditor.SetMaterial(group); // .GetMaterial());
4480
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4481
+// System.err.println("info : " + group.GetPath());
4482
+// }
40404483
4041
- objEditor.SetText(); // jan 2014
4042
-
4043
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4484
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
40444485 CameraPane.flash = true;
40454486
4046
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4487
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40474488 // a camera
40484489 {
4049
- CameraPane.camerachangeframe = 0; // don't refuse it
4050
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4051
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
4052
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
4490
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4491
+ {
4492
+ CameraPane.camerachangeframe = 0; // don't refuse it
4493
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4494
+ }
4495
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4496
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
40534497 }
40544498
40554499 refreshContents();
....@@ -4060,6 +4504,26 @@
40604504
40614505 freezemodel = false;
40624506 }
4507
+
4508
+ void refreshContents(boolean cp)
4509
+ {
4510
+ if (!Globals.MOUSEDRAGGED)
4511
+ {
4512
+ objEditor.ClearInfo(); // .GetMaterial());
4513
+
4514
+ for (int i=0; i < group.selection.Size(); i++)
4515
+ {
4516
+ Object3D child = (Object3D) group.selection.get(i);
4517
+
4518
+ objEditor.AddInfo(child, this, true);
4519
+ System.err.println("info : " + child.GetPath());
4520
+ }
4521
+
4522
+ objEditor.SetText(); // jan 2014
4523
+ }
4524
+
4525
+ super.refreshContents(cp);
4526
+ }
40634527
40644528 void linkSomething(Object3D thing)
40654529 {
....@@ -4131,16 +4595,19 @@
41314595 {
41324596 if (group.selection.isEmpty())
41334597 return;
4134
- GrafreeD.clipboardIsTempGroup = false;
4598
+
4599
+ Grafreed.clipboardIsTempGroup = false;
41354600 Composite tGroup = null;
41364601 if (group.selection.size() > 0) // 1)
41374602 {
41384603 tGroup = new cGroup();
4139
- GrafreeD.clipboardIsTempGroup = true;
4604
+ Grafreed.clipboardIsTempGroup = true;
41404605 }
41414606
41424607 if (cut)
41434608 {
4609
+ if (Globals.SAVEONMAKE)
4610
+ Save();
41444611 //int indices[] = jList.getSelectedIndices();
41454612 //for (int i = indices.length - 1; i >= 0; i--)
41464613 //jList.remove(indices[i]);
....@@ -4176,16 +4643,16 @@
41764643 //System.out.println("cut " + child);
41774644 //System.out.println("parent = " + child.parent);
41784645 // tmp.addChild(child);
4179
- if (GrafreeD.clipboardIsTempGroup)
4646
+ if (Grafreed.clipboardIsTempGroup)
41804647 tGroup.add/*Child*/(tmp);
41814648 else
4182
- GrafreeD.clipboard = tmp;
4649
+ Grafreed.clipboard = tmp;
41834650 }
41844651 else
4185
- if (GrafreeD.clipboardIsTempGroup)
4652
+ if (Grafreed.clipboardIsTempGroup)
41864653 tGroup.add/*Child*/(child);
41874654 else
4188
- GrafreeD.clipboard = child;
4655
+ Grafreed.clipboard = child;
41894656 }
41904657
41914658 //ResetModel();
....@@ -4217,21 +4684,23 @@
42174684 //System.out.println("cut " + elem);
42184685 //System.out.println("parent = " + elem.parent);
42194686 // tmp.addChild(elem);
4220
- if (GrafreeD.clipboardIsTempGroup)
4687
+ if (Grafreed.clipboardIsTempGroup)
42214688 tGroup.add/*Child*/(tmp);
42224689 else
4223
- GrafreeD.clipboard = tmp;
4690
+ Grafreed.clipboard = tmp;
42244691 }
42254692 else
4226
- if (GrafreeD.clipboardIsTempGroup)
4693
+ if (Grafreed.clipboardIsTempGroup)
42274694 tGroup.add/*Child*/(child);
42284695 else
4229
- GrafreeD.clipboard = child;
4696
+ Grafreed.clipboard = child;
42304697 }
42314698
42324699 }
4233
- if (GrafreeD.clipboardIsTempGroup)
4234
- GrafreeD.clipboard = tGroup;
4700
+
4701
+ if (Grafreed.clipboardIsTempGroup)
4702
+ Grafreed.clipboard = tGroup;
4703
+
42354704 if (cut)
42364705 {
42374706 ResetModel();
....@@ -4245,7 +4714,7 @@
42454714 // return;
42464715 boolean first = true;
42474716
4248
- if (GrafreeD.clipboardIsTempGroup)
4717
+ if (Grafreed.clipboardIsTempGroup)
42494718 {
42504719 Composite temp;
42514720
....@@ -4256,7 +4725,7 @@
42564725 temp = (Composite)Applet3D.clipboard.deepCopy();
42574726 */
42584727 Object3D elem;
4259
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4728
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
42604729 {
42614730 Object3D child = (Object3D)e.nextElement();
42624731
....@@ -4290,21 +4759,21 @@
42904759 //Object3D cb = Applet3D.clipboard;
42914760 //temp.addChild(cb);
42924761 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4293
- assert(GrafreeD.clipboard.parent == null);
4294
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4295
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4296
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4297
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4762
+ assert(Grafreed.clipboard.parent == null);
4763
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4764
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4765
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4766
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42984767 else
4299
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4300
- GrafreeD.clipboard.get(0).parent = keepparent;
4768
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4769
+ Grafreed.clipboard.get(0).parent = keepparent;
43014770 }
43024771
43034772 ResetModel();
43044773 refreshContents();
43054774 }
43064775
4307
- void pasteInto(boolean copyit)
4776
+ void pasteInto(boolean copyit, boolean clone)
43084777 {
43094778 // if (GrafreeD.clipboard == null)
43104779 // return;
....@@ -4333,15 +4802,22 @@
43334802 if (copyit)
43344803 {
43354804 // paste(false);
4336
- CloneClipboard(false); // sept 2014
4805
+ if (clone)
4806
+ {
4807
+ CloneClipboard(false); // sept 2014
4808
+ }
4809
+ else
4810
+ {
4811
+ paste(false);
4812
+ }
43374813 }
43384814 else
43394815 {
43404816 boolean first = true;
43414817
4342
- if (GrafreeD.clipboardIsTempGroup)
4818
+ if (Grafreed.clipboardIsTempGroup)
43434819 {
4344
- Composite temp = (Composite)GrafreeD.clipboard;
4820
+ Composite temp = (Composite)Grafreed.clipboard;
43454821 Object3D copy;
43464822 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43474823 {
....@@ -4351,7 +4827,7 @@
43514827 }
43524828 } else
43534829 {
4354
- linkSomething(GrafreeD.clipboard); //.get(0));
4830
+ linkSomething(Grafreed.clipboard); //.get(0));
43554831 }
43564832 }
43574833 }
....@@ -4756,21 +5232,6 @@
47565232 }
47575233 */
47585234
4759
- void ImportGFD()
4760
- {
4761
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4762
- browser.show();
4763
- String filename = browser.getFile();
4764
- if (filename != null && filename.length() > 0)
4765
- {
4766
- String fullname = browser.getDirectory() + filename;
4767
-
4768
- //Object3D readobj =
4769
- objEditor.ReadGFD(fullname, objEditor);
4770
- //makeSomething(readobj);
4771
- }
4772
- }
4773
-
47745235 /*
47755236 public void Callback(Object obj)
47765237 {
....@@ -4794,26 +5255,9 @@
47945255 }
47955256 */
47965257
4797
- void ImportVRMLX3D()
4798
- {
4799
- if (GrafreeD.standAlone)
4800
- {
4801
- /**/
4802
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4803
- browser.show();
4804
- String filename = browser.getFile();
4805
- if (filename != null && filename.length() > 0)
4806
- {
4807
- String fullname = browser.getDirectory() + filename;
4808
- LoadVRMLX3D(fullname);
4809
- }
4810
- /**/
4811
- }
4812
- }
4813
-
48145258 String GetFile(String dialogName)
48155259 {
4816
- if (GrafreeD.standAlone)
5260
+ if (Grafreed.standAlone)
48175261 {
48185262 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48195263 browser.show();
....@@ -4877,10 +5321,18 @@
48775321 cButton flashSelectionButton;
48785322 cButton editButton;
48795323 cButton uneditButton;
5324
+ JCheckBox allParamsButton;
48805325 cButton clearpanelButton;
4881
- cButton allParamsButton;
48825326 cButton unselectButton;
48835327
5328
+ cButton minButton;
5329
+ cButton maxButton;
5330
+ cButton fullButton;
5331
+ cButton undoButton;
5332
+ cButton redoButton;
5333
+ cButton saveButton;
5334
+ cButton oneStepButton;
5335
+
48845336 cButton screenfitButton;
48855337 cButton screenfitpointButton;
48865338 cButton snapobjectButton;
....@@ -4891,14 +5343,6 @@
48915343 cButton closeButton;
48925344
48935345 cButton setsupportButton;
4894
-
4895
- cButton twoButton;
4896
- cButton sixButton;
4897
- cButton threeButton;
4898
- cButton sevenButton;
4899
- cButton fourButton; // full panel
4900
- cButton oneButton; // full XYZ
4901
- //cButton currentLayout;
49025346
49035347 //
49045348 //Composite
....@@ -4911,6 +5355,8 @@
49115355 private MenuItem lookFromItem;
49125356 private MenuItem switchItem;
49135357 private MenuItem cutItem;
5358
+ private MenuItem undoItem;
5359
+ private MenuItem redoItem;
49145360 private MenuItem duplicateItem;
49155361 private MenuItem cloneItem;
49165362 private MenuItem cloneSupportItem;
....@@ -4924,7 +5370,7 @@
49245370 private MenuItem linkverticesItem;
49255371 private MenuItem relinkverticesItem;
49265372 private MenuItem setMasterItem;
4927
- private MenuItem resetMeshItem;
5373
+ private MenuItem resetAllItem;
49285374 private MenuItem stepAllItem;
49295375 private MenuItem revertMeshItem;
49305376 private MenuItem poseMeshItem;
....@@ -4935,6 +5381,7 @@
49355381 private MenuItem mergeGeometriesItem;
49365382 private MenuItem copyItem;
49375383 private MenuItem pasteItem;
5384
+ private MenuItem pasteIntoItem;
49385385 private MenuItem pasteLinkItem;
49395386 private MenuItem pasteCloneItem;
49405387 private MenuItem pasteExpandItem;
....@@ -4973,6 +5420,10 @@
49735420 private MenuItem showleavesItem;
49745421 private MenuItem markleavesItem;
49755422 private MenuItem unmarkleavesItem;
5423
+ private MenuItem rewindleavesItem;
5424
+ private MenuItem unrewindleavesItem;
5425
+ private MenuItem randomleavesItem;
5426
+ private MenuItem unrandomleavesItem;
49765427
49775428 private MenuItem flipVItem;
49785429 private MenuItem unflipVItem;
....@@ -4984,8 +5435,10 @@
49845435 private MenuItem panoTexturesItem;
49855436
49865437 private MenuItem resetCentroidItem;
4987
- private MenuItem transformgeometryItem;
5438
+ private MenuItem resetCentroidXZItem;
49885439 private MenuItem resetTransformItem;
5440
+ private MenuItem transformGeometryItem;
5441
+ private MenuItem transformChildrenItem;
49895442 private MenuItem hideItem;
49905443 private MenuItem grabItem;
49915444 private MenuItem backItem;
....@@ -5007,6 +5460,7 @@
50075460
50085461 private MenuItem resetParentItem;
50095462 private MenuItem repairParentItem;
5463
+ private MenuItem repairShadowItem;
50105464 private MenuItem sortbysizeItem;
50115465 private MenuItem sortbynameItem;
50125466
....@@ -5031,7 +5485,7 @@
50315485 private MenuItem blobItem;
50325486 private MenuItem latheItem;
50335487 private MenuItem bezierItem;
5034
- private MenuItem checkerItem;
5488
+ private MenuItem overlayItem;
50355489 private MenuItem meshItem;
50365490 // private MenuItem meshGroupItem;
50375491 private MenuItem springItem;
....@@ -5053,11 +5507,6 @@
50535507 private MenuItem doubleItem;
50545508 private MenuItem tripleItem;
50555509
5056
- private MenuItem importGFDItem;
5057
- private MenuItem importVRMLX3DItem;
5058
- private MenuItem import3DSItem;
5059
- private MenuItem importOBJItem;
5060
-
50615510 private MenuItem computeAOItem;
50625511 private MenuItem recompileItem;
50635512 private MenuItem editScriptItem;
....@@ -5067,4 +5516,8 @@
50675516 private MenuItem analyzeItem;
50685517 private MenuItem dumpItem;
50695518 //boolean freezemodel = false;
5519
+
5520
+ Menu cameraMenu;
5521
+ MenuItem editCameraItem;
5522
+ MenuItem revertCameraItem;
50705523 }