Normand Briere
2019-06-24 47cd0f0a3870d843cb758535316060d30f15c811
GroupEditor.java
....@@ -74,7 +74,7 @@
7474 this.copy = this.group = copy;
7575 //selectees = this.group.selectees;
7676
77
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7878 SetupUI2(objEditor);
7979 objEditor.SetupUI(true);
8080 SetupViews(objEditor);
....@@ -98,14 +98,14 @@
9898
9999 void CloneClipboard(boolean supports)
100100 {
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));
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));
106106 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
107
+ makeSomething(CloneObject(Grafreed.clipboard, false));
108
+ Grafreed.clipboard.get(0).parent = keepparent;
109109 }
110110
111111 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +119,7 @@
119119 // obj.support = null;
120120 if (!supports)
121121 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
122
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123123 obj.parent = parent;
124124 // obj.support = support;
125125 // clone.support = support; // aout 2013
....@@ -148,8 +148,131 @@
148148
149149 //JTextField nameField;
150150
151
- void SetupMenu2(ObjEditor oe)
151
+ void SetupMenu2(GroupEditor oe)
152152 {
153
+ oe.jTree = new cTree();
154
+
155
+ Menu menu;
156
+ oe.menuBar.add(menu = new Menu("Edit"));
157
+ //editItem = menu.add(new MenuItem("Edit"));
158
+ //editItem.addActionListener(this);
159
+
160
+// undoItem = menu.add(new MenuItem("Undo"));
161
+// undoItem.addActionListener(this);
162
+// redoItem = menu.add(new MenuItem("Redo"));
163
+// redoItem.addActionListener(this);
164
+// menu.add("-");
165
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
166
+ duplicateItem.addActionListener(this);
167
+ cloneItem = menu.add(new MenuItem("Clone"));
168
+ cloneItem.addActionListener(this);
169
+ if (Globals.ADVANCED)
170
+ {
171
+ cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
172
+ cloneSupportItem.addActionListener(this);
173
+ }
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
+
182
+ menu.add("-");
183
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
184
+ pasteIntoItem.addActionListener(this);
185
+ pasteLinkItem = menu.add(new MenuItem("Paste link"));
186
+ pasteLinkItem.addActionListener(this);
187
+ pasteCloneItem = menu.add(new MenuItem("Paste clone"));
188
+ pasteCloneItem.addActionListener(this);
189
+// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
190
+// pasteExpandItem.addActionListener(this);
191
+ menu.add("-");
192
+ clearItem = menu.add(new MenuItem("Clear"));
193
+ clearItem.addActionListener(this);
194
+
195
+ if (Globals.ADVANCED)
196
+ {
197
+ // Deletes the cameras...
198
+ clearAllItem = menu.add(new MenuItem("Clear All"));
199
+ clearAllItem.addActionListener(this);
200
+ }
201
+
202
+ menuBar.add(cameraMenu = new Menu("View"));
203
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
204
+ //zBufferItem.addActionListener(this);
205
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
206
+ //normalLensItem.addActionListener(this);
207
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
208
+ revertCameraItem.addActionListener(this);
209
+
210
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
211
+ toggleFullScreenItem.addItemListener(this);
212
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
213
+ cameraMenu.add("-");
214
+
215
+ cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
216
+ toggleTextureItem.addItemListener(this);
217
+ toggleTextureItem.setState(CameraPane.textureon);
218
+
219
+ cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
220
+ toggleSwitchItem.addItemListener(this);
221
+ toggleSwitchItem.setState(CameraPane.SWITCH);
222
+
223
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
224
+ toggleHandleItem.addItemListener(this);
225
+ toggleHandleItem.setState(CameraPane.HANDLES);
226
+
227
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
228
+ togglePaintItem.addItemListener(this);
229
+ togglePaintItem.setState(CameraPane.PAINTMODE);
230
+
231
+ if (Globals.ADVANCED)
232
+ {
233
+ cameraMenu.add("-");
234
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
235
+ toggleLiveItem.addItemListener(this);
236
+ toggleLiveItem.setState(Globals.isLIVE());
237
+
238
+ cameraMenu.add(stepItem = new MenuItem("Step"));
239
+ stepItem.addActionListener(this);
240
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
241
+ // toggleDLItem.addItemListener(this);
242
+ // toggleDLItem.setState(false);
243
+
244
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
245
+ toggleRenderItem.addItemListener(this);
246
+ toggleRenderItem.setState(!CameraPane.frozen);
247
+
248
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
249
+ toggleDebugItem.addItemListener(this);
250
+ toggleDebugItem.setState(Globals.DEBUG);
251
+
252
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
253
+ toggleFrustumItem.addItemListener(this);
254
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
255
+
256
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
257
+ toggleFootContactItem.addItemListener(this);
258
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
259
+
260
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
261
+ toggleTimelineItem.addItemListener(this);
262
+ }
263
+
264
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
265
+// toggleRootItem.addItemListener(this);
266
+// toggleRootItem.setState(false);
267
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
268
+// animationItem.addItemListener(this);
269
+// animationItem.setState(CameraPane.ANIMATION);
270
+ cameraMenu.add("-");
271
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
272
+ editCameraItem.addActionListener(this);
273
+
274
+ if (Globals.ADVANCED)
275
+ {
153276 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
154277 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
155278 //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
....@@ -161,45 +284,17 @@
161284 lookAtItem.addActionListener(this);
162285 //lookFromItem.addActinoListener(this);
163286 //switchItem.addActionListener(this);
164
- Menu menu;
165
- oe.menuBar.add(menu = new Menu("Edit"));
166
- //editItem = menu.add(new MenuItem("Edit"));
167
- //editItem.addActionListener(this);
168
- duplicateItem = menu.add(new MenuItem("Duplicate"));
169
- duplicateItem.addActionListener(this);
170
- menu.add("-");
171
- cloneItem = menu.add(new MenuItem("Clone"));
172
- cloneItem.addActionListener(this);
173
- cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
174
- cloneSupportItem.addActionListener(this);
175
- menu.add("-");
176
- cutItem = menu.add(new MenuItem("Cut"));
177
- cutItem.addActionListener(this);
178
- copyItem = menu.add(new MenuItem("Copy"));
179
- copyItem.addActionListener(this);
180
- pasteItem = menu.add(new MenuItem("Paste"));
181
- pasteItem.addActionListener(this);
182
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
183
- pasteLinkItem.addActionListener(this);
184
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
185
- pasteCloneItem.addActionListener(this);
186
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
187
-// pasteExpandItem.addActionListener(this);
188
- clearItem = menu.add(new MenuItem("Clear"));
189
- clearItem.addActionListener(this);
190
- clearAllItem = menu.add(new MenuItem("Clear All"));
191
- clearAllItem.addActionListener(this);
192
-
287
+ }
288
+
193289 oe.menuBar.add(menu = new Menu("Setting"));
194
- resetMeshItem = menu.add(new MenuItem("Reset All"));
195
- resetMeshItem.addActionListener(this);
196
- stepAllItem = menu.add(new MenuItem("Step All"));
197
- stepAllItem.addActionListener(this);
290
+ if (Globals.ADVANCED)
291
+ {
198292 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
199293 revertMeshItem.addActionListener(this);
200294 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
201295 resetreferencesItem.addActionListener(this);
202296 menu.add("-");
297
+ }
203298 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
204299 overwriteGeoItem.addActionListener(this);
205300 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -211,19 +306,26 @@
211306 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
212307 overwriteUVItem.addActionListener(this);
213308 menu.add("-");
309
+ if (Globals.ADVANCED)
310
+ {
214311 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
215312 generateMeshItem.addActionListener(this);
216313 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
217314 poseMeshItem.addActionListener(this);
218315 menu.add("-");
316
+ }
219317 resetsupportItem = menu.add(new MenuItem("Reset support"));
220318 resetsupportItem.addActionListener(this);
221319 linkverticesItem = menu.add(new MenuItem("Link to Support"));
222320 linkverticesItem.addActionListener(this);
223321 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224322 relinkverticesItem.addActionListener(this);
323
+
324
+ if (Globals.ADVANCED)
325
+ {
225326 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
226327 setMasterItem.addActionListener(this);
328
+ }
227329
228330 oe.menuBar.add(menu = new Menu("Group"));
229331 grabItem = menu.add(new MenuItem("Grab"));
....@@ -234,27 +336,38 @@
234336 frontItem.addActionListener(this);
235337 compositeItem = menu.add(new MenuItem("Composite"));
236338 compositeItem.addActionListener(this);
237
- hideItem = menu.add(new MenuItem("Hide"));
339
+
340
+ if (Globals.ADVANCED)
341
+ {
342
+ hideItem = menu.add(new MenuItem("Hidden Group"));
238343 hideItem.addActionListener(this);
344
+ }
239345 ungroupItem = menu.add(new MenuItem("Ungroup"));
240346 ungroupItem.addActionListener(this);
347
+
241348 menu.add("-");
349
+
242350 randomItem = menu.add(new MenuItem("Switch node"));
243351 randomItem.addActionListener(this);
352
+ if (Globals.ADVANCED)
353
+ {
244354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
245355 switchGeoItem.addActionListener(this);
246356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
247357 switchTransfoItem.addActionListener(this);
358
+ morphItem = menu.add(new MenuItem("Morph Group"));
359
+ morphItem.addActionListener(this);
360
+
361
+ menu.add("-");
248362 physicsItem = menu.add(new MenuItem("Physics"));
249363 physicsItem.addActionListener(this);
250364 frameselectorItem = menu.add(new MenuItem("Frame Selector"));
251365 frameselectorItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
253
- morphItem.addActionListener(this);
254366 scriptNodeItem = menu.add(new MenuItem("Script Node"));
255367 scriptNodeItem.addActionListener(this);
256368 cameraItem = menu.add(new MenuItem("Camera"));
257369 cameraItem.addActionListener(this);
370
+ }
258371
259372 oe.menuBar.add(menu = new Menu("Object"));
260373 textureItem = menu.add(new MenuItem("Texture"));
....@@ -263,27 +376,35 @@
263376 billboardItem.addActionListener(this);
264377 csgItem = menu.add(new MenuItem("CSG"));
265378 csgItem.addActionListener(this);
266
- shadowXItem = menu.add(new MenuItem("Shadow X"));
379
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
267380 shadowXItem.addActionListener(this);
268
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
381
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
269382 shadowYItem.addActionListener(this);
270
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
383
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
271384 shadowZItem.addActionListener(this);
385
+ if (Globals.ADVANCED)
386
+ {
387
+ menu.add("-");
272388 linkerItem = menu.add(new MenuItem("Linker"));
273389 linkerItem.addActionListener(this);
274
- templateItem = menu.add(new MenuItem("Template"));
275
- templateItem.addActionListener(this);
276390 attributeItem = menu.add(new MenuItem("Attribute"));
277391 attributeItem.addActionListener(this);
392
+ templateItem = menu.add(new MenuItem("Template"));
393
+ templateItem.addActionListener(this);
278394 pointflowItem = menu.add(new MenuItem("Point Flow"));
279395 pointflowItem.addActionListener(this);
396
+ }
280397 menu.add("-");
281398 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
282399 resetTransformItem.addActionListener(this);
283400 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
284401 resetCentroidItem.addActionListener(this);
285
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
- transformgeometryItem.addActionListener(this);
402
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
403
+ resetCentroidXZItem.addActionListener(this);
404
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
405
+ transformGeometryItem.addActionListener(this);
406
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
407
+ transformChildrenItem.addActionListener(this);
287408
288409 oe.menuBar.add(menu = new Menu("Geometry"));
289410 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -294,8 +415,11 @@
294415 genNormalsCADItem.addActionListener(this);
295416 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296417 genNormalsMESHItem.addActionListener(this);
418
+ if (Globals.ADVANCED)
419
+ {
297420 genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
298421 genNormalsMINEItem.addActionListener(this);
422
+ }
299423 stripifyItem = menu.add(new MenuItem("Stripify"));
300424 stripifyItem.addActionListener(this);
301425 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -317,23 +441,34 @@
317441 reduce34MeshItem.addActionListener(this);
318442 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
319443 increaseMeshItem.addActionListener(this);
320
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
321
- smoothMeshItem.addActionListener(this);
322444 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
323445 clipMeshItem.addActionListener(this);
446
+
447
+ if (Globals.ADVANCED)
448
+ {
449
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
450
+ smoothMeshItem.addActionListener(this);
451
+ }
324452
325453 oe.menuBar.add(menu = new Menu("Attributes"));
326454 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327455 clearMaterialsItem.addActionListener(this);
456
+ resetAllItem = menu.add(new MenuItem("Reset All"));
457
+ resetAllItem.addActionListener(this);
458
+ stepAllItem = menu.add(new MenuItem("Step All"));
459
+ stepAllItem.addActionListener(this);
328460 menu.add("-");
329461 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
330462 liveleavesItem.addActionListener(this);
331463 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
332464 unliveleavesItem.addActionListener(this);
465
+ if (Globals.ADVANCED)
466
+ {
333467 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
334468 supportleavesItem.addActionListener(this);
335469 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
336470 unsupportleavesItem.addActionListener(this);
471
+ }
337472 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
338473 hideleavesItem.addActionListener(this);
339474 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -342,6 +477,14 @@
342477 markleavesItem.addActionListener(this);
343478 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
344479 unmarkleavesItem.addActionListener(this);
480
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
481
+ rewindleavesItem.addActionListener(this);
482
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
483
+ unrewindleavesItem.addActionListener(this);
484
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
485
+ randomleavesItem.addActionListener(this);
486
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
487
+ unrandomleavesItem.addActionListener(this);
345488 menu.add("-");
346489 flipVItem = menu.add(new MenuItem("Flip V"));
347490 flipVItem.addActionListener(this);
....@@ -377,35 +520,40 @@
377520 sortbynameItem = menu.add(new MenuItem("Sort by name"));
378521 sortbynameItem.addActionListener(this);
379522 menu.add("-");
523
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
524
+ shareGeometriesItem.addActionListener(this);
525
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
526
+ mergeGeometriesItem.addActionListener(this);
527
+ if (Globals.ADVANCED)
528
+ {
529
+ // Pretty much the same as duplicate and clone.
380530 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381531 extractGeometriesItem.addActionListener(this);
382532 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383533 cloneGeometriesItem.addActionListener(this);
384
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
385
- shareGeometriesItem.addActionListener(this);
386
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
387
- mergeGeometriesItem.addActionListener(this);
534
+ }
388535
389536 oe.menuBar.add(menu = new Menu("Insert"));
390537 buildCreateMenu(menu);
391538
392
-
393
- oe.menuBar.add(menu = new Menu("Include"));
394
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
395
- importGFDItem.addActionListener(this);
396
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
397
- importVRMLX3DItem.addActionListener(this);
398
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
399
- importOBJItem.addActionListener(this);
400
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
401
- import3DSItem.addActionListener(this);
402
-
403539 oe.menuBar.add(menu = new Menu("Tools"));
404540 buildToolsMenu(menu);
405541 }
406542
407543 void SetupUI2(ObjEditor oe)
408544 {
545
+ // June 2019
546
+ if (oe == null)
547
+ {
548
+ //super.SetupUI2(this);
549
+ //return;
550
+ }
551
+
552
+ if (copy != group)
553
+ {
554
+ //super.SetupUI2(this);
555
+ }
556
+
409557 //new Exception().printStackTrace();
410558
411559 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -436,19 +584,49 @@
436584 */
437585 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
438586
439
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
440
- liveCB.setToolTipText("Enabled animation");
587
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ //minButton.setToolTipText("Minimize window");
589
+ //minButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ maxButton.setToolTipText("Maximize window");
593
+ maxButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ fullButton.setToolTipText("Full-screen window");
597
+ fullButton.addActionListener(this);
598
+
599
+ oe.toolboxPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ undoButton.setToolTipText("Undo changes");
601
+ undoButton.addActionListener(this);
602
+
603
+ oe.toolboxPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
604
+ redoButton.setToolTipText("Redo changes");
605
+ redoButton.addActionListener(this);
606
+
607
+ oe.toolboxPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ saveButton.setToolTipText("Save changes");
609
+ saveButton.addActionListener(this);
610
+
611
+ oe.toolboxPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
612
+ liveCB.setToolTipText("Enable animation");
441613 liveCB.addItemListener(this);
442614
443
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
615
+ oe.toolboxPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ oneStepButton.setToolTipText("Animate one step forward");
617
+ oneStepButton.addActionListener(this);
618
+
619
+ oe.toolboxPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
444620 fastCB.setToolTipText("Fast mode");
445621 fastCB.addItemListener(this);
446622
447
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
623
+ oe.toolboxPanel.Return();
624
+
625
+ oe.toolboxPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
448626 trackCB.setToolTipText("Enable tracking");
449627 trackCB.addItemListener(this);
450628
451
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
629
+ oe.toolboxPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
452630 screenfitButton.setToolTipText("Screen fit");
453631 screenfitButton.addActionListener(this);
454632
....@@ -457,70 +635,117 @@
457635
458636 if (Globals.ADVANCED)
459637 {
460
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
638
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
461639 snapobjectButton.addActionListener(this);
462640 snapobjectButton.setToolTipText("Snap Object");
463641 }
464642
465
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
466
- flashSelectionButton.setToolTipText("Show selection");
643
+ oe.toolboxPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ flashSelectionButton.setToolTipText("Highlight selection");
467645 flashSelectionButton.addActionListener(this);
468646
469
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
647
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
470648
471
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
649
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
472650 twoButton.setToolTipText("Show center view only");
473651 twoButton.addActionListener(this);
474
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
652
+ this.fullscreenLayout = twoButton;
653
+
654
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
475655 fourButton.addActionListener(this);
476656 fourButton.setToolTipText("Show left panel only");
477
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
657
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
478658 sixButton.setToolTipText("2-column layout left");
479659 sixButton.addActionListener(this);
480
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
660
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
481661 threeButton.setToolTipText("2-column layout right");
482662 threeButton.addActionListener(this);
483
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
663
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
484664 sevenButton.setToolTipText("3-column layout");
485665 sevenButton.addActionListener(this);
486666 //
487667
488
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
668
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
489669 rootButton.setToolTipText("Edit selection in new tab");
490670 rootButton.addActionListener(this);
491671
492
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
672
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
493673 closeButton.setToolTipText("Close tab");
494674 closeButton.addActionListener(this);
495675 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
496676 //clearButton.addActionListener(this);
497
-
498
- cGridBag commandsPanel = new cGridBag();
677
+
678
+ // INSERT
679
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
680
+ gridButton.setToolTipText("Create grid");
681
+ gridButton.addActionListener(this);
682
+
683
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ boxButton.setToolTipText("Create box");
685
+ boxButton.addActionListener(this);
686
+
687
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ sphereButton.setToolTipText("Create sphere");
689
+ sphereButton.addActionListener(this);
690
+
691
+ oe.toolboxPanel.Return();
499692
500
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
693
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694
+ coneButton.setToolTipText("Create cone");
695
+ coneButton.addActionListener(this);
696
+
697
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
+ torusButton.setToolTipText("Create torus");
699
+ torusButton.addActionListener(this);
700
+
701
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
702
+ superButton.setToolTipText("Create superellipsoid");
703
+ superButton.addActionListener(this);
704
+
705
+ if (Globals.ADVANCED)
706
+ {
707
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ kleinButton.setToolTipText("Create Klein bottle");
709
+ kleinButton.addActionListener(this);
710
+ }
711
+
712
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ particlesButton.setToolTipText("Create particle system");
714
+ particlesButton.addActionListener(this);
715
+
716
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
717
+ overlayButton.setToolTipText("Create overlay");
718
+ overlayButton.addActionListener(this);
719
+
720
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
721
+ lightButton.setToolTipText("Create light");
722
+ lightButton.addActionListener(this);
723
+
724
+ // EDIT panel
725
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
501726 editButton.setToolTipText("Edit selection");
502727 editButton.addActionListener(this);
503728
504
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
729
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
505730 uneditButton.setToolTipText("Unedit selection");
506731 uneditButton.addActionListener(this);
507732
508
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
733
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
734
+ allParamsButton.setToolTipText("Edit all params");
735
+ allParamsButton.addActionListener(this);
736
+
737
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
509738 clearPanelButton.setToolTipText("Clear edit panel");
510739 clearPanelButton.addActionListener(this);
511740
512
- commandsPanel.add(allParamsButton = new cButton("A", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
513
- allParamsButton.setToolTipText("All params??");
514
- allParamsButton.addActionListener(this);
515
-
516
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
741
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
517742 unselectButton.setToolTipText("Unselect");
518743 unselectButton.addActionListener(this);
519744
520
- commandsPanel.preferredHeight = 1;
745
+ editCommandsPanel.preferredHeight = 1;
521746
522
- oe.treePanel.add(commandsPanel);
523
- oe.treePanel.Return();
747
+// oe.treePanel.add(commandsPanel);
748
+// oe.treePanel.Return();
524749
525750 // oe.aConstraints.gridx += 1;
526751 // oe.aConstraints.weighty = 0;
....@@ -537,7 +762,7 @@
537762
538763 JScrollPane jSP;
539764 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
540
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
765
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
541766 ResetModel();
542767
543768 oe.treePanel.add(jSPPanel);
....@@ -588,8 +813,18 @@
588813
589814 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
590815 {
816
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
817
+ boxCB.setToolTipText("Display bounding boxes");
818
+ boxCB.addItemListener(this);
819
+
820
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
821
+ zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
822
+ zoomBoxCB.addItemListener(this);
823
+
824
+ if (true) // Globals.ADVANCED)
825
+ {
591826 panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
592
- supportCB.setToolTipText("Enabled rigging");
827
+ supportCB.setToolTipText("Enable rigging");
593828 supportCB.addItemListener(this);
594829
595830 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
....@@ -607,14 +842,6 @@
607842 slowCB.setToolTipText("Smooth interpolation");
608843 slowCB.addItemListener(this);
609844
610
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
611
- boxCB.setToolTipText("Display bounding boxes");
612
- boxCB.addItemListener(this);
613
-
614
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
615
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
616
- zoomBoxCB.addItemListener(this);
617
-
618845 // constraints.gridy += 1;
619846 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
620847 // speakerMocapCB.addItemListener(this);
....@@ -640,11 +867,25 @@
640867 // debugCB.addItemListener(this);
641868
642869 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
870
+ oeilCB.setToolTipText("Move camera when tracking target");
643871 oeilCB.addItemListener(this);
644872
873
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
874
+ shadowCB.setToolTipText("Compute shadows when live");
875
+ shadowCB.addItemListener(this);
876
+
877
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
878
+ autosaveCB.setToolTipText("Auto-save on structure change");
879
+ autosaveCB.addItemListener(this);
880
+
881
+ if (Globals.ADVANCED)
882
+ {
645883 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
646884 lookAtCB.setToolTipText("Look-at target");
647885 lookAtCB.addItemListener(this);
886
+ }
887
+
888
+ }
648889
649890 cGridBag fill = new cGridBag();
650891
....@@ -657,6 +898,14 @@
657898 void EditObject(Object3D obj)
658899 {
659900 cRadio radioButton = new cRadio(obj.name);
901
+
902
+ // Patch to avoid bug with transparency.
903
+ radioButton.hadMaterial = obj.material != null;
904
+ if (!radioButton.hadMaterial)
905
+ {
906
+ obj.material = new cMaterial();
907
+ }
908
+
660909 radioButton.SetObject(obj);
661910 radioButton.layout = sevenButton;
662911 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -665,8 +914,11 @@
665914 buttonGroup.add(radioButton);
666915 radioButton.doClick();
667916 }
917
+
668918 void SetupViews(ObjEditor oe)
669919 {
920
+ theFrame = this;
921
+
670922 oe.SetupViews();
671923
672924 System.out.println("SetupViews");
....@@ -675,23 +927,26 @@
675927 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
676928 }
677929
678
- JCheckBox liveCB;
679
- JCheckBox supportCB;
680
- JCheckBox localCB;
681
- JCheckBox crowdCB;
682
- JCheckBox smoothCB;
683
- JCheckBox fastCB;
684
- JCheckBox slowCB;
685
- JCheckBox boxCB;
686
- JCheckBox zoomBoxCB;
687
- JCheckBox trackCB;
688
- JCheckBox smoothfocusCB;
930
+ cToggleButton liveCB;
931
+ cCheckBox supportCB;
932
+ cCheckBox localCB;
933
+ cCheckBox crowdCB;
934
+ cCheckBox smoothCB;
935
+ cToggleButton fastCB;
936
+ cCheckBox slowCB;
937
+ cCheckBox boxCB;
938
+ cCheckBox zoomBoxCB;
939
+ cToggleButton trackCB;
940
+ cCheckBox smoothfocusCB;
689941 // JCheckBox speakerMocapCB;
690
- JCheckBox speakerCameraCB;
691
- JCheckBox speakerFocusCB;
692
- JCheckBox debugCB;
693
- JCheckBox oeilCB;
694
- JCheckBox lookAtCB;
942
+ cCheckBox speakerCameraCB;
943
+ cCheckBox speakerFocusCB;
944
+ cCheckBox debugCB;
945
+
946
+ cCheckBox oeilCB;
947
+ cCheckBox shadowCB;
948
+ cCheckBox autosaveCB;
949
+ cCheckBox lookAtCB;
695950
696951 // static int COLOR = 1;
697952 // static int MATERIAL = 2;
....@@ -699,9 +954,9 @@
699954
700955 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
701956
702
- JCheckBox colorCB;
703
- JCheckBox materialCB;
704
- JCheckBox textureCB;
957
+ cCheckBox colorCB;
958
+ cCheckBox materialCB;
959
+ cCheckBox textureCB;
705960
706961 public void itemStateChanged(ItemEvent e)
707962 {
....@@ -729,6 +984,7 @@
729984 } else if(e.getSource() == liveCB)
730985 {
731986 cameraView.ToggleLive();
987
+ refreshContents(false);
732988 }
733989 else if(e.getSource() == supportCB)
734990 {
....@@ -793,6 +1049,14 @@
7931049 {
7941050 cameraView.ToggleOeil();
7951051 }
1052
+ else if(e.getSource() == shadowCB)
1053
+ {
1054
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1055
+ }
1056
+ else if(e.getSource() == autosaveCB)
1057
+ {
1058
+ Globals.SAVEONMAKE ^= true;
1059
+ }
7961060 else if(e.getSource() == lookAtCB)
7971061 {
7981062 cameraView.ToggleLookAt();
....@@ -809,7 +1073,8 @@
8091073
8101074 /**/
8111075 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
812
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1076
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1077
+ TreePath path = objEditor.jTree.getSelectionPath();
8131078 if ((path == null) || (path.getPathCount() <= 1)) {
8141079 // We can't move the root node or an empty selection
8151080 return;
....@@ -881,7 +1146,9 @@
8811146 // objEditor.DropFile((java.io.File[]) object, true);
8821147 // return;
8831148 // }
884
- if (string.charAt(0) == '/')
1149
+
1150
+ // File path for Mac and Windows
1151
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8851152 {
8861153 // file(s)
8871154 String[] names = string.split("\n");
....@@ -908,7 +1175,7 @@
9081175
9091176 flashIt = false;
9101177 CameraPane pane = (CameraPane) target;
911
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1178
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9121179 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9131180
9141181 if (group.selection.size() == 1)
....@@ -931,16 +1198,16 @@
9311198 return;
9321199 }
9331200
934
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
935
- {
1201
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1202
+// {
9361203 loadClipboard(true);
9371204 objEditor.jTree.setSelectionPath(destinationPath);
938
- pasteInto(false);
939
- } else {
940
- loadClipboard(false);
941
- objEditor.jTree.setSelectionPath(destinationPath);
942
- pasteInto(false); // true); // ???
943
- }
1205
+ pasteInto(false, false);
1206
+// } else {
1207
+// loadClipboard(false);
1208
+// objEditor.jTree.setSelectionPath(destinationPath);
1209
+// pasteInto(false, false); // true); // ???
1210
+// }
9441211 }
9451212 public void dropActionChanged(DropTargetDragEvent dtde)
9461213 // Called if the user has modified the current drop gesture
....@@ -1061,27 +1328,33 @@
10611328 kleinItem.addActionListener(this);
10621329 particleItem = menu.add(new MenuItem("Particle system"));
10631330 particleItem.addActionListener(this);
1331
+ if (Globals.ADVANCED)
1332
+ {
10641333 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10651334 ragdollItem.addActionListener(this);
10661335 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10671336 ragdoll2Item.addActionListener(this);
1337
+ }
10681338 menu.add("-");
1069
- meshItem = menu.add(new MenuItem("Mesh"));
1339
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10701340 meshItem.addActionListener(this);
10711341 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10721342 // meshGroupItem.addActionListener(this);
1343
+ if (Globals.ADVANCED)
1344
+ {
10731345 springItem = menu.add(new MenuItem("Spring"));
10741346 springItem.addActionListener(this);
10751347 flagItem = menu.add(new MenuItem("Flag"));
10761348 flagItem.addActionListener(this);
1077
- bezierItem = menu.add(new MenuItem("Patch"));
1078
- bezierItem.addActionListener(this);
1079
- checkerItem = menu.add(new MenuItem("Checker"));
1080
- checkerItem.addActionListener(this);
10811349 blobItem = menu.add(new MenuItem("Blob"));
10821350 blobItem.addActionListener(this);
10831351 latheItem = menu.add(new MenuItem("Lathe"));
10841352 latheItem.addActionListener(this);
1353
+ }
1354
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1355
+ bezierItem.addActionListener(this);
1356
+ overlayItem = menu.add(new MenuItem("Overlay"));
1357
+ overlayItem.addActionListener(this);
10851358 lightItem = menu.add(new MenuItem("Light"));
10861359 lightItem.addActionListener(this);
10871360 menu.add("-");
....@@ -1091,8 +1364,11 @@
10911364 loopItem.addActionListener(this);
10921365 doubleItem = menu.add(new MenuItem("Fork"));
10931366 doubleItem.addActionListener(this);
1367
+ if (Globals.ADVANCED)
1368
+ {
10941369 tripleItem = menu.add(new MenuItem("Trident"));
10951370 tripleItem.addActionListener(this);
1371
+ }
10961372 }
10971373
10981374 void buildToolsMenu(Menu menu)
....@@ -1106,24 +1382,26 @@
11061382 parseverticesItem.addActionListener(this);
11071383 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11081384 textureFieldItem.addActionListener(this);
1109
- alignItem = menu.add(new MenuItem("Align"));
1385
+ alignItem = menu.add(new MenuItem("Align Objects"));
11101386 alignItem.addActionListener(this);
1111
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1112
- mirrorItem.addActionListener(this);
11131387 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11141388 reduceMorphItem.addActionListener(this);
11151389 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11161390 reduce34MorphItem.addActionListener(this);
1117
-
1391
+ menu.add("-");
11181392 menu.add(computeAOItem = new MenuItem("Compute AO"));
11191393 computeAOItem.addActionListener(this);
1120
- menu.add("-");
11211394
1395
+ if (Globals.ADVANCED)
1396
+ {
1397
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1398
+ mirrorItem.addActionListener(this);
1399
+ menu.add("-");
11221400 menu.add(memoryItem = new MenuItem("Memory Usage"));
11231401 memoryItem.addActionListener(this);
11241402 menu.add(analyzeItem = new MenuItem("Analyze"));
11251403 analyzeItem.addActionListener(this);
1126
- menu.add(dumpItem = new MenuItem("Dump"));
1404
+ menu.add(dumpItem = new MenuItem("Print"));
11271405 dumpItem.addActionListener(this);
11281406 // menu.add(pathItem = new MenuItem("From-to path"));
11291407 // pathItem.addActionListener(this);
....@@ -1141,6 +1419,7 @@
11411419 menu.add("-");
11421420 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11431421 editScriptItem.addActionListener(this);
1422
+ }
11441423 }
11451424
11461425 void ScreenFit()
....@@ -1263,6 +1542,7 @@
12631542 shadow.material = new cMaterial(obj.material);
12641543 shadow.material.diffuse = 0.0001f;
12651544 shadow.material.specular = 0.0001f;
1545
+ //shadow.projectedVertices[1].x = 300;
12661546
12671547 makeSomething(shadow);
12681548 }
....@@ -1469,9 +1749,9 @@
14691749
14701750 void Overwrite(int mask)
14711751 {
1472
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1752
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14731753 {
1474
- Object3D content = GrafreeD.clipboard.get(0);
1754
+ Object3D content = Grafreed.clipboard.get(0);
14751755
14761756 if (content instanceof cGroup && ((cGroup)content).transientlink )
14771757 content = ((cGroup)content).get(0);
....@@ -1519,11 +1799,11 @@
15191799 objEditor.cameraView.renderCamera.setAim(v2, v1);
15201800 objEditor.cameraView.repaint();
15211801 } else
1522
- if (source == rectoidItem)
1802
+ if (source == rectoidItem || source == boxButton)
15231803 {
15241804 makeSomething(new Box());
15251805 } else
1526
- if (source == particleItem)
1806
+ if (source == particleItem || source == particlesButton)
15271807 {
15281808 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15291809 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1602,27 +1882,27 @@
16021882
16031883 makeSomething(obj);
16041884 } else
1605
- if (source == gridItem)
1885
+ if (source == gridItem || source == gridButton)
16061886 {
16071887 makeSomething(new Grid());
16081888 } else
1609
- if (source == ellipsoidItem)
1889
+ if (source == ellipsoidItem || source == sphereButton)
16101890 {
16111891 makeSomething(new Sphere());
16121892 } else
1613
- if (source == coneItem)
1893
+ if (source == coneItem || source == coneButton)
16141894 {
16151895 makeSomething(new Cone());
16161896 } else
1617
- if (source == torusItem)
1897
+ if (source == torusItem || source == torusButton)
16181898 {
16191899 makeSomething(new Torus());
16201900 } else
1621
- if (source == superItem)
1901
+ if (source == superItem || source == superButton)
16221902 {
16231903 makeSomething(new Superellipsoid());
16241904 } else
1625
- if (source == kleinItem)
1905
+ if (source == kleinItem || source == kleinButton)
16261906 {
16271907 makeSomething(new Klein());
16281908 } else
....@@ -1642,7 +1922,7 @@
16421922 {
16431923 makeSomething(new BezierSurface());
16441924 } else
1645
- if (source == checkerItem)
1925
+ if (source == overlayItem || source == overlayButton)
16461926 {
16471927 /*
16481928 Object3D obj = new BezierSurface(5,8);
....@@ -1690,7 +1970,7 @@
16901970 s.setup();
16911971 makeSomething(s);
16921972 } else
1693
- if (source == lightItem)
1973
+ if (source == lightItem || source == lightButton)
16941974 {
16951975 makeSomething(new Light());
16961976 } else
....@@ -1776,23 +2056,6 @@
17762056 csg.addChild(child);
17772057 child.addChild(csg);
17782058 } else
1779
-
1780
- if (source == importGFDItem)
1781
- {
1782
- ImportGFD();
1783
- } else
1784
- if (source == importVRMLX3DItem)
1785
- {
1786
- ImportVRMLX3D();
1787
- } else
1788
- if (source == import3DSItem)
1789
- {
1790
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1791
- } else
1792
- if (source == importOBJItem)
1793
- {
1794
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1795
- } else
17962059 if (source == computeAOItem)
17972060 {
17982061 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1811,7 +2074,7 @@
18112074 if (source == invariantsItem)
18122075 {
18132076 System.out.println("Invariants:");
1814
- GrafreeD.grafreeD.universe.invariants();
2077
+ Grafreed.grafreeD.universe.invariants();
18152078 } else
18162079 if (source == memoryItem)
18172080 {
....@@ -1829,6 +2092,35 @@
18292092 if (source == dumpItem)
18302093 {
18312094 DumpObject();
2095
+ } else
2096
+ if (source == minButton)
2097
+ {
2098
+ Minimize();
2099
+ } else
2100
+ if (source == maxButton)
2101
+ {
2102
+ Maximize();
2103
+ } else
2104
+ if (source == fullButton)
2105
+ {
2106
+ ToggleFullScreen();
2107
+ } else
2108
+ if (source == undoButton)
2109
+ {
2110
+ Undo();
2111
+ } else
2112
+ if (source == redoButton)
2113
+ {
2114
+ Redo();
2115
+ } else
2116
+ if (source == saveButton)
2117
+ {
2118
+ Save();
2119
+ } else
2120
+ if (source == oneStepButton)
2121
+ {
2122
+ Globals.ONESTEP = true;
2123
+ cameraView.repaint();
18322124 } else
18332125 if (source == screenfitButton)
18342126 {
....@@ -1879,12 +2171,20 @@
18792171 {
18802172 loadClipboard(true);
18812173 } else
2174
+ if (source == undoItem)
2175
+ {
2176
+ Undo();
2177
+ } else
2178
+ if (source == redoItem)
2179
+ {
2180
+ Redo();
2181
+ } else
18822182 if (source == duplicateItem)
18832183 {
1884
- Object3D keep = GrafreeD.clipboard;
2184
+ Object3D keep = Grafreed.clipboard;
18852185 loadClipboard(false);
18862186 paste(false);
1887
- GrafreeD.clipboard = keep;
2187
+ Grafreed.clipboard = keep;
18882188 } else
18892189 if (source == cloneItem)
18902190 {
....@@ -1902,13 +2202,17 @@
19022202 {
19032203 paste(false);
19042204 } else
2205
+ if (source == pasteIntoItem)
2206
+ {
2207
+ pasteInto(true, false);
2208
+ } else
19052209 if (source == pasteLinkItem)
19062210 {
1907
- pasteInto(false);
2211
+ pasteInto(false, false);
19082212 } else
19092213 if (source == pasteCloneItem)
19102214 {
1911
- pasteInto(true);
2215
+ pasteInto(true, true);
19122216 } else
19132217 if (source == pasteExpandItem)
19142218 {
....@@ -2100,9 +2404,9 @@
21002404 // group.selection.get(0).setMasterThis(content); // should be identity
21012405 // refreshContents();
21022406 // }
2103
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2407
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21042408 {
2105
- Object3D content = GrafreeD.clipboard.get(0);
2409
+ Object3D content = Grafreed.clipboard.get(0);
21062410
21072411 if (content instanceof cGroup && ((cGroup)content).transientlink )
21082412 content = ((cGroup)content).get(0);
....@@ -2110,11 +2414,11 @@
21102414 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21112415 for (int i=0; i<group.selection.size(); i++)
21122416 {
2113
- boolean random = CameraPane.RANDOM;
2114
- CameraPane.RANDOM = false; // parse all random nodes
2417
+ boolean random = CameraPane.SWITCH;
2418
+ CameraPane.SWITCH = false; // parse all random nodes
21152419 group.selection.get(i).linkVerticesThis(content);
21162420 // group.selection.get(i).setMasterThis(content); // should be identity
2117
- CameraPane.RANDOM = random;
2421
+ CameraPane.SWITCH = random;
21182422 }
21192423 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21202424 refreshContents();
....@@ -2124,20 +2428,20 @@
21242428 {
21252429 for (int i=0; i<group.selection.size(); i++)
21262430 {
2127
- boolean random = CameraPane.RANDOM;
2128
- CameraPane.RANDOM = false; // parse all random nodes
2431
+ boolean random = CameraPane.SWITCH;
2432
+ CameraPane.SWITCH = false; // parse all random nodes
21292433 group.selection.get(i).linkVerticesThis(null);
2130
- CameraPane.RANDOM = random;
2434
+ CameraPane.SWITCH = random;
21312435 }
21322436
21332437 refreshContents();
21342438 } else
21352439 if (source == relinkverticesItem)
21362440 {
2137
- boolean random = CameraPane.RANDOM;
2138
- CameraPane.RANDOM = false; // parse all random nodes
2441
+ boolean random = CameraPane.SWITCH;
2442
+ CameraPane.SWITCH = false; // parse all random nodes
21392443 group.selection.RelinkToSupport();
2140
- CameraPane.RANDOM = random;
2444
+ CameraPane.SWITCH = random;
21412445
21422446 refreshContents();
21432447 } else
....@@ -2152,9 +2456,9 @@
21522456 } else
21532457 if (source == setMasterItem)
21542458 {
2155
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2459
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21562460 {
2157
- Object3D content = GrafreeD.clipboard.get(0);
2461
+ Object3D content = Grafreed.clipboard.get(0);
21582462
21592463 if (content instanceof cGroup && ((cGroup)content).transientlink )
21602464 content = ((cGroup)content).get(0);
....@@ -2167,9 +2471,9 @@
21672471 {
21682472 if (group.selection.size() == 1)
21692473 {
2170
- if (GrafreeD.clipboard.size() == 1)
2474
+ if (Grafreed.clipboard.size() == 1)
21712475 {
2172
- Object3D content = GrafreeD.clipboard.get(0);
2476
+ Object3D content = Grafreed.clipboard.get(0);
21732477
21742478 if (content instanceof cGroup && ((cGroup)content).transientlink )
21752479 content = ((cGroup)content).get(0);
....@@ -2186,7 +2490,7 @@
21862490 {
21872491 RevertMeshes();
21882492 } else
2189
- if (source == resetMeshItem)
2493
+ if (source == resetAllItem)
21902494 {
21912495 ResetAll();
21922496 } else
....@@ -2352,7 +2656,7 @@
23522656 {
23532657 CastShadow(2);
23542658 } else
2355
- if (source == ungroupItem)
2659
+ if (source == ungroupItem || source == ungroupButton)
23562660 {
23572661 //ungroup();
23582662 for (int i=0; i<group.selection.size(); i++)
....@@ -2374,7 +2678,7 @@
23742678 } else
23752679 if (source == genNormalsMESHItem)
23762680 {
2377
- GenNormals(true); // TODO
2681
+ GenNormalsMESH();
23782682 } else
23792683 if (source == genNormalsORGANItem)
23802684 {
....@@ -2439,6 +2743,22 @@
24392743 if (source == unmarkleavesItem)
24402744 {
24412745 MarkLeaves(false);
2746
+ } else
2747
+ if (source == rewindleavesItem)
2748
+ {
2749
+ RewindLeaves(true);
2750
+ } else
2751
+ if (source == unrewindleavesItem)
2752
+ {
2753
+ RewindLeaves(false);
2754
+ } else
2755
+ if (source == randomleavesItem)
2756
+ {
2757
+ RandomLeaves(true);
2758
+ } else
2759
+ if (source == unrandomleavesItem)
2760
+ {
2761
+ RandomLeaves(false);
24422762 } else
24432763 if (source == flipVItem)
24442764 {
....@@ -2524,9 +2844,13 @@
25242844 {
25252845 SmoothMesh();
25262846 } else
2527
- if (source == transformgeometryItem)
2847
+ if (source == transformGeometryItem)
25282848 {
25292849 TransformGeometry();
2850
+ } else
2851
+ if (source == transformChildrenItem)
2852
+ {
2853
+ TransformChildren();
25302854 } else
25312855 if (source == resetTransformItem)
25322856 {
....@@ -2534,7 +2858,11 @@
25342858 } else
25352859 if (source == resetCentroidItem)
25362860 {
2537
- ResetCentroid();
2861
+ ResetCentroid(true);
2862
+ } else
2863
+ if (source == resetCentroidXZItem)
2864
+ {
2865
+ ResetCentroid(false);
25382866 } else
25392867 if (source == resetParentItem)
25402868 {
....@@ -2666,6 +2994,10 @@
26662994 if (source == twoButton)
26672995 {
26682996 radio.layout = twoButton;
2997
+
2998
+ if (CameraPane.FULLSCREEN)
2999
+ fullscreenLayout = radio.layout;
3000
+
26693001 // bug
26703002 //gridPanel.setDividerLocation(1.0);
26713003 //bigPanel.setDividerLocation(0.0);
....@@ -2698,10 +3030,31 @@
26983030 bigThree.ClearUI();
26993031 bigThree.add(centralPanel);
27003032 bigThree.FlushUI();
3033
+
3034
+ cameraView.requestFocusInWindow();
3035
+
3036
+// refreshContents(true);
3037
+//
3038
+// try
3039
+// {
3040
+// java.awt.Robot bot = new java.awt.Robot();
3041
+// int mask = InputEvent.BUTTON1_MASK;
3042
+// bot.mouseMove(100, 100);
3043
+// bot.mousePress(mask);
3044
+// bot.mouseRelease(mask);
3045
+// }
3046
+// catch (Exception e)
3047
+// {
3048
+//
3049
+// }
3050
+
27013051 } else
27023052 if (source == threeButton)
27033053 {
27043054 radio.layout = threeButton;
3055
+
3056
+ if (CameraPane.FULLSCREEN)
3057
+ fullscreenLayout = radio.layout;
27053058
27063059 // bigThree.remove(scenePanel);
27073060 // bigThree.remove(centralPanel);
....@@ -2734,10 +3087,15 @@
27343087 bigThree.add(centralPanel);
27353088 bigThree.add(XYZPanel);
27363089 bigThree.FlushUI();
3090
+
3091
+ cameraView.requestFocusInWindow();
27373092 } else
27383093 if (source == fourButton)
27393094 {
27403095 radio.layout = fourButton;
3096
+
3097
+ if (CameraPane.FULLSCREEN)
3098
+ fullscreenLayout = radio.layout;
27413099
27423100 // bigThree.remove(scenePanel);
27433101 // bigThree.remove(centralPanel);
....@@ -2769,10 +3127,15 @@
27693127 bigThree.ClearUI();
27703128 bigThree.add(scenePanel);
27713129 bigThree.FlushUI();
3130
+
3131
+ cameraView.requestFocusInWindow();
27723132 } else
27733133 if (source == sixButton)
27743134 {
27753135 radio.layout = sixButton;
3136
+
3137
+ if (CameraPane.FULLSCREEN)
3138
+ fullscreenLayout = radio.layout;
27763139
27773140 // bigThree.remove(scenePanel);
27783141 // bigThree.remove(centralPanel);
....@@ -2805,10 +3168,15 @@
28053168 bigThree.add(scenePanel);
28063169 bigThree.add(centralPanel);
28073170 bigThree.FlushUI();
3171
+
3172
+ cameraView.requestFocusInWindow();
28083173 } else
28093174 if (source == sevenButton)
28103175 {
28113176 radio.layout = sevenButton;
3177
+
3178
+ if (CameraPane.FULLSCREEN)
3179
+ fullscreenLayout = radio.layout;
28123180
28133181 // bigThree.remove(scenePanel);
28143182 // bigThree.remove(centralPanel);
....@@ -2842,6 +3210,8 @@
28423210 bigThree.add(centralPanel);
28433211 bigThree.add(XYZPanel);
28443212 bigThree.FlushUI();
3213
+
3214
+ cameraView.requestFocusInWindow();
28453215 } else
28463216 if (source == rootButton)
28473217 {
....@@ -2853,6 +3223,7 @@
28533223 EditObject(obj);
28543224 }
28553225
3226
+ cameraView.requestFocusInWindow();
28563227 refreshContents(true);
28573228 } else
28583229 if (source == closeButton)
....@@ -2862,18 +3233,27 @@
28623233 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28633234 {
28643235 ab = (cRadio)e.nextElement();
2865
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3236
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28663237 {
3238
+ // Patch to avoid bug with transparency.
3239
+ if (!ab.hadMaterial)
3240
+ {
3241
+ ab.object.material = null;
3242
+ }
3243
+
28673244 buttonGroup.remove(ab);
28683245 radioPanel.remove(ab);
28693246
2870
- ab.GetObject().editWindow = null;
3247
+ //ab.GetObject().editWindow = null;
3248
+ ab.GetObject().manipWindow = null;
28713249 // ab.GetObject().objectUI = null; // ?????????
28723250
28733251 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28743252 break;
28753253 }
28763254 }
3255
+
3256
+ cameraView.requestFocusInWindow();
28773257 refreshContents(true);
28783258 } else
28793259 if (source == editItem || source == editButton)
....@@ -2890,9 +3270,9 @@
28903270 child.CloseUI();
28913271 listUI.remove(child);
28923272
2893
- child.editWindow = null; // ???????????
3273
+ //child.editWindow = null; // ???????????
28943274 }
2895
- objEditor.ctrlPanel.validate();
3275
+ objEditor.ctrlPanel.FlushUI();
28963276 //objEditor.jTree.clearSelection();
28973277 //objEditor.ResetSliders();
28983278 refreshContents(true);
....@@ -2976,7 +3356,11 @@
29763356 frontView.object = group;
29773357 sideView.object = group;
29783358 }
2979
- group.editWindow = this;
3359
+
3360
+// fix "+" issue
3361
+ //group.editWindow = this;
3362
+ group.manipWindow = this;
3363
+
29803364 /*
29813365 currentLayout = radio.layout;
29823366 if (currentLayout == null)
....@@ -2988,8 +3372,23 @@
29883372 //group.parent = null; // ROOT
29893373 //group.attributes = -1;
29903374 ResetModel();
3375
+
3376
+ cameraView.requestFocusInWindow();
29913377 refreshContents(true);
2992
- }
3378
+ } else if (event.getSource() == editCameraItem)
3379
+ {
3380
+ cameraView.ProtectCamera();
3381
+ cameraView.repaint();
3382
+ return;
3383
+ } else if (event.getSource() == revertCameraItem)
3384
+ {
3385
+ cameraView.RevertCamera();
3386
+ cameraView.repaint();
3387
+ return;
3388
+ // } else if (event.getSource() == textureButton)
3389
+ // {
3390
+ // return; // true;
3391
+ }
29933392 else
29943393 {
29953394 //return super.action(event, arg);
....@@ -2998,7 +3397,6 @@
29983397 }
29993398
30003399 boolean useclient = false;
3001
- cRadio radio;
30023400
30033401 void ToggleRoot()
30043402 {
....@@ -3050,6 +3448,28 @@
30503448 refreshContents();
30513449 }
30523450
3451
+ void TransformChildren()
3452
+ {
3453
+ Object3D obj;
3454
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3455
+ {
3456
+ obj = (Object3D)e.nextElement();
3457
+ obj.KeepTextureMatrices();
3458
+ obj.TransformChildren();
3459
+ obj.RestoreTextureMatrices();
3460
+
3461
+// if (obj.parent == null)
3462
+// {
3463
+// System.out.println("NULL PARENT!");
3464
+// new Exception().printStackTrace();
3465
+// }
3466
+// else
3467
+// TouchTransform(obj);
3468
+// //obj.parent.Touch();
3469
+ }
3470
+
3471
+ refreshContents();
3472
+ }
30533473
30543474 void ResetTransform()
30553475 {
....@@ -3162,7 +3582,7 @@
31623582 refreshContents();
31633583 }
31643584
3165
- void ResetCentroid()
3585
+ void ResetCentroid(boolean full)
31663586 {
31673587 Object3D obj;
31683588 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3177,12 +3597,16 @@
31773597 LA.matIdentity(Object3D.mat);
31783598 obj.getBounds(minima, maxima, false);
31793599 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3180
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3600
+ if (full)
3601
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31813602 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31823603 obj.TransformMesh(Object3D.mat);
3604
+
31833605 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3184
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3606
+ if (full)
3607
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31853608 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3609
+
31863610 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31873611 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31883612 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3211,7 +3635,8 @@
32113635
32123636 int size = obj.MemorySize();
32133637
3214
- System.err.println((size/1024) + " KB is the size of " + obj);
3638
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3639
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32153640 }
32163641 }
32173642 catch (Exception e)
....@@ -3248,9 +3673,9 @@
32483673 obj = (Object3D)e.nextElement();
32493674
32503675 System.out.println("Object is: " + obj);
3251
- GrafreeD.AnalyzeObject(obj);
3676
+ Grafreed.AnalyzeObject(obj);
32523677 System.out.println("Boundary rep: " + obj.bRep);
3253
- GrafreeD.AnalyzeObject(obj.bRep);
3678
+ Grafreed.AnalyzeObject(obj.bRep);
32543679
32553680 // System.err.println((size/1024) + " KB is the size of " + obj);
32563681 }
....@@ -3292,6 +3717,13 @@
32923717 void GenNormals(boolean crease)
32933718 {
32943719 group.GenNormalsS(crease);
3720
+
3721
+ refreshContents();
3722
+ }
3723
+
3724
+ void GenNormalsMESH()
3725
+ {
3726
+ group.GenNormalsMeshS();
32953727
32963728 refreshContents();
32973729 }
....@@ -3464,8 +3896,8 @@
34643896
34653897 void ParseVertices()
34663898 {
3467
- boolean epsequal = GrafreeD.epsequal;
3468
- GrafreeD.epsequal = true;
3899
+ boolean epsequal = Grafreed.epsequal;
3900
+ Grafreed.epsequal = true;
34693901
34703902 for (int i=0; i<group.selection.size(); i++)
34713903 {
....@@ -3490,7 +3922,7 @@
34903922 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34913923 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34923924
3493
- g.add(GrafreeD.clipboard);
3925
+ g.add(Grafreed.clipboard);
34943926
34953927 buffer.add(g);
34963928 }
....@@ -3505,7 +3937,7 @@
35053937 makeSomething(buffer, i==group.selection.size()-1);
35063938 }
35073939
3508
- GrafreeD.epsequal = epsequal;
3940
+ Grafreed.epsequal = epsequal;
35093941
35103942 refreshContents();
35113943 }
....@@ -3523,7 +3955,16 @@
35233955 String pigment = Object3D.GetPigment(tex);
35243956 //String bump = Object3D.GetBump(tex);
35253957
3526
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3958
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3959
+
3960
+ try
3961
+ {
3962
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3963
+ }
3964
+ catch (Exception e)
3965
+ {
3966
+ System.err.println("FAIL: " + node);
3967
+ }
35273968
35283969 double s = v.s;
35293970
....@@ -3611,11 +4052,11 @@
36114052
36124053 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36134054
3614
- boolean random = CameraPane.RANDOM;
3615
- CameraPane.RANDOM = false; // parse all random nodes
4055
+ boolean random = CameraPane.SWITCH;
4056
+ CameraPane.SWITCH = false; // parse all random nodes
36164057 lowres.linkVerticesThis(null);
36174058 lowres.linkVerticesThis(sn);
3618
- CameraPane.RANDOM = random;
4059
+ CameraPane.SWITCH = random;
36194060
36204061 System.err.flush();
36214062
....@@ -3655,7 +4096,7 @@
36554096 return;
36564097
36574098 Object3D poses = group.selection.get(0);
3658
- Object3D ref = GrafreeD.clipboard.get(0);
4099
+ Object3D ref = Grafreed.clipboard.get(0);
36594100
36604101 Object3D newgroup = new Object3D("Po:" + poses.name);
36614102
....@@ -3849,9 +4290,9 @@
38494290
38504291 void ClipMesh()
38514292 {
3852
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4293
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38534294 {
3854
- Object3D content = GrafreeD.clipboard.get(0);
4295
+ Object3D content = Grafreed.clipboard.get(0);
38554296
38564297 if (content instanceof cGroup && ((cGroup)content).transientlink )
38574298 content = ((cGroup)content).get(0);
....@@ -3860,7 +4301,7 @@
38604301 // {
38614302 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38624303 // }
3863
- group.selection.ClipMesh(GrafreeD.clipboard);
4304
+ group.selection.ClipMesh(Grafreed.clipboard);
38644305 }
38654306 // group.selection.ClipMesh(GrafreeD.clipboard);
38664307 System.out.println("DONE.");
....@@ -3907,6 +4348,18 @@
39074348 void MarkLeaves(boolean hide)
39084349 {
39094350 group.selection.MarkLeaves(hide);
4351
+ refreshContents();
4352
+ }
4353
+
4354
+ void RewindLeaves(boolean hide)
4355
+ {
4356
+ group.selection.RewindLeaves(hide);
4357
+ refreshContents();
4358
+ }
4359
+
4360
+ void RandomLeaves(boolean hide)
4361
+ {
4362
+ group.selection.RandomLeaves(hide);
39104363 refreshContents();
39114364 }
39124365
....@@ -3992,10 +4445,10 @@
39924445 {
39934446 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39944447 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3995
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4448
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39964449
39974450 Object3D elem = (Object3D)group.selection.elementAt(i);
3998
- if(elem != group)
4451
+ if(elem != group || !newWindow)
39994452 {
40004453 // if (!(elem instanceof Composite))
40014454 // newWindow = false;
....@@ -4085,7 +4538,6 @@
40854538 //case 702: // Event.LIST_DESELECT
40864539 group.deselectAll();
40874540 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4088
- objEditor.ClearInfo(); // .GetMaterial());
40894541 if (tps != null)
40904542 {
40914543 for (int i=0; i < tps.length; i++)
....@@ -4094,10 +4546,8 @@
40944546
40954547 //if (child.parent != null)
40964548 //child.parent.addSelectee(child);
4549
+ objEditor.SetMaterial(child);
40974550 group.addSelectee(child);
4098
- objEditor.SetMaterial(child); // .GetMaterial());
4099
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4100
- System.err.println("info : " + child.GetPath());
41014551 }
41024552 }
41034553 // else
....@@ -4107,16 +4557,17 @@
41074557 // System.err.println("info : " + group.GetPath());
41084558 // }
41094559
4110
- objEditor.SetText(); // jan 2014
4111
-
4112
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4560
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41134561 CameraPane.flash = true;
41144562
4115
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4563
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41164564 // a camera
41174565 {
4118
- CameraPane.camerachangeframe = 0; // don't refuse it
4119
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4566
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4567
+ {
4568
+ CameraPane.camerachangeframe = 0; // don't refuse it
4569
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4570
+ }
41204571 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41214572 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41224573 }
....@@ -4129,6 +4580,26 @@
41294580
41304581 freezemodel = false;
41314582 }
4583
+
4584
+ void refreshContents(boolean cp)
4585
+ {
4586
+ if (!Globals.MOUSEDRAGGED)
4587
+ {
4588
+ objEditor.ClearInfo(); // .GetMaterial());
4589
+
4590
+ for (int i=0; i < group.selection.Size(); i++)
4591
+ {
4592
+ Object3D child = (Object3D) group.selection.get(i);
4593
+
4594
+ objEditor.AddInfo(child, this, true);
4595
+ System.err.println("info : " + child.GetPath());
4596
+ }
4597
+
4598
+ objEditor.SetText(); // jan 2014
4599
+ }
4600
+
4601
+ super.refreshContents(cp);
4602
+ }
41324603
41334604 void linkSomething(Object3D thing)
41344605 {
....@@ -4200,16 +4671,19 @@
42004671 {
42014672 if (group.selection.isEmpty())
42024673 return;
4203
- GrafreeD.clipboardIsTempGroup = false;
4674
+
4675
+ Grafreed.clipboardIsTempGroup = false;
42044676 Composite tGroup = null;
42054677 if (group.selection.size() > 0) // 1)
42064678 {
42074679 tGroup = new cGroup();
4208
- GrafreeD.clipboardIsTempGroup = true;
4680
+ Grafreed.clipboardIsTempGroup = true;
42094681 }
42104682
42114683 if (cut)
42124684 {
4685
+ if (Globals.SAVEONMAKE)
4686
+ Save();
42134687 //int indices[] = jList.getSelectedIndices();
42144688 //for (int i = indices.length - 1; i >= 0; i--)
42154689 //jList.remove(indices[i]);
....@@ -4245,16 +4719,16 @@
42454719 //System.out.println("cut " + child);
42464720 //System.out.println("parent = " + child.parent);
42474721 // tmp.addChild(child);
4248
- if (GrafreeD.clipboardIsTempGroup)
4722
+ if (Grafreed.clipboardIsTempGroup)
42494723 tGroup.add/*Child*/(tmp);
42504724 else
4251
- GrafreeD.clipboard = tmp;
4725
+ Grafreed.clipboard = tmp;
42524726 }
42534727 else
4254
- if (GrafreeD.clipboardIsTempGroup)
4728
+ if (Grafreed.clipboardIsTempGroup)
42554729 tGroup.add/*Child*/(child);
42564730 else
4257
- GrafreeD.clipboard = child;
4731
+ Grafreed.clipboard = child;
42584732 }
42594733
42604734 //ResetModel();
....@@ -4286,21 +4760,23 @@
42864760 //System.out.println("cut " + elem);
42874761 //System.out.println("parent = " + elem.parent);
42884762 // tmp.addChild(elem);
4289
- if (GrafreeD.clipboardIsTempGroup)
4763
+ if (Grafreed.clipboardIsTempGroup)
42904764 tGroup.add/*Child*/(tmp);
42914765 else
4292
- GrafreeD.clipboard = tmp;
4766
+ Grafreed.clipboard = tmp;
42934767 }
42944768 else
4295
- if (GrafreeD.clipboardIsTempGroup)
4769
+ if (Grafreed.clipboardIsTempGroup)
42964770 tGroup.add/*Child*/(child);
42974771 else
4298
- GrafreeD.clipboard = child;
4772
+ Grafreed.clipboard = child;
42994773 }
43004774
43014775 }
4302
- if (GrafreeD.clipboardIsTempGroup)
4303
- GrafreeD.clipboard = tGroup;
4776
+
4777
+ if (Grafreed.clipboardIsTempGroup)
4778
+ Grafreed.clipboard = tGroup;
4779
+
43044780 if (cut)
43054781 {
43064782 ResetModel();
....@@ -4314,7 +4790,7 @@
43144790 // return;
43154791 boolean first = true;
43164792
4317
- if (GrafreeD.clipboardIsTempGroup)
4793
+ if (Grafreed.clipboardIsTempGroup)
43184794 {
43194795 Composite temp;
43204796
....@@ -4325,7 +4801,7 @@
43254801 temp = (Composite)Applet3D.clipboard.deepCopy();
43264802 */
43274803 Object3D elem;
4328
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4804
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43294805 {
43304806 Object3D child = (Object3D)e.nextElement();
43314807
....@@ -4359,21 +4835,21 @@
43594835 //Object3D cb = Applet3D.clipboard;
43604836 //temp.addChild(cb);
43614837 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4362
- assert(GrafreeD.clipboard.parent == null);
4363
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4364
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4365
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4366
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4838
+ assert(Grafreed.clipboard.parent == null);
4839
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4840
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4841
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4842
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43674843 else
4368
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4369
- GrafreeD.clipboard.get(0).parent = keepparent;
4844
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4845
+ Grafreed.clipboard.get(0).parent = keepparent;
43704846 }
43714847
43724848 ResetModel();
43734849 refreshContents();
43744850 }
43754851
4376
- void pasteInto(boolean copyit)
4852
+ void pasteInto(boolean copyit, boolean clone)
43774853 {
43784854 // if (GrafreeD.clipboard == null)
43794855 // return;
....@@ -4402,15 +4878,22 @@
44024878 if (copyit)
44034879 {
44044880 // paste(false);
4405
- CloneClipboard(false); // sept 2014
4881
+ if (clone)
4882
+ {
4883
+ CloneClipboard(false); // sept 2014
4884
+ }
4885
+ else
4886
+ {
4887
+ paste(false);
4888
+ }
44064889 }
44074890 else
44084891 {
44094892 boolean first = true;
44104893
4411
- if (GrafreeD.clipboardIsTempGroup)
4894
+ if (Grafreed.clipboardIsTempGroup)
44124895 {
4413
- Composite temp = (Composite)GrafreeD.clipboard;
4896
+ Composite temp = (Composite)Grafreed.clipboard;
44144897 Object3D copy;
44154898 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44164899 {
....@@ -4420,7 +4903,7 @@
44204903 }
44214904 } else
44224905 {
4423
- linkSomething(GrafreeD.clipboard); //.get(0));
4906
+ linkSomething(Grafreed.clipboard); //.get(0));
44244907 }
44254908 }
44264909 }
....@@ -4825,21 +5308,6 @@
48255308 }
48265309 */
48275310
4828
- void ImportGFD()
4829
- {
4830
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4831
- browser.show();
4832
- String filename = browser.getFile();
4833
- if (filename != null && filename.length() > 0)
4834
- {
4835
- String fullname = browser.getDirectory() + filename;
4836
-
4837
- //Object3D readobj =
4838
- objEditor.ReadGFD(fullname, objEditor);
4839
- //makeSomething(readobj);
4840
- }
4841
- }
4842
-
48435311 /*
48445312 public void Callback(Object obj)
48455313 {
....@@ -4863,26 +5331,9 @@
48635331 }
48645332 */
48655333
4866
- void ImportVRMLX3D()
4867
- {
4868
- if (GrafreeD.standAlone)
4869
- {
4870
- /**/
4871
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4872
- browser.show();
4873
- String filename = browser.getFile();
4874
- if (filename != null && filename.length() > 0)
4875
- {
4876
- String fullname = browser.getDirectory() + filename;
4877
- LoadVRMLX3D(fullname);
4878
- }
4879
- /**/
4880
- }
4881
- }
4882
-
48835334 String GetFile(String dialogName)
48845335 {
4885
- if (GrafreeD.standAlone)
5336
+ if (Grafreed.standAlone)
48865337 {
48875338 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48885339 browser.show();
....@@ -4946,10 +5397,33 @@
49465397 cButton flashSelectionButton;
49475398 cButton editButton;
49485399 cButton uneditButton;
5400
+ JCheckBox allParamsButton;
49495401 cButton clearpanelButton;
4950
- cButton allParamsButton;
49515402 cButton unselectButton;
49525403
5404
+ cButton minButton;
5405
+ cButton maxButton;
5406
+ cButton fullButton;
5407
+ cButton undoButton;
5408
+ cButton redoButton;
5409
+ cButton saveButton;
5410
+ cButton oneStepButton;
5411
+
5412
+ cButton groupButton;
5413
+ cButton ungroupButton;
5414
+ cButton compositeButton;
5415
+
5416
+ cButton gridButton;
5417
+ cButton boxButton;
5418
+ cButton sphereButton;
5419
+ cButton coneButton;
5420
+ cButton torusButton;
5421
+ cButton superButton;
5422
+ cButton kleinButton;
5423
+ cButton particlesButton;
5424
+ cButton overlayButton;
5425
+ cButton lightButton;
5426
+
49535427 cButton screenfitButton;
49545428 cButton screenfitpointButton;
49555429 cButton snapobjectButton;
....@@ -4960,14 +5434,6 @@
49605434 cButton closeButton;
49615435
49625436 cButton setsupportButton;
4963
-
4964
- cButton twoButton;
4965
- cButton sixButton;
4966
- cButton threeButton;
4967
- cButton sevenButton;
4968
- cButton fourButton; // full panel
4969
- cButton oneButton; // full XYZ
4970
- //cButton currentLayout;
49715437
49725438 //
49735439 //Composite
....@@ -4980,7 +5446,9 @@
49805446 private MenuItem lookFromItem;
49815447 private MenuItem switchItem;
49825448 private MenuItem cutItem;
4983
- private MenuItem duplicateItem;
5449
+ private MenuItem undoItem;
5450
+ private MenuItem redoItem;
5451
+ private JMenuItem duplicateItem;
49845452 private MenuItem cloneItem;
49855453 private MenuItem cloneSupportItem;
49865454 private MenuItem overwriteGeoItem;
....@@ -4993,7 +5461,7 @@
49935461 private MenuItem linkverticesItem;
49945462 private MenuItem relinkverticesItem;
49955463 private MenuItem setMasterItem;
4996
- private MenuItem resetMeshItem;
5464
+ private MenuItem resetAllItem;
49975465 private MenuItem stepAllItem;
49985466 private MenuItem revertMeshItem;
49995467 private MenuItem poseMeshItem;
....@@ -5004,6 +5472,7 @@
50045472 private MenuItem mergeGeometriesItem;
50055473 private MenuItem copyItem;
50065474 private MenuItem pasteItem;
5475
+ private MenuItem pasteIntoItem;
50075476 private MenuItem pasteLinkItem;
50085477 private MenuItem pasteCloneItem;
50095478 private MenuItem pasteExpandItem;
....@@ -5042,6 +5511,10 @@
50425511 private MenuItem showleavesItem;
50435512 private MenuItem markleavesItem;
50445513 private MenuItem unmarkleavesItem;
5514
+ private MenuItem rewindleavesItem;
5515
+ private MenuItem unrewindleavesItem;
5516
+ private MenuItem randomleavesItem;
5517
+ private MenuItem unrandomleavesItem;
50455518
50465519 private MenuItem flipVItem;
50475520 private MenuItem unflipVItem;
....@@ -5053,8 +5526,10 @@
50535526 private MenuItem panoTexturesItem;
50545527
50555528 private MenuItem resetCentroidItem;
5056
- private MenuItem transformgeometryItem;
5529
+ private MenuItem resetCentroidXZItem;
50575530 private MenuItem resetTransformItem;
5531
+ private MenuItem transformGeometryItem;
5532
+ private MenuItem transformChildrenItem;
50585533 private MenuItem hideItem;
50595534 private MenuItem grabItem;
50605535 private MenuItem backItem;
....@@ -5101,7 +5576,7 @@
51015576 private MenuItem blobItem;
51025577 private MenuItem latheItem;
51035578 private MenuItem bezierItem;
5104
- private MenuItem checkerItem;
5579
+ private MenuItem overlayItem;
51055580 private MenuItem meshItem;
51065581 // private MenuItem meshGroupItem;
51075582 private MenuItem springItem;
....@@ -5123,11 +5598,6 @@
51235598 private MenuItem doubleItem;
51245599 private MenuItem tripleItem;
51255600
5126
- private MenuItem importGFDItem;
5127
- private MenuItem importVRMLX3DItem;
5128
- private MenuItem import3DSItem;
5129
- private MenuItem importOBJItem;
5130
-
51315601 private MenuItem computeAOItem;
51325602 private MenuItem recompileItem;
51335603 private MenuItem editScriptItem;
....@@ -5137,4 +5607,8 @@
51375607 private MenuItem analyzeItem;
51385608 private MenuItem dumpItem;
51395609 //boolean freezemodel = false;
5610
+
5611
+ Menu cameraMenu;
5612
+ MenuItem editCameraItem;
5613
+ MenuItem revertCameraItem;
51405614 }