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("-");
242
- randomItem = menu.add(new MenuItem("Random"));
349
+
350
+ randomItem = menu.add(new MenuItem("Switch node"));
243351 randomItem.addActionListener(this);
244
- physicsItem = menu.add(new MenuItem("Physics"));
245
- physicsItem.addActionListener(this);
246
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
247
- frameselectorItem.addActionListener(this);
352
+ if (Globals.ADVANCED)
353
+ {
248354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
249355 switchGeoItem.addActionListener(this);
250356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
251357 switchTransfoItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
358
+ morphItem = menu.add(new MenuItem("Morph Group"));
253359 morphItem.addActionListener(this);
360
+
361
+ menu.add("-");
362
+ physicsItem = menu.add(new MenuItem("Physics"));
363
+ physicsItem.addActionListener(this);
364
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
365
+ frameselectorItem.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,94 +584,168 @@
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
455633 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
456634 // screenfitpointButton.addActionListener(this);
457
-// oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
459
- snapobjectButton.addActionListener(this);
460
- snapobjectButton.setToolTipText("Snap Object");
461
- oe.aConstraints.gridx += 1;
462635
463
- //aConstraints.gridx = 0;
464
- //aConstraints.gridy += 1;
465
- oe.aConstraints.weighty = 0;
466
- oe.aConstraints.gridwidth = 1;
467
-
468
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
469
- flashSelectionButton.setToolTipText("Show selection");
636
+ if (Globals.ADVANCED)
637
+ {
638
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
639
+ snapobjectButton.addActionListener(this);
640
+ snapobjectButton.setToolTipText("Snap Object");
641
+ }
642
+
643
+ oe.toolboxPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ flashSelectionButton.setToolTipText("Highlight selection");
470645 flashSelectionButton.addActionListener(this);
471646
472
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
647
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
473648
474
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
649
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
475650 twoButton.setToolTipText("Show center view only");
476651 twoButton.addActionListener(this);
477
- 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);
478655 fourButton.addActionListener(this);
479656 fourButton.setToolTipText("Show left panel only");
480
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
657
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
481658 sixButton.setToolTipText("2-column layout left");
482659 sixButton.addActionListener(this);
483
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
660
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
484661 threeButton.setToolTipText("2-column layout right");
485662 threeButton.addActionListener(this);
486
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
663
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
487664 sevenButton.setToolTipText("3-column layout");
488665 sevenButton.addActionListener(this);
489666 //
490667
491
- 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);
492669 rootButton.setToolTipText("Edit selection in new tab");
493670 rootButton.addActionListener(this);
494671
495
- 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);
496673 closeButton.setToolTipText("Close tab");
497674 closeButton.addActionListener(this);
498675 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
499676 //clearButton.addActionListener(this);
500
-
501
- 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();
502692
503
- 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);
504726 editButton.setToolTipText("Edit selection");
505727 editButton.addActionListener(this);
506728
507
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
729
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
508730 uneditButton.setToolTipText("Unedit selection");
509731 uneditButton.addActionListener(this);
510732
511
- 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);
512738 clearPanelButton.setToolTipText("Clear edit panel");
513739 clearPanelButton.addActionListener(this);
514740
515
- commandsPanel.add(allParamsButton = new cButton("A", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
516
- allParamsButton.setToolTipText("All params??");
517
- allParamsButton.addActionListener(this);
518
-
519
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
741
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
520742 unselectButton.setToolTipText("Unselect");
521743 unselectButton.addActionListener(this);
522744
523
- commandsPanel.preferredHeight = 1;
745
+ editCommandsPanel.preferredHeight = 1;
524746
525
- oe.treePanel.add(commandsPanel);
526
- oe.treePanel.Return();
747
+// oe.treePanel.add(commandsPanel);
748
+// oe.treePanel.Return();
527749
528750 // oe.aConstraints.gridx += 1;
529751 // oe.aConstraints.weighty = 0;
....@@ -540,7 +762,7 @@
540762
541763 JScrollPane jSP;
542764 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
543
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
765
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
544766 ResetModel();
545767
546768 oe.treePanel.add(jSPPanel);
....@@ -591,8 +813,18 @@
591813
592814 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
593815 {
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
+ {
594826 panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
595
- supportCB.setToolTipText("Enabled rigging");
827
+ supportCB.setToolTipText("Enable rigging");
596828 supportCB.addItemListener(this);
597829
598830 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
....@@ -610,14 +842,6 @@
610842 slowCB.setToolTipText("Smooth interpolation");
611843 slowCB.addItemListener(this);
612844
613
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
614
- boxCB.setToolTipText("Display bounding boxes");
615
- boxCB.addItemListener(this);
616
-
617
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
618
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
619
- zoomBoxCB.addItemListener(this);
620
-
621845 // constraints.gridy += 1;
622846 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
623847 // speakerMocapCB.addItemListener(this);
....@@ -643,11 +867,25 @@
643867 // debugCB.addItemListener(this);
644868
645869 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
870
+ oeilCB.setToolTipText("Move camera when tracking target");
646871 oeilCB.addItemListener(this);
647872
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
+ {
648883 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
649884 lookAtCB.setToolTipText("Look-at target");
650885 lookAtCB.addItemListener(this);
886
+ }
887
+
888
+ }
651889
652890 cGridBag fill = new cGridBag();
653891
....@@ -660,6 +898,14 @@
660898 void EditObject(Object3D obj)
661899 {
662900 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
+
663909 radioButton.SetObject(obj);
664910 radioButton.layout = sevenButton;
665911 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -668,8 +914,11 @@
668914 buttonGroup.add(radioButton);
669915 radioButton.doClick();
670916 }
917
+
671918 void SetupViews(ObjEditor oe)
672919 {
920
+ theFrame = this;
921
+
673922 oe.SetupViews();
674923
675924 System.out.println("SetupViews");
....@@ -678,23 +927,26 @@
678927 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
679928 }
680929
681
- JCheckBox liveCB;
682
- JCheckBox supportCB;
683
- JCheckBox localCB;
684
- JCheckBox crowdCB;
685
- JCheckBox smoothCB;
686
- JCheckBox fastCB;
687
- JCheckBox slowCB;
688
- JCheckBox boxCB;
689
- JCheckBox zoomBoxCB;
690
- JCheckBox trackCB;
691
- 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;
692941 // JCheckBox speakerMocapCB;
693
- JCheckBox speakerCameraCB;
694
- JCheckBox speakerFocusCB;
695
- JCheckBox debugCB;
696
- JCheckBox oeilCB;
697
- JCheckBox lookAtCB;
942
+ cCheckBox speakerCameraCB;
943
+ cCheckBox speakerFocusCB;
944
+ cCheckBox debugCB;
945
+
946
+ cCheckBox oeilCB;
947
+ cCheckBox shadowCB;
948
+ cCheckBox autosaveCB;
949
+ cCheckBox lookAtCB;
698950
699951 // static int COLOR = 1;
700952 // static int MATERIAL = 2;
....@@ -702,9 +954,9 @@
702954
703955 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
704956
705
- JCheckBox colorCB;
706
- JCheckBox materialCB;
707
- JCheckBox textureCB;
957
+ cCheckBox colorCB;
958
+ cCheckBox materialCB;
959
+ cCheckBox textureCB;
708960
709961 public void itemStateChanged(ItemEvent e)
710962 {
....@@ -732,6 +984,7 @@
732984 } else if(e.getSource() == liveCB)
733985 {
734986 cameraView.ToggleLive();
987
+ refreshContents(false);
735988 }
736989 else if(e.getSource() == supportCB)
737990 {
....@@ -796,6 +1049,14 @@
7961049 {
7971050 cameraView.ToggleOeil();
7981051 }
1052
+ else if(e.getSource() == shadowCB)
1053
+ {
1054
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1055
+ }
1056
+ else if(e.getSource() == autosaveCB)
1057
+ {
1058
+ Globals.SAVEONMAKE ^= true;
1059
+ }
7991060 else if(e.getSource() == lookAtCB)
8001061 {
8011062 cameraView.ToggleLookAt();
....@@ -812,7 +1073,8 @@
8121073
8131074 /**/
8141075 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
815
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1076
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1077
+ TreePath path = objEditor.jTree.getSelectionPath();
8161078 if ((path == null) || (path.getPathCount() <= 1)) {
8171079 // We can't move the root node or an empty selection
8181080 return;
....@@ -884,7 +1146,9 @@
8841146 // objEditor.DropFile((java.io.File[]) object, true);
8851147 // return;
8861148 // }
887
- if (string.charAt(0) == '/')
1149
+
1150
+ // File path for Mac and Windows
1151
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8881152 {
8891153 // file(s)
8901154 String[] names = string.split("\n");
....@@ -911,7 +1175,7 @@
9111175
9121176 flashIt = false;
9131177 CameraPane pane = (CameraPane) target;
914
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1178
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9151179 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9161180
9171181 if (group.selection.size() == 1)
....@@ -934,16 +1198,16 @@
9341198 return;
9351199 }
9361200
937
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
938
- {
1201
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1202
+// {
9391203 loadClipboard(true);
9401204 objEditor.jTree.setSelectionPath(destinationPath);
941
- pasteInto(false);
942
- } else {
943
- loadClipboard(false);
944
- objEditor.jTree.setSelectionPath(destinationPath);
945
- pasteInto(false); // true); // ???
946
- }
1205
+ pasteInto(false, false);
1206
+// } else {
1207
+// loadClipboard(false);
1208
+// objEditor.jTree.setSelectionPath(destinationPath);
1209
+// pasteInto(false, false); // true); // ???
1210
+// }
9471211 }
9481212 public void dropActionChanged(DropTargetDragEvent dtde)
9491213 // Called if the user has modified the current drop gesture
....@@ -1064,27 +1328,33 @@
10641328 kleinItem.addActionListener(this);
10651329 particleItem = menu.add(new MenuItem("Particle system"));
10661330 particleItem.addActionListener(this);
1331
+ if (Globals.ADVANCED)
1332
+ {
10671333 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10681334 ragdollItem.addActionListener(this);
10691335 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10701336 ragdoll2Item.addActionListener(this);
1337
+ }
10711338 menu.add("-");
1072
- meshItem = menu.add(new MenuItem("Mesh"));
1339
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10731340 meshItem.addActionListener(this);
10741341 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10751342 // meshGroupItem.addActionListener(this);
1343
+ if (Globals.ADVANCED)
1344
+ {
10761345 springItem = menu.add(new MenuItem("Spring"));
10771346 springItem.addActionListener(this);
10781347 flagItem = menu.add(new MenuItem("Flag"));
10791348 flagItem.addActionListener(this);
1080
- bezierItem = menu.add(new MenuItem("Patch"));
1081
- bezierItem.addActionListener(this);
1082
- checkerItem = menu.add(new MenuItem("Checker"));
1083
- checkerItem.addActionListener(this);
10841349 blobItem = menu.add(new MenuItem("Blob"));
10851350 blobItem.addActionListener(this);
10861351 latheItem = menu.add(new MenuItem("Lathe"));
10871352 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);
10881358 lightItem = menu.add(new MenuItem("Light"));
10891359 lightItem.addActionListener(this);
10901360 menu.add("-");
....@@ -1094,8 +1364,11 @@
10941364 loopItem.addActionListener(this);
10951365 doubleItem = menu.add(new MenuItem("Fork"));
10961366 doubleItem.addActionListener(this);
1367
+ if (Globals.ADVANCED)
1368
+ {
10971369 tripleItem = menu.add(new MenuItem("Trident"));
10981370 tripleItem.addActionListener(this);
1371
+ }
10991372 }
11001373
11011374 void buildToolsMenu(Menu menu)
....@@ -1109,24 +1382,26 @@
11091382 parseverticesItem.addActionListener(this);
11101383 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11111384 textureFieldItem.addActionListener(this);
1112
- alignItem = menu.add(new MenuItem("Align"));
1385
+ alignItem = menu.add(new MenuItem("Align Objects"));
11131386 alignItem.addActionListener(this);
1114
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1115
- mirrorItem.addActionListener(this);
11161387 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11171388 reduceMorphItem.addActionListener(this);
11181389 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11191390 reduce34MorphItem.addActionListener(this);
1120
-
1391
+ menu.add("-");
11211392 menu.add(computeAOItem = new MenuItem("Compute AO"));
11221393 computeAOItem.addActionListener(this);
1123
- menu.add("-");
11241394
1395
+ if (Globals.ADVANCED)
1396
+ {
1397
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1398
+ mirrorItem.addActionListener(this);
1399
+ menu.add("-");
11251400 menu.add(memoryItem = new MenuItem("Memory Usage"));
11261401 memoryItem.addActionListener(this);
11271402 menu.add(analyzeItem = new MenuItem("Analyze"));
11281403 analyzeItem.addActionListener(this);
1129
- menu.add(dumpItem = new MenuItem("Dump"));
1404
+ menu.add(dumpItem = new MenuItem("Print"));
11301405 dumpItem.addActionListener(this);
11311406 // menu.add(pathItem = new MenuItem("From-to path"));
11321407 // pathItem.addActionListener(this);
....@@ -1144,6 +1419,7 @@
11441419 menu.add("-");
11451420 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11461421 editScriptItem.addActionListener(this);
1422
+ }
11471423 }
11481424
11491425 void ScreenFit()
....@@ -1266,6 +1542,7 @@
12661542 shadow.material = new cMaterial(obj.material);
12671543 shadow.material.diffuse = 0.0001f;
12681544 shadow.material.specular = 0.0001f;
1545
+ //shadow.projectedVertices[1].x = 300;
12691546
12701547 makeSomething(shadow);
12711548 }
....@@ -1472,9 +1749,9 @@
14721749
14731750 void Overwrite(int mask)
14741751 {
1475
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1752
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14761753 {
1477
- Object3D content = GrafreeD.clipboard.get(0);
1754
+ Object3D content = Grafreed.clipboard.get(0);
14781755
14791756 if (content instanceof cGroup && ((cGroup)content).transientlink )
14801757 content = ((cGroup)content).get(0);
....@@ -1522,11 +1799,11 @@
15221799 objEditor.cameraView.renderCamera.setAim(v2, v1);
15231800 objEditor.cameraView.repaint();
15241801 } else
1525
- if (source == rectoidItem)
1802
+ if (source == rectoidItem || source == boxButton)
15261803 {
15271804 makeSomething(new Box());
15281805 } else
1529
- if (source == particleItem)
1806
+ if (source == particleItem || source == particlesButton)
15301807 {
15311808 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15321809 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1605,27 +1882,27 @@
16051882
16061883 makeSomething(obj);
16071884 } else
1608
- if (source == gridItem)
1885
+ if (source == gridItem || source == gridButton)
16091886 {
16101887 makeSomething(new Grid());
16111888 } else
1612
- if (source == ellipsoidItem)
1889
+ if (source == ellipsoidItem || source == sphereButton)
16131890 {
16141891 makeSomething(new Sphere());
16151892 } else
1616
- if (source == coneItem)
1893
+ if (source == coneItem || source == coneButton)
16171894 {
16181895 makeSomething(new Cone());
16191896 } else
1620
- if (source == torusItem)
1897
+ if (source == torusItem || source == torusButton)
16211898 {
16221899 makeSomething(new Torus());
16231900 } else
1624
- if (source == superItem)
1901
+ if (source == superItem || source == superButton)
16251902 {
16261903 makeSomething(new Superellipsoid());
16271904 } else
1628
- if (source == kleinItem)
1905
+ if (source == kleinItem || source == kleinButton)
16291906 {
16301907 makeSomething(new Klein());
16311908 } else
....@@ -1645,7 +1922,7 @@
16451922 {
16461923 makeSomething(new BezierSurface());
16471924 } else
1648
- if (source == checkerItem)
1925
+ if (source == overlayItem || source == overlayButton)
16491926 {
16501927 /*
16511928 Object3D obj = new BezierSurface(5,8);
....@@ -1693,7 +1970,7 @@
16931970 s.setup();
16941971 makeSomething(s);
16951972 } else
1696
- if (source == lightItem)
1973
+ if (source == lightItem || source == lightButton)
16971974 {
16981975 makeSomething(new Light());
16991976 } else
....@@ -1779,23 +2056,6 @@
17792056 csg.addChild(child);
17802057 child.addChild(csg);
17812058 } else
1782
-
1783
- if (source == importGFDItem)
1784
- {
1785
- ImportGFD();
1786
- } else
1787
- if (source == importVRMLX3DItem)
1788
- {
1789
- ImportVRMLX3D();
1790
- } else
1791
- if (source == import3DSItem)
1792
- {
1793
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1794
- } else
1795
- if (source == importOBJItem)
1796
- {
1797
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1798
- } else
17992059 if (source == computeAOItem)
18002060 {
18012061 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1814,7 +2074,7 @@
18142074 if (source == invariantsItem)
18152075 {
18162076 System.out.println("Invariants:");
1817
- GrafreeD.grafreeD.universe.invariants();
2077
+ Grafreed.grafreeD.universe.invariants();
18182078 } else
18192079 if (source == memoryItem)
18202080 {
....@@ -1832,6 +2092,35 @@
18322092 if (source == dumpItem)
18332093 {
18342094 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();
18352124 } else
18362125 if (source == screenfitButton)
18372126 {
....@@ -1882,12 +2171,20 @@
18822171 {
18832172 loadClipboard(true);
18842173 } else
2174
+ if (source == undoItem)
2175
+ {
2176
+ Undo();
2177
+ } else
2178
+ if (source == redoItem)
2179
+ {
2180
+ Redo();
2181
+ } else
18852182 if (source == duplicateItem)
18862183 {
1887
- Object3D keep = GrafreeD.clipboard;
2184
+ Object3D keep = Grafreed.clipboard;
18882185 loadClipboard(false);
18892186 paste(false);
1890
- GrafreeD.clipboard = keep;
2187
+ Grafreed.clipboard = keep;
18912188 } else
18922189 if (source == cloneItem)
18932190 {
....@@ -1905,13 +2202,17 @@
19052202 {
19062203 paste(false);
19072204 } else
2205
+ if (source == pasteIntoItem)
2206
+ {
2207
+ pasteInto(true, false);
2208
+ } else
19082209 if (source == pasteLinkItem)
19092210 {
1910
- pasteInto(false);
2211
+ pasteInto(false, false);
19112212 } else
19122213 if (source == pasteCloneItem)
19132214 {
1914
- pasteInto(true);
2215
+ pasteInto(true, true);
19152216 } else
19162217 if (source == pasteExpandItem)
19172218 {
....@@ -2103,9 +2404,9 @@
21032404 // group.selection.get(0).setMasterThis(content); // should be identity
21042405 // refreshContents();
21052406 // }
2106
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2407
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21072408 {
2108
- Object3D content = GrafreeD.clipboard.get(0);
2409
+ Object3D content = Grafreed.clipboard.get(0);
21092410
21102411 if (content instanceof cGroup && ((cGroup)content).transientlink )
21112412 content = ((cGroup)content).get(0);
....@@ -2113,11 +2414,11 @@
21132414 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21142415 for (int i=0; i<group.selection.size(); i++)
21152416 {
2116
- boolean random = CameraPane.RANDOM;
2117
- CameraPane.RANDOM = false; // parse all random nodes
2417
+ boolean random = CameraPane.SWITCH;
2418
+ CameraPane.SWITCH = false; // parse all random nodes
21182419 group.selection.get(i).linkVerticesThis(content);
21192420 // group.selection.get(i).setMasterThis(content); // should be identity
2120
- CameraPane.RANDOM = random;
2421
+ CameraPane.SWITCH = random;
21212422 }
21222423 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21232424 refreshContents();
....@@ -2127,20 +2428,20 @@
21272428 {
21282429 for (int i=0; i<group.selection.size(); i++)
21292430 {
2130
- boolean random = CameraPane.RANDOM;
2131
- CameraPane.RANDOM = false; // parse all random nodes
2431
+ boolean random = CameraPane.SWITCH;
2432
+ CameraPane.SWITCH = false; // parse all random nodes
21322433 group.selection.get(i).linkVerticesThis(null);
2133
- CameraPane.RANDOM = random;
2434
+ CameraPane.SWITCH = random;
21342435 }
21352436
21362437 refreshContents();
21372438 } else
21382439 if (source == relinkverticesItem)
21392440 {
2140
- boolean random = CameraPane.RANDOM;
2141
- CameraPane.RANDOM = false; // parse all random nodes
2441
+ boolean random = CameraPane.SWITCH;
2442
+ CameraPane.SWITCH = false; // parse all random nodes
21422443 group.selection.RelinkToSupport();
2143
- CameraPane.RANDOM = random;
2444
+ CameraPane.SWITCH = random;
21442445
21452446 refreshContents();
21462447 } else
....@@ -2155,9 +2456,9 @@
21552456 } else
21562457 if (source == setMasterItem)
21572458 {
2158
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2459
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21592460 {
2160
- Object3D content = GrafreeD.clipboard.get(0);
2461
+ Object3D content = Grafreed.clipboard.get(0);
21612462
21622463 if (content instanceof cGroup && ((cGroup)content).transientlink )
21632464 content = ((cGroup)content).get(0);
....@@ -2170,9 +2471,9 @@
21702471 {
21712472 if (group.selection.size() == 1)
21722473 {
2173
- if (GrafreeD.clipboard.size() == 1)
2474
+ if (Grafreed.clipboard.size() == 1)
21742475 {
2175
- Object3D content = GrafreeD.clipboard.get(0);
2476
+ Object3D content = Grafreed.clipboard.get(0);
21762477
21772478 if (content instanceof cGroup && ((cGroup)content).transientlink )
21782479 content = ((cGroup)content).get(0);
....@@ -2189,7 +2490,7 @@
21892490 {
21902491 RevertMeshes();
21912492 } else
2192
- if (source == resetMeshItem)
2493
+ if (source == resetAllItem)
21932494 {
21942495 ResetAll();
21952496 } else
....@@ -2238,7 +2539,7 @@
22382539 RandomNode random = new RandomNode();
22392540 group(random);
22402541 if (random.size() > 0)
2241
- random.name = random.get(0).name + "Rnd";
2542
+ random.name = random.get(0).name + "Switch";
22422543 } else
22432544 if (source == physicsItem)
22442545 {
....@@ -2355,7 +2656,7 @@
23552656 {
23562657 CastShadow(2);
23572658 } else
2358
- if (source == ungroupItem)
2659
+ if (source == ungroupItem || source == ungroupButton)
23592660 {
23602661 //ungroup();
23612662 for (int i=0; i<group.selection.size(); i++)
....@@ -2377,7 +2678,7 @@
23772678 } else
23782679 if (source == genNormalsMESHItem)
23792680 {
2380
- GenNormals(true); // TODO
2681
+ GenNormalsMESH();
23812682 } else
23822683 if (source == genNormalsORGANItem)
23832684 {
....@@ -2442,6 +2743,22 @@
24422743 if (source == unmarkleavesItem)
24432744 {
24442745 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);
24452762 } else
24462763 if (source == flipVItem)
24472764 {
....@@ -2527,9 +2844,13 @@
25272844 {
25282845 SmoothMesh();
25292846 } else
2530
- if (source == transformgeometryItem)
2847
+ if (source == transformGeometryItem)
25312848 {
25322849 TransformGeometry();
2850
+ } else
2851
+ if (source == transformChildrenItem)
2852
+ {
2853
+ TransformChildren();
25332854 } else
25342855 if (source == resetTransformItem)
25352856 {
....@@ -2537,7 +2858,11 @@
25372858 } else
25382859 if (source == resetCentroidItem)
25392860 {
2540
- ResetCentroid();
2861
+ ResetCentroid(true);
2862
+ } else
2863
+ if (source == resetCentroidXZItem)
2864
+ {
2865
+ ResetCentroid(false);
25412866 } else
25422867 if (source == resetParentItem)
25432868 {
....@@ -2669,6 +2994,10 @@
26692994 if (source == twoButton)
26702995 {
26712996 radio.layout = twoButton;
2997
+
2998
+ if (CameraPane.FULLSCREEN)
2999
+ fullscreenLayout = radio.layout;
3000
+
26723001 // bug
26733002 //gridPanel.setDividerLocation(1.0);
26743003 //bigPanel.setDividerLocation(0.0);
....@@ -2701,10 +3030,31 @@
27013030 bigThree.ClearUI();
27023031 bigThree.add(centralPanel);
27033032 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
+
27043051 } else
27053052 if (source == threeButton)
27063053 {
27073054 radio.layout = threeButton;
3055
+
3056
+ if (CameraPane.FULLSCREEN)
3057
+ fullscreenLayout = radio.layout;
27083058
27093059 // bigThree.remove(scenePanel);
27103060 // bigThree.remove(centralPanel);
....@@ -2737,10 +3087,15 @@
27373087 bigThree.add(centralPanel);
27383088 bigThree.add(XYZPanel);
27393089 bigThree.FlushUI();
3090
+
3091
+ cameraView.requestFocusInWindow();
27403092 } else
27413093 if (source == fourButton)
27423094 {
27433095 radio.layout = fourButton;
3096
+
3097
+ if (CameraPane.FULLSCREEN)
3098
+ fullscreenLayout = radio.layout;
27443099
27453100 // bigThree.remove(scenePanel);
27463101 // bigThree.remove(centralPanel);
....@@ -2772,10 +3127,15 @@
27723127 bigThree.ClearUI();
27733128 bigThree.add(scenePanel);
27743129 bigThree.FlushUI();
3130
+
3131
+ cameraView.requestFocusInWindow();
27753132 } else
27763133 if (source == sixButton)
27773134 {
27783135 radio.layout = sixButton;
3136
+
3137
+ if (CameraPane.FULLSCREEN)
3138
+ fullscreenLayout = radio.layout;
27793139
27803140 // bigThree.remove(scenePanel);
27813141 // bigThree.remove(centralPanel);
....@@ -2808,10 +3168,15 @@
28083168 bigThree.add(scenePanel);
28093169 bigThree.add(centralPanel);
28103170 bigThree.FlushUI();
3171
+
3172
+ cameraView.requestFocusInWindow();
28113173 } else
28123174 if (source == sevenButton)
28133175 {
28143176 radio.layout = sevenButton;
3177
+
3178
+ if (CameraPane.FULLSCREEN)
3179
+ fullscreenLayout = radio.layout;
28153180
28163181 // bigThree.remove(scenePanel);
28173182 // bigThree.remove(centralPanel);
....@@ -2845,6 +3210,8 @@
28453210 bigThree.add(centralPanel);
28463211 bigThree.add(XYZPanel);
28473212 bigThree.FlushUI();
3213
+
3214
+ cameraView.requestFocusInWindow();
28483215 } else
28493216 if (source == rootButton)
28503217 {
....@@ -2856,6 +3223,7 @@
28563223 EditObject(obj);
28573224 }
28583225
3226
+ cameraView.requestFocusInWindow();
28593227 refreshContents(true);
28603228 } else
28613229 if (source == closeButton)
....@@ -2865,18 +3233,27 @@
28653233 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28663234 {
28673235 ab = (cRadio)e.nextElement();
2868
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3236
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28693237 {
3238
+ // Patch to avoid bug with transparency.
3239
+ if (!ab.hadMaterial)
3240
+ {
3241
+ ab.object.material = null;
3242
+ }
3243
+
28703244 buttonGroup.remove(ab);
28713245 radioPanel.remove(ab);
28723246
2873
- ab.GetObject().editWindow = null;
3247
+ //ab.GetObject().editWindow = null;
3248
+ ab.GetObject().manipWindow = null;
28743249 // ab.GetObject().objectUI = null; // ?????????
28753250
28763251 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28773252 break;
28783253 }
28793254 }
3255
+
3256
+ cameraView.requestFocusInWindow();
28803257 refreshContents(true);
28813258 } else
28823259 if (source == editItem || source == editButton)
....@@ -2893,9 +3270,9 @@
28933270 child.CloseUI();
28943271 listUI.remove(child);
28953272
2896
- child.editWindow = null; // ???????????
3273
+ //child.editWindow = null; // ???????????
28973274 }
2898
- objEditor.ctrlPanel.validate();
3275
+ objEditor.ctrlPanel.FlushUI();
28993276 //objEditor.jTree.clearSelection();
29003277 //objEditor.ResetSliders();
29013278 refreshContents(true);
....@@ -2979,7 +3356,11 @@
29793356 frontView.object = group;
29803357 sideView.object = group;
29813358 }
2982
- group.editWindow = this;
3359
+
3360
+// fix "+" issue
3361
+ //group.editWindow = this;
3362
+ group.manipWindow = this;
3363
+
29833364 /*
29843365 currentLayout = radio.layout;
29853366 if (currentLayout == null)
....@@ -2991,8 +3372,23 @@
29913372 //group.parent = null; // ROOT
29923373 //group.attributes = -1;
29933374 ResetModel();
3375
+
3376
+ cameraView.requestFocusInWindow();
29943377 refreshContents(true);
2995
- }
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
+ }
29963392 else
29973393 {
29983394 //return super.action(event, arg);
....@@ -3001,7 +3397,6 @@
30013397 }
30023398
30033399 boolean useclient = false;
3004
- cRadio radio;
30053400
30063401 void ToggleRoot()
30073402 {
....@@ -3053,6 +3448,28 @@
30533448 refreshContents();
30543449 }
30553450
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
+ }
30563473
30573474 void ResetTransform()
30583475 {
....@@ -3165,7 +3582,7 @@
31653582 refreshContents();
31663583 }
31673584
3168
- void ResetCentroid()
3585
+ void ResetCentroid(boolean full)
31693586 {
31703587 Object3D obj;
31713588 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3180,12 +3597,16 @@
31803597 LA.matIdentity(Object3D.mat);
31813598 obj.getBounds(minima, maxima, false);
31823599 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3183
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3600
+ if (full)
3601
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31843602 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31853603 obj.TransformMesh(Object3D.mat);
3604
+
31863605 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3187
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3606
+ if (full)
3607
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31883608 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3609
+
31893610 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31903611 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31913612 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3214,7 +3635,8 @@
32143635
32153636 int size = obj.MemorySize();
32163637
3217
- 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)");
32183640 }
32193641 }
32203642 catch (Exception e)
....@@ -3251,9 +3673,9 @@
32513673 obj = (Object3D)e.nextElement();
32523674
32533675 System.out.println("Object is: " + obj);
3254
- GrafreeD.AnalyzeObject(obj);
3676
+ Grafreed.AnalyzeObject(obj);
32553677 System.out.println("Boundary rep: " + obj.bRep);
3256
- GrafreeD.AnalyzeObject(obj.bRep);
3678
+ Grafreed.AnalyzeObject(obj.bRep);
32573679
32583680 // System.err.println((size/1024) + " KB is the size of " + obj);
32593681 }
....@@ -3295,6 +3717,13 @@
32953717 void GenNormals(boolean crease)
32963718 {
32973719 group.GenNormalsS(crease);
3720
+
3721
+ refreshContents();
3722
+ }
3723
+
3724
+ void GenNormalsMESH()
3725
+ {
3726
+ group.GenNormalsMeshS();
32983727
32993728 refreshContents();
33003729 }
....@@ -3467,8 +3896,8 @@
34673896
34683897 void ParseVertices()
34693898 {
3470
- boolean epsequal = GrafreeD.epsequal;
3471
- GrafreeD.epsequal = true;
3899
+ boolean epsequal = Grafreed.epsequal;
3900
+ Grafreed.epsequal = true;
34723901
34733902 for (int i=0; i<group.selection.size(); i++)
34743903 {
....@@ -3493,7 +3922,7 @@
34933922 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34943923 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34953924
3496
- g.add(GrafreeD.clipboard);
3925
+ g.add(Grafreed.clipboard);
34973926
34983927 buffer.add(g);
34993928 }
....@@ -3508,7 +3937,7 @@
35083937 makeSomething(buffer, i==group.selection.size()-1);
35093938 }
35103939
3511
- GrafreeD.epsequal = epsequal;
3940
+ Grafreed.epsequal = epsequal;
35123941
35133942 refreshContents();
35143943 }
....@@ -3526,7 +3955,16 @@
35263955 String pigment = Object3D.GetPigment(tex);
35273956 //String bump = Object3D.GetBump(tex);
35283957
3529
- 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
+ }
35303968
35313969 double s = v.s;
35323970
....@@ -3614,11 +4052,11 @@
36144052
36154053 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36164054
3617
- boolean random = CameraPane.RANDOM;
3618
- CameraPane.RANDOM = false; // parse all random nodes
4055
+ boolean random = CameraPane.SWITCH;
4056
+ CameraPane.SWITCH = false; // parse all random nodes
36194057 lowres.linkVerticesThis(null);
36204058 lowres.linkVerticesThis(sn);
3621
- CameraPane.RANDOM = random;
4059
+ CameraPane.SWITCH = random;
36224060
36234061 System.err.flush();
36244062
....@@ -3658,7 +4096,7 @@
36584096 return;
36594097
36604098 Object3D poses = group.selection.get(0);
3661
- Object3D ref = GrafreeD.clipboard.get(0);
4099
+ Object3D ref = Grafreed.clipboard.get(0);
36624100
36634101 Object3D newgroup = new Object3D("Po:" + poses.name);
36644102
....@@ -3852,9 +4290,9 @@
38524290
38534291 void ClipMesh()
38544292 {
3855
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4293
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38564294 {
3857
- Object3D content = GrafreeD.clipboard.get(0);
4295
+ Object3D content = Grafreed.clipboard.get(0);
38584296
38594297 if (content instanceof cGroup && ((cGroup)content).transientlink )
38604298 content = ((cGroup)content).get(0);
....@@ -3863,7 +4301,7 @@
38634301 // {
38644302 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38654303 // }
3866
- group.selection.ClipMesh(GrafreeD.clipboard);
4304
+ group.selection.ClipMesh(Grafreed.clipboard);
38674305 }
38684306 // group.selection.ClipMesh(GrafreeD.clipboard);
38694307 System.out.println("DONE.");
....@@ -3910,6 +4348,18 @@
39104348 void MarkLeaves(boolean hide)
39114349 {
39124350 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);
39134363 refreshContents();
39144364 }
39154365
....@@ -3995,10 +4445,10 @@
39954445 {
39964446 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39974447 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3998
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4448
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39994449
40004450 Object3D elem = (Object3D)group.selection.elementAt(i);
4001
- if(elem != group)
4451
+ if(elem != group || !newWindow)
40024452 {
40034453 // if (!(elem instanceof Composite))
40044454 // newWindow = false;
....@@ -4088,7 +4538,6 @@
40884538 //case 702: // Event.LIST_DESELECT
40894539 group.deselectAll();
40904540 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4091
- objEditor.ClearInfo(); // .GetMaterial());
40924541 if (tps != null)
40934542 {
40944543 for (int i=0; i < tps.length; i++)
....@@ -4097,10 +4546,8 @@
40974546
40984547 //if (child.parent != null)
40994548 //child.parent.addSelectee(child);
4549
+ objEditor.SetMaterial(child);
41004550 group.addSelectee(child);
4101
- objEditor.SetMaterial(child); // .GetMaterial());
4102
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4103
- System.err.println("info : " + child.GetPath());
41044551 }
41054552 }
41064553 // else
....@@ -4110,16 +4557,17 @@
41104557 // System.err.println("info : " + group.GetPath());
41114558 // }
41124559
4113
- objEditor.SetText(); // jan 2014
4114
-
4115
- 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))
41164561 CameraPane.flash = true;
41174562
4118
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4563
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41194564 // a camera
41204565 {
4121
- CameraPane.camerachangeframe = 0; // don't refuse it
4122
- 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
+ }
41234571 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41244572 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41254573 }
....@@ -4132,6 +4580,26 @@
41324580
41334581 freezemodel = false;
41344582 }
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
+ }
41354603
41364604 void linkSomething(Object3D thing)
41374605 {
....@@ -4203,16 +4671,19 @@
42034671 {
42044672 if (group.selection.isEmpty())
42054673 return;
4206
- GrafreeD.clipboardIsTempGroup = false;
4674
+
4675
+ Grafreed.clipboardIsTempGroup = false;
42074676 Composite tGroup = null;
42084677 if (group.selection.size() > 0) // 1)
42094678 {
42104679 tGroup = new cGroup();
4211
- GrafreeD.clipboardIsTempGroup = true;
4680
+ Grafreed.clipboardIsTempGroup = true;
42124681 }
42134682
42144683 if (cut)
42154684 {
4685
+ if (Globals.SAVEONMAKE)
4686
+ Save();
42164687 //int indices[] = jList.getSelectedIndices();
42174688 //for (int i = indices.length - 1; i >= 0; i--)
42184689 //jList.remove(indices[i]);
....@@ -4248,16 +4719,16 @@
42484719 //System.out.println("cut " + child);
42494720 //System.out.println("parent = " + child.parent);
42504721 // tmp.addChild(child);
4251
- if (GrafreeD.clipboardIsTempGroup)
4722
+ if (Grafreed.clipboardIsTempGroup)
42524723 tGroup.add/*Child*/(tmp);
42534724 else
4254
- GrafreeD.clipboard = tmp;
4725
+ Grafreed.clipboard = tmp;
42554726 }
42564727 else
4257
- if (GrafreeD.clipboardIsTempGroup)
4728
+ if (Grafreed.clipboardIsTempGroup)
42584729 tGroup.add/*Child*/(child);
42594730 else
4260
- GrafreeD.clipboard = child;
4731
+ Grafreed.clipboard = child;
42614732 }
42624733
42634734 //ResetModel();
....@@ -4289,21 +4760,23 @@
42894760 //System.out.println("cut " + elem);
42904761 //System.out.println("parent = " + elem.parent);
42914762 // tmp.addChild(elem);
4292
- if (GrafreeD.clipboardIsTempGroup)
4763
+ if (Grafreed.clipboardIsTempGroup)
42934764 tGroup.add/*Child*/(tmp);
42944765 else
4295
- GrafreeD.clipboard = tmp;
4766
+ Grafreed.clipboard = tmp;
42964767 }
42974768 else
4298
- if (GrafreeD.clipboardIsTempGroup)
4769
+ if (Grafreed.clipboardIsTempGroup)
42994770 tGroup.add/*Child*/(child);
43004771 else
4301
- GrafreeD.clipboard = child;
4772
+ Grafreed.clipboard = child;
43024773 }
43034774
43044775 }
4305
- if (GrafreeD.clipboardIsTempGroup)
4306
- GrafreeD.clipboard = tGroup;
4776
+
4777
+ if (Grafreed.clipboardIsTempGroup)
4778
+ Grafreed.clipboard = tGroup;
4779
+
43074780 if (cut)
43084781 {
43094782 ResetModel();
....@@ -4317,7 +4790,7 @@
43174790 // return;
43184791 boolean first = true;
43194792
4320
- if (GrafreeD.clipboardIsTempGroup)
4793
+ if (Grafreed.clipboardIsTempGroup)
43214794 {
43224795 Composite temp;
43234796
....@@ -4328,7 +4801,7 @@
43284801 temp = (Composite)Applet3D.clipboard.deepCopy();
43294802 */
43304803 Object3D elem;
4331
- 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))
43324805 {
43334806 Object3D child = (Object3D)e.nextElement();
43344807
....@@ -4362,21 +4835,21 @@
43624835 //Object3D cb = Applet3D.clipboard;
43634836 //temp.addChild(cb);
43644837 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4365
- assert(GrafreeD.clipboard.parent == null);
4366
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4367
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4368
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4369
- 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());
43704843 else
4371
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4372
- GrafreeD.clipboard.get(0).parent = keepparent;
4844
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4845
+ Grafreed.clipboard.get(0).parent = keepparent;
43734846 }
43744847
43754848 ResetModel();
43764849 refreshContents();
43774850 }
43784851
4379
- void pasteInto(boolean copyit)
4852
+ void pasteInto(boolean copyit, boolean clone)
43804853 {
43814854 // if (GrafreeD.clipboard == null)
43824855 // return;
....@@ -4405,15 +4878,22 @@
44054878 if (copyit)
44064879 {
44074880 // paste(false);
4408
- CloneClipboard(false); // sept 2014
4881
+ if (clone)
4882
+ {
4883
+ CloneClipboard(false); // sept 2014
4884
+ }
4885
+ else
4886
+ {
4887
+ paste(false);
4888
+ }
44094889 }
44104890 else
44114891 {
44124892 boolean first = true;
44134893
4414
- if (GrafreeD.clipboardIsTempGroup)
4894
+ if (Grafreed.clipboardIsTempGroup)
44154895 {
4416
- Composite temp = (Composite)GrafreeD.clipboard;
4896
+ Composite temp = (Composite)Grafreed.clipboard;
44174897 Object3D copy;
44184898 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44194899 {
....@@ -4423,7 +4903,7 @@
44234903 }
44244904 } else
44254905 {
4426
- linkSomething(GrafreeD.clipboard); //.get(0));
4906
+ linkSomething(Grafreed.clipboard); //.get(0));
44274907 }
44284908 }
44294909 }
....@@ -4828,21 +5308,6 @@
48285308 }
48295309 */
48305310
4831
- void ImportGFD()
4832
- {
4833
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4834
- browser.show();
4835
- String filename = browser.getFile();
4836
- if (filename != null && filename.length() > 0)
4837
- {
4838
- String fullname = browser.getDirectory() + filename;
4839
-
4840
- //Object3D readobj =
4841
- objEditor.ReadGFD(fullname, objEditor);
4842
- //makeSomething(readobj);
4843
- }
4844
- }
4845
-
48465311 /*
48475312 public void Callback(Object obj)
48485313 {
....@@ -4866,26 +5331,9 @@
48665331 }
48675332 */
48685333
4869
- void ImportVRMLX3D()
4870
- {
4871
- if (GrafreeD.standAlone)
4872
- {
4873
- /**/
4874
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4875
- browser.show();
4876
- String filename = browser.getFile();
4877
- if (filename != null && filename.length() > 0)
4878
- {
4879
- String fullname = browser.getDirectory() + filename;
4880
- LoadVRMLX3D(fullname);
4881
- }
4882
- /**/
4883
- }
4884
- }
4885
-
48865334 String GetFile(String dialogName)
48875335 {
4888
- if (GrafreeD.standAlone)
5336
+ if (Grafreed.standAlone)
48895337 {
48905338 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48915339 browser.show();
....@@ -4949,10 +5397,33 @@
49495397 cButton flashSelectionButton;
49505398 cButton editButton;
49515399 cButton uneditButton;
5400
+ JCheckBox allParamsButton;
49525401 cButton clearpanelButton;
4953
- cButton allParamsButton;
49545402 cButton unselectButton;
49555403
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
+
49565427 cButton screenfitButton;
49575428 cButton screenfitpointButton;
49585429 cButton snapobjectButton;
....@@ -4963,14 +5434,6 @@
49635434 cButton closeButton;
49645435
49655436 cButton setsupportButton;
4966
-
4967
- cButton twoButton;
4968
- cButton sixButton;
4969
- cButton threeButton;
4970
- cButton sevenButton;
4971
- cButton fourButton; // full panel
4972
- cButton oneButton; // full XYZ
4973
- //cButton currentLayout;
49745437
49755438 //
49765439 //Composite
....@@ -4983,7 +5446,9 @@
49835446 private MenuItem lookFromItem;
49845447 private MenuItem switchItem;
49855448 private MenuItem cutItem;
4986
- private MenuItem duplicateItem;
5449
+ private MenuItem undoItem;
5450
+ private MenuItem redoItem;
5451
+ private JMenuItem duplicateItem;
49875452 private MenuItem cloneItem;
49885453 private MenuItem cloneSupportItem;
49895454 private MenuItem overwriteGeoItem;
....@@ -4996,7 +5461,7 @@
49965461 private MenuItem linkverticesItem;
49975462 private MenuItem relinkverticesItem;
49985463 private MenuItem setMasterItem;
4999
- private MenuItem resetMeshItem;
5464
+ private MenuItem resetAllItem;
50005465 private MenuItem stepAllItem;
50015466 private MenuItem revertMeshItem;
50025467 private MenuItem poseMeshItem;
....@@ -5007,6 +5472,7 @@
50075472 private MenuItem mergeGeometriesItem;
50085473 private MenuItem copyItem;
50095474 private MenuItem pasteItem;
5475
+ private MenuItem pasteIntoItem;
50105476 private MenuItem pasteLinkItem;
50115477 private MenuItem pasteCloneItem;
50125478 private MenuItem pasteExpandItem;
....@@ -5045,6 +5511,10 @@
50455511 private MenuItem showleavesItem;
50465512 private MenuItem markleavesItem;
50475513 private MenuItem unmarkleavesItem;
5514
+ private MenuItem rewindleavesItem;
5515
+ private MenuItem unrewindleavesItem;
5516
+ private MenuItem randomleavesItem;
5517
+ private MenuItem unrandomleavesItem;
50485518
50495519 private MenuItem flipVItem;
50505520 private MenuItem unflipVItem;
....@@ -5056,8 +5526,10 @@
50565526 private MenuItem panoTexturesItem;
50575527
50585528 private MenuItem resetCentroidItem;
5059
- private MenuItem transformgeometryItem;
5529
+ private MenuItem resetCentroidXZItem;
50605530 private MenuItem resetTransformItem;
5531
+ private MenuItem transformGeometryItem;
5532
+ private MenuItem transformChildrenItem;
50615533 private MenuItem hideItem;
50625534 private MenuItem grabItem;
50635535 private MenuItem backItem;
....@@ -5104,7 +5576,7 @@
51045576 private MenuItem blobItem;
51055577 private MenuItem latheItem;
51065578 private MenuItem bezierItem;
5107
- private MenuItem checkerItem;
5579
+ private MenuItem overlayItem;
51085580 private MenuItem meshItem;
51095581 // private MenuItem meshGroupItem;
51105582 private MenuItem springItem;
....@@ -5126,11 +5598,6 @@
51265598 private MenuItem doubleItem;
51275599 private MenuItem tripleItem;
51285600
5129
- private MenuItem importGFDItem;
5130
- private MenuItem importVRMLX3DItem;
5131
- private MenuItem import3DSItem;
5132
- private MenuItem importOBJItem;
5133
-
51345601 private MenuItem computeAOItem;
51355602 private MenuItem recompileItem;
51365603 private MenuItem editScriptItem;
....@@ -5140,4 +5607,8 @@
51405607 private MenuItem analyzeItem;
51415608 private MenuItem dumpItem;
51425609 //boolean freezemodel = false;
5610
+
5611
+ Menu cameraMenu;
5612
+ MenuItem editCameraItem;
5613
+ MenuItem revertCameraItem;
51435614 }