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,90 +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(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
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);
620
+ fastCB.setToolTipText("Fast mode");
621
+ fastCB.addItemListener(this);
622
+
623
+ oe.toolboxPanel.Return();
624
+
625
+ oe.toolboxPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
444626 trackCB.setToolTipText("Enable tracking");
445627 trackCB.addItemListener(this);
446628
447
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
629
+ oe.toolboxPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
448630 screenfitButton.setToolTipText("Screen fit");
449631 screenfitButton.addActionListener(this);
450632
451633 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
452634 // screenfitpointButton.addActionListener(this);
453
-// oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
455
- snapobjectButton.addActionListener(this);
456
- snapobjectButton.setToolTipText("Snap Object");
457
- oe.aConstraints.gridx += 1;
458635
459
- //aConstraints.gridx = 0;
460
- //aConstraints.gridy += 1;
461
- oe.aConstraints.weighty = 0;
462
- oe.aConstraints.gridwidth = 1;
463
-
464
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
465
- 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");
466645 flashSelectionButton.addActionListener(this);
467646
468
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
647
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
469648
470
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
649
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
471650 twoButton.setToolTipText("Show center view only");
472651 twoButton.addActionListener(this);
473
- 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);
474655 fourButton.addActionListener(this);
475656 fourButton.setToolTipText("Show left panel only");
476
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
657
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
477658 sixButton.setToolTipText("2-column layout left");
478659 sixButton.addActionListener(this);
479
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
660
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
480661 threeButton.setToolTipText("2-column layout right");
481662 threeButton.addActionListener(this);
482
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
663
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
483664 sevenButton.setToolTipText("3-column layout");
484665 sevenButton.addActionListener(this);
485666 //
486667
487
- 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);
488669 rootButton.setToolTipText("Edit selection in new tab");
489670 rootButton.addActionListener(this);
490671
491
- 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);
492673 closeButton.setToolTipText("Close tab");
493674 closeButton.addActionListener(this);
494675 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
495676 //clearButton.addActionListener(this);
496
-
497
- 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();
498692
499
- 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);
500726 editButton.setToolTipText("Edit selection");
501727 editButton.addActionListener(this);
502728
503
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
729
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504730 uneditButton.setToolTipText("Unedit selection");
505731 uneditButton.addActionListener(this);
506732
507
- 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);
508738 clearPanelButton.setToolTipText("Clear edit panel");
509739 clearPanelButton.addActionListener(this);
510740
511
- commandsPanel.add(allParamsButton = new cButton("A", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
512
- allParamsButton.setToolTipText("All params??");
513
- allParamsButton.addActionListener(this);
514
-
515
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
741
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
516742 unselectButton.setToolTipText("Unselect");
517743 unselectButton.addActionListener(this);
518744
519
- commandsPanel.preferredHeight = 1;
745
+ editCommandsPanel.preferredHeight = 1;
520746
521
- oe.treePanel.add(commandsPanel);
522
- oe.treePanel.Return();
747
+// oe.treePanel.add(commandsPanel);
748
+// oe.treePanel.Return();
523749
524750 // oe.aConstraints.gridx += 1;
525751 // oe.aConstraints.weighty = 0;
....@@ -536,7 +762,7 @@
536762
537763 JScrollPane jSP;
538764 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
539
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
765
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
540766 ResetModel();
541767
542768 oe.treePanel.add(jSPPanel);
....@@ -587,43 +813,35 @@
587813
588814 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
589815 {
590
- //constraints.gridx = 0;
591
- //constraints.gridy = 0;
592
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
593
- fastCB.setToolTipText("Fast mode");
594
- fastCB.addItemListener(this);
595
- //constraints.gridy += 1;
596
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
597
- supportCB.setToolTipText("Enabled rigging");
598
- supportCB.addItemListener(this);
599
-
600
- // constraints.gridy += 1;
601
- // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
602
- // localCB.addItemListener(this);
603
-
604
- //constraints.gridy += 1;
605
- panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
606
- crowdCB.setToolTipText("Used for crowds");
607
- crowdCB.addItemListener(this);
608
-
609
- //constraints.gridy += 1;
610
- panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
611
- smoothCB.setToolTipText("Snapping delay");
612
- smoothCB.addItemListener(this);
613
-
614
- //constraints.gridy += 1;
615
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
616
- slowCB.setToolTipText("Smooth interpolation");
617
- slowCB.addItemListener(this);
618
- //constraints.gridy += 1;
619816 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
620817 boxCB.setToolTipText("Display bounding boxes");
621818 boxCB.addItemListener(this);
622
- //constraints.gridy += 1;
819
+
623820 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
624821 zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
625822 zoomBoxCB.addItemListener(this);
626823
824
+ if (true) // Globals.ADVANCED)
825
+ {
826
+ panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
827
+ supportCB.setToolTipText("Enable rigging");
828
+ supportCB.addItemListener(this);
829
+
830
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
831
+ // localCB.addItemListener(this);
832
+
833
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
834
+ crowdCB.setToolTipText("Used for crowds");
835
+ crowdCB.addItemListener(this);
836
+
837
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
838
+ smoothCB.setToolTipText("Snapping delay");
839
+ smoothCB.addItemListener(this);
840
+
841
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
842
+ slowCB.setToolTipText("Smooth interpolation");
843
+ slowCB.addItemListener(this);
844
+
627845 // constraints.gridy += 1;
628846 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
629847 // speakerMocapCB.addItemListener(this);
....@@ -648,14 +866,26 @@
648866 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
649867 // debugCB.addItemListener(this);
650868
651
- //constraints.gridy += 1;
652869 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
870
+ oeilCB.setToolTipText("Move camera when tracking target");
653871 oeilCB.addItemListener(this);
654872
655
- //constraints.gridy += 1;
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
+ {
656883 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
657884 lookAtCB.setToolTipText("Look-at target");
658885 lookAtCB.addItemListener(this);
886
+ }
887
+
888
+ }
659889
660890 cGridBag fill = new cGridBag();
661891
....@@ -668,6 +898,14 @@
668898 void EditObject(Object3D obj)
669899 {
670900 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
+
671909 radioButton.SetObject(obj);
672910 radioButton.layout = sevenButton;
673911 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -676,8 +914,11 @@
676914 buttonGroup.add(radioButton);
677915 radioButton.doClick();
678916 }
917
+
679918 void SetupViews(ObjEditor oe)
680919 {
920
+ theFrame = this;
921
+
681922 oe.SetupViews();
682923
683924 System.out.println("SetupViews");
....@@ -686,23 +927,26 @@
686927 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
687928 }
688929
689
- JCheckBox liveCB;
690
- JCheckBox supportCB;
691
- JCheckBox localCB;
692
- JCheckBox crowdCB;
693
- JCheckBox smoothCB;
694
- JCheckBox fastCB;
695
- JCheckBox slowCB;
696
- JCheckBox boxCB;
697
- JCheckBox zoomBoxCB;
698
- JCheckBox trackCB;
699
- 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;
700941 // JCheckBox speakerMocapCB;
701
- JCheckBox speakerCameraCB;
702
- JCheckBox speakerFocusCB;
703
- JCheckBox debugCB;
704
- JCheckBox oeilCB;
705
- JCheckBox lookAtCB;
942
+ cCheckBox speakerCameraCB;
943
+ cCheckBox speakerFocusCB;
944
+ cCheckBox debugCB;
945
+
946
+ cCheckBox oeilCB;
947
+ cCheckBox shadowCB;
948
+ cCheckBox autosaveCB;
949
+ cCheckBox lookAtCB;
706950
707951 // static int COLOR = 1;
708952 // static int MATERIAL = 2;
....@@ -710,9 +954,9 @@
710954
711955 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
712956
713
- JCheckBox colorCB;
714
- JCheckBox materialCB;
715
- JCheckBox textureCB;
957
+ cCheckBox colorCB;
958
+ cCheckBox materialCB;
959
+ cCheckBox textureCB;
716960
717961 public void itemStateChanged(ItemEvent e)
718962 {
....@@ -740,6 +984,7 @@
740984 } else if(e.getSource() == liveCB)
741985 {
742986 cameraView.ToggleLive();
987
+ refreshContents(false);
743988 }
744989 else if(e.getSource() == supportCB)
745990 {
....@@ -804,6 +1049,14 @@
8041049 {
8051050 cameraView.ToggleOeil();
8061051 }
1052
+ else if(e.getSource() == shadowCB)
1053
+ {
1054
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1055
+ }
1056
+ else if(e.getSource() == autosaveCB)
1057
+ {
1058
+ Globals.SAVEONMAKE ^= true;
1059
+ }
8071060 else if(e.getSource() == lookAtCB)
8081061 {
8091062 cameraView.ToggleLookAt();
....@@ -820,7 +1073,8 @@
8201073
8211074 /**/
8221075 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
823
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1076
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1077
+ TreePath path = objEditor.jTree.getSelectionPath();
8241078 if ((path == null) || (path.getPathCount() <= 1)) {
8251079 // We can't move the root node or an empty selection
8261080 return;
....@@ -892,7 +1146,9 @@
8921146 // objEditor.DropFile((java.io.File[]) object, true);
8931147 // return;
8941148 // }
895
- if (string.charAt(0) == '/')
1149
+
1150
+ // File path for Mac and Windows
1151
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8961152 {
8971153 // file(s)
8981154 String[] names = string.split("\n");
....@@ -919,7 +1175,7 @@
9191175
9201176 flashIt = false;
9211177 CameraPane pane = (CameraPane) target;
922
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1178
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9231179 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9241180
9251181 if (group.selection.size() == 1)
....@@ -942,16 +1198,16 @@
9421198 return;
9431199 }
9441200
945
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
946
- {
1201
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1202
+// {
9471203 loadClipboard(true);
9481204 objEditor.jTree.setSelectionPath(destinationPath);
949
- pasteInto(false);
950
- } else {
951
- loadClipboard(false);
952
- objEditor.jTree.setSelectionPath(destinationPath);
953
- pasteInto(false); // true); // ???
954
- }
1205
+ pasteInto(false, false);
1206
+// } else {
1207
+// loadClipboard(false);
1208
+// objEditor.jTree.setSelectionPath(destinationPath);
1209
+// pasteInto(false, false); // true); // ???
1210
+// }
9551211 }
9561212 public void dropActionChanged(DropTargetDragEvent dtde)
9571213 // Called if the user has modified the current drop gesture
....@@ -1072,27 +1328,33 @@
10721328 kleinItem.addActionListener(this);
10731329 particleItem = menu.add(new MenuItem("Particle system"));
10741330 particleItem.addActionListener(this);
1331
+ if (Globals.ADVANCED)
1332
+ {
10751333 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10761334 ragdollItem.addActionListener(this);
10771335 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10781336 ragdoll2Item.addActionListener(this);
1337
+ }
10791338 menu.add("-");
1080
- meshItem = menu.add(new MenuItem("Mesh"));
1339
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10811340 meshItem.addActionListener(this);
10821341 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10831342 // meshGroupItem.addActionListener(this);
1343
+ if (Globals.ADVANCED)
1344
+ {
10841345 springItem = menu.add(new MenuItem("Spring"));
10851346 springItem.addActionListener(this);
10861347 flagItem = menu.add(new MenuItem("Flag"));
10871348 flagItem.addActionListener(this);
1088
- bezierItem = menu.add(new MenuItem("Patch"));
1089
- bezierItem.addActionListener(this);
1090
- checkerItem = menu.add(new MenuItem("Checker"));
1091
- checkerItem.addActionListener(this);
10921349 blobItem = menu.add(new MenuItem("Blob"));
10931350 blobItem.addActionListener(this);
10941351 latheItem = menu.add(new MenuItem("Lathe"));
10951352 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);
10961358 lightItem = menu.add(new MenuItem("Light"));
10971359 lightItem.addActionListener(this);
10981360 menu.add("-");
....@@ -1102,39 +1364,44 @@
11021364 loopItem.addActionListener(this);
11031365 doubleItem = menu.add(new MenuItem("Fork"));
11041366 doubleItem.addActionListener(this);
1367
+ if (Globals.ADVANCED)
1368
+ {
11051369 tripleItem = menu.add(new MenuItem("Trident"));
11061370 tripleItem.addActionListener(this);
1371
+ }
11071372 }
11081373
11091374 void buildToolsMenu(Menu menu)
11101375 {
11111376 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11121377 animationItem.addItemListener(this);
1113
- animationItem.setState(CameraPane.ANIMATION);
1378
+ animationItem.setState(Globals.ANIMATION);
11141379
11151380 menu.add("-");
11161381 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11171382 parseverticesItem.addActionListener(this);
11181383 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11191384 textureFieldItem.addActionListener(this);
1120
- alignItem = menu.add(new MenuItem("Align"));
1385
+ alignItem = menu.add(new MenuItem("Align Objects"));
11211386 alignItem.addActionListener(this);
1122
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1123
- mirrorItem.addActionListener(this);
11241387 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11251388 reduceMorphItem.addActionListener(this);
11261389 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11271390 reduce34MorphItem.addActionListener(this);
1128
-
1391
+ menu.add("-");
11291392 menu.add(computeAOItem = new MenuItem("Compute AO"));
11301393 computeAOItem.addActionListener(this);
1131
- menu.add("-");
11321394
1395
+ if (Globals.ADVANCED)
1396
+ {
1397
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1398
+ mirrorItem.addActionListener(this);
1399
+ menu.add("-");
11331400 menu.add(memoryItem = new MenuItem("Memory Usage"));
11341401 memoryItem.addActionListener(this);
11351402 menu.add(analyzeItem = new MenuItem("Analyze"));
11361403 analyzeItem.addActionListener(this);
1137
- menu.add(dumpItem = new MenuItem("Dump"));
1404
+ menu.add(dumpItem = new MenuItem("Print"));
11381405 dumpItem.addActionListener(this);
11391406 // menu.add(pathItem = new MenuItem("From-to path"));
11401407 // pathItem.addActionListener(this);
....@@ -1152,6 +1419,7 @@
11521419 menu.add("-");
11531420 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11541421 editScriptItem.addActionListener(this);
1422
+ }
11551423 }
11561424
11571425 void ScreenFit()
....@@ -1274,6 +1542,7 @@
12741542 shadow.material = new cMaterial(obj.material);
12751543 shadow.material.diffuse = 0.0001f;
12761544 shadow.material.specular = 0.0001f;
1545
+ //shadow.projectedVertices[1].x = 300;
12771546
12781547 makeSomething(shadow);
12791548 }
....@@ -1480,9 +1749,9 @@
14801749
14811750 void Overwrite(int mask)
14821751 {
1483
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1752
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14841753 {
1485
- Object3D content = GrafreeD.clipboard.get(0);
1754
+ Object3D content = Grafreed.clipboard.get(0);
14861755
14871756 if (content instanceof cGroup && ((cGroup)content).transientlink )
14881757 content = ((cGroup)content).get(0);
....@@ -1530,11 +1799,11 @@
15301799 objEditor.cameraView.renderCamera.setAim(v2, v1);
15311800 objEditor.cameraView.repaint();
15321801 } else
1533
- if (source == rectoidItem)
1802
+ if (source == rectoidItem || source == boxButton)
15341803 {
15351804 makeSomething(new Box());
15361805 } else
1537
- if (source == particleItem)
1806
+ if (source == particleItem || source == particlesButton)
15381807 {
15391808 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15401809 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1613,27 +1882,27 @@
16131882
16141883 makeSomething(obj);
16151884 } else
1616
- if (source == gridItem)
1885
+ if (source == gridItem || source == gridButton)
16171886 {
16181887 makeSomething(new Grid());
16191888 } else
1620
- if (source == ellipsoidItem)
1889
+ if (source == ellipsoidItem || source == sphereButton)
16211890 {
16221891 makeSomething(new Sphere());
16231892 } else
1624
- if (source == coneItem)
1893
+ if (source == coneItem || source == coneButton)
16251894 {
16261895 makeSomething(new Cone());
16271896 } else
1628
- if (source == torusItem)
1897
+ if (source == torusItem || source == torusButton)
16291898 {
16301899 makeSomething(new Torus());
16311900 } else
1632
- if (source == superItem)
1901
+ if (source == superItem || source == superButton)
16331902 {
16341903 makeSomething(new Superellipsoid());
16351904 } else
1636
- if (source == kleinItem)
1905
+ if (source == kleinItem || source == kleinButton)
16371906 {
16381907 makeSomething(new Klein());
16391908 } else
....@@ -1653,7 +1922,7 @@
16531922 {
16541923 makeSomething(new BezierSurface());
16551924 } else
1656
- if (source == checkerItem)
1925
+ if (source == overlayItem || source == overlayButton)
16571926 {
16581927 /*
16591928 Object3D obj = new BezierSurface(5,8);
....@@ -1701,7 +1970,7 @@
17011970 s.setup();
17021971 makeSomething(s);
17031972 } else
1704
- if (source == lightItem)
1973
+ if (source == lightItem || source == lightButton)
17051974 {
17061975 makeSomething(new Light());
17071976 } else
....@@ -1787,23 +2056,6 @@
17872056 csg.addChild(child);
17882057 child.addChild(csg);
17892058 } else
1790
-
1791
- if (source == importGFDItem)
1792
- {
1793
- ImportGFD();
1794
- } else
1795
- if (source == importVRMLX3DItem)
1796
- {
1797
- ImportVRMLX3D();
1798
- } else
1799
- if (source == import3DSItem)
1800
- {
1801
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1802
- } else
1803
- if (source == importOBJItem)
1804
- {
1805
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1806
- } else
18072059 if (source == computeAOItem)
18082060 {
18092061 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1822,7 +2074,7 @@
18222074 if (source == invariantsItem)
18232075 {
18242076 System.out.println("Invariants:");
1825
- GrafreeD.grafreeD.universe.invariants();
2077
+ Grafreed.grafreeD.universe.invariants();
18262078 } else
18272079 if (source == memoryItem)
18282080 {
....@@ -1840,6 +2092,35 @@
18402092 if (source == dumpItem)
18412093 {
18422094 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();
18432124 } else
18442125 if (source == screenfitButton)
18452126 {
....@@ -1890,12 +2171,20 @@
18902171 {
18912172 loadClipboard(true);
18922173 } else
2174
+ if (source == undoItem)
2175
+ {
2176
+ Undo();
2177
+ } else
2178
+ if (source == redoItem)
2179
+ {
2180
+ Redo();
2181
+ } else
18932182 if (source == duplicateItem)
18942183 {
1895
- Object3D keep = GrafreeD.clipboard;
2184
+ Object3D keep = Grafreed.clipboard;
18962185 loadClipboard(false);
18972186 paste(false);
1898
- GrafreeD.clipboard = keep;
2187
+ Grafreed.clipboard = keep;
18992188 } else
19002189 if (source == cloneItem)
19012190 {
....@@ -1913,13 +2202,17 @@
19132202 {
19142203 paste(false);
19152204 } else
2205
+ if (source == pasteIntoItem)
2206
+ {
2207
+ pasteInto(true, false);
2208
+ } else
19162209 if (source == pasteLinkItem)
19172210 {
1918
- pasteInto(false);
2211
+ pasteInto(false, false);
19192212 } else
19202213 if (source == pasteCloneItem)
19212214 {
1922
- pasteInto(true);
2215
+ pasteInto(true, true);
19232216 } else
19242217 if (source == pasteExpandItem)
19252218 {
....@@ -2111,9 +2404,9 @@
21112404 // group.selection.get(0).setMasterThis(content); // should be identity
21122405 // refreshContents();
21132406 // }
2114
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2407
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21152408 {
2116
- Object3D content = GrafreeD.clipboard.get(0);
2409
+ Object3D content = Grafreed.clipboard.get(0);
21172410
21182411 if (content instanceof cGroup && ((cGroup)content).transientlink )
21192412 content = ((cGroup)content).get(0);
....@@ -2121,11 +2414,11 @@
21212414 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21222415 for (int i=0; i<group.selection.size(); i++)
21232416 {
2124
- boolean random = CameraPane.RANDOM;
2125
- CameraPane.RANDOM = false; // parse all random nodes
2417
+ boolean random = CameraPane.SWITCH;
2418
+ CameraPane.SWITCH = false; // parse all random nodes
21262419 group.selection.get(i).linkVerticesThis(content);
21272420 // group.selection.get(i).setMasterThis(content); // should be identity
2128
- CameraPane.RANDOM = random;
2421
+ CameraPane.SWITCH = random;
21292422 }
21302423 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21312424 refreshContents();
....@@ -2135,20 +2428,20 @@
21352428 {
21362429 for (int i=0; i<group.selection.size(); i++)
21372430 {
2138
- boolean random = CameraPane.RANDOM;
2139
- CameraPane.RANDOM = false; // parse all random nodes
2431
+ boolean random = CameraPane.SWITCH;
2432
+ CameraPane.SWITCH = false; // parse all random nodes
21402433 group.selection.get(i).linkVerticesThis(null);
2141
- CameraPane.RANDOM = random;
2434
+ CameraPane.SWITCH = random;
21422435 }
21432436
21442437 refreshContents();
21452438 } else
21462439 if (source == relinkverticesItem)
21472440 {
2148
- boolean random = CameraPane.RANDOM;
2149
- CameraPane.RANDOM = false; // parse all random nodes
2441
+ boolean random = CameraPane.SWITCH;
2442
+ CameraPane.SWITCH = false; // parse all random nodes
21502443 group.selection.RelinkToSupport();
2151
- CameraPane.RANDOM = random;
2444
+ CameraPane.SWITCH = random;
21522445
21532446 refreshContents();
21542447 } else
....@@ -2163,9 +2456,9 @@
21632456 } else
21642457 if (source == setMasterItem)
21652458 {
2166
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2459
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21672460 {
2168
- Object3D content = GrafreeD.clipboard.get(0);
2461
+ Object3D content = Grafreed.clipboard.get(0);
21692462
21702463 if (content instanceof cGroup && ((cGroup)content).transientlink )
21712464 content = ((cGroup)content).get(0);
....@@ -2178,9 +2471,9 @@
21782471 {
21792472 if (group.selection.size() == 1)
21802473 {
2181
- if (GrafreeD.clipboard.size() == 1)
2474
+ if (Grafreed.clipboard.size() == 1)
21822475 {
2183
- Object3D content = GrafreeD.clipboard.get(0);
2476
+ Object3D content = Grafreed.clipboard.get(0);
21842477
21852478 if (content instanceof cGroup && ((cGroup)content).transientlink )
21862479 content = ((cGroup)content).get(0);
....@@ -2197,7 +2490,7 @@
21972490 {
21982491 RevertMeshes();
21992492 } else
2200
- if (source == resetMeshItem)
2493
+ if (source == resetAllItem)
22012494 {
22022495 ResetAll();
22032496 } else
....@@ -2246,7 +2539,7 @@
22462539 RandomNode random = new RandomNode();
22472540 group(random);
22482541 if (random.size() > 0)
2249
- random.name = random.get(0).name + "Rnd";
2542
+ random.name = random.get(0).name + "Switch";
22502543 } else
22512544 if (source == physicsItem)
22522545 {
....@@ -2363,7 +2656,7 @@
23632656 {
23642657 CastShadow(2);
23652658 } else
2366
- if (source == ungroupItem)
2659
+ if (source == ungroupItem || source == ungroupButton)
23672660 {
23682661 //ungroup();
23692662 for (int i=0; i<group.selection.size(); i++)
....@@ -2385,7 +2678,7 @@
23852678 } else
23862679 if (source == genNormalsMESHItem)
23872680 {
2388
- GenNormals(true); // TODO
2681
+ GenNormalsMESH();
23892682 } else
23902683 if (source == genNormalsORGANItem)
23912684 {
....@@ -2450,6 +2743,22 @@
24502743 if (source == unmarkleavesItem)
24512744 {
24522745 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);
24532762 } else
24542763 if (source == flipVItem)
24552764 {
....@@ -2535,9 +2844,13 @@
25352844 {
25362845 SmoothMesh();
25372846 } else
2538
- if (source == transformgeometryItem)
2847
+ if (source == transformGeometryItem)
25392848 {
25402849 TransformGeometry();
2850
+ } else
2851
+ if (source == transformChildrenItem)
2852
+ {
2853
+ TransformChildren();
25412854 } else
25422855 if (source == resetTransformItem)
25432856 {
....@@ -2545,7 +2858,11 @@
25452858 } else
25462859 if (source == resetCentroidItem)
25472860 {
2548
- ResetCentroid();
2861
+ ResetCentroid(true);
2862
+ } else
2863
+ if (source == resetCentroidXZItem)
2864
+ {
2865
+ ResetCentroid(false);
25492866 } else
25502867 if (source == resetParentItem)
25512868 {
....@@ -2677,6 +2994,10 @@
26772994 if (source == twoButton)
26782995 {
26792996 radio.layout = twoButton;
2997
+
2998
+ if (CameraPane.FULLSCREEN)
2999
+ fullscreenLayout = radio.layout;
3000
+
26803001 // bug
26813002 //gridPanel.setDividerLocation(1.0);
26823003 //bigPanel.setDividerLocation(0.0);
....@@ -2709,10 +3030,31 @@
27093030 bigThree.ClearUI();
27103031 bigThree.add(centralPanel);
27113032 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
+
27123051 } else
27133052 if (source == threeButton)
27143053 {
27153054 radio.layout = threeButton;
3055
+
3056
+ if (CameraPane.FULLSCREEN)
3057
+ fullscreenLayout = radio.layout;
27163058
27173059 // bigThree.remove(scenePanel);
27183060 // bigThree.remove(centralPanel);
....@@ -2745,10 +3087,15 @@
27453087 bigThree.add(centralPanel);
27463088 bigThree.add(XYZPanel);
27473089 bigThree.FlushUI();
3090
+
3091
+ cameraView.requestFocusInWindow();
27483092 } else
27493093 if (source == fourButton)
27503094 {
27513095 radio.layout = fourButton;
3096
+
3097
+ if (CameraPane.FULLSCREEN)
3098
+ fullscreenLayout = radio.layout;
27523099
27533100 // bigThree.remove(scenePanel);
27543101 // bigThree.remove(centralPanel);
....@@ -2780,10 +3127,15 @@
27803127 bigThree.ClearUI();
27813128 bigThree.add(scenePanel);
27823129 bigThree.FlushUI();
3130
+
3131
+ cameraView.requestFocusInWindow();
27833132 } else
27843133 if (source == sixButton)
27853134 {
27863135 radio.layout = sixButton;
3136
+
3137
+ if (CameraPane.FULLSCREEN)
3138
+ fullscreenLayout = radio.layout;
27873139
27883140 // bigThree.remove(scenePanel);
27893141 // bigThree.remove(centralPanel);
....@@ -2816,10 +3168,15 @@
28163168 bigThree.add(scenePanel);
28173169 bigThree.add(centralPanel);
28183170 bigThree.FlushUI();
3171
+
3172
+ cameraView.requestFocusInWindow();
28193173 } else
28203174 if (source == sevenButton)
28213175 {
28223176 radio.layout = sevenButton;
3177
+
3178
+ if (CameraPane.FULLSCREEN)
3179
+ fullscreenLayout = radio.layout;
28233180
28243181 // bigThree.remove(scenePanel);
28253182 // bigThree.remove(centralPanel);
....@@ -2853,6 +3210,8 @@
28533210 bigThree.add(centralPanel);
28543211 bigThree.add(XYZPanel);
28553212 bigThree.FlushUI();
3213
+
3214
+ cameraView.requestFocusInWindow();
28563215 } else
28573216 if (source == rootButton)
28583217 {
....@@ -2864,6 +3223,7 @@
28643223 EditObject(obj);
28653224 }
28663225
3226
+ cameraView.requestFocusInWindow();
28673227 refreshContents(true);
28683228 } else
28693229 if (source == closeButton)
....@@ -2873,18 +3233,27 @@
28733233 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28743234 {
28753235 ab = (cRadio)e.nextElement();
2876
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3236
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28773237 {
3238
+ // Patch to avoid bug with transparency.
3239
+ if (!ab.hadMaterial)
3240
+ {
3241
+ ab.object.material = null;
3242
+ }
3243
+
28783244 buttonGroup.remove(ab);
28793245 radioPanel.remove(ab);
28803246
2881
- ab.GetObject().editWindow = null;
3247
+ //ab.GetObject().editWindow = null;
3248
+ ab.GetObject().manipWindow = null;
28823249 // ab.GetObject().objectUI = null; // ?????????
28833250
28843251 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28853252 break;
28863253 }
28873254 }
3255
+
3256
+ cameraView.requestFocusInWindow();
28883257 refreshContents(true);
28893258 } else
28903259 if (source == editItem || source == editButton)
....@@ -2901,9 +3270,9 @@
29013270 child.CloseUI();
29023271 listUI.remove(child);
29033272
2904
- child.editWindow = null; // ???????????
3273
+ //child.editWindow = null; // ???????????
29053274 }
2906
- objEditor.ctrlPanel.validate();
3275
+ objEditor.ctrlPanel.FlushUI();
29073276 //objEditor.jTree.clearSelection();
29083277 //objEditor.ResetSliders();
29093278 refreshContents(true);
....@@ -2987,7 +3356,11 @@
29873356 frontView.object = group;
29883357 sideView.object = group;
29893358 }
2990
- group.editWindow = this;
3359
+
3360
+// fix "+" issue
3361
+ //group.editWindow = this;
3362
+ group.manipWindow = this;
3363
+
29913364 /*
29923365 currentLayout = radio.layout;
29933366 if (currentLayout == null)
....@@ -2999,8 +3372,23 @@
29993372 //group.parent = null; // ROOT
30003373 //group.attributes = -1;
30013374 ResetModel();
3375
+
3376
+ cameraView.requestFocusInWindow();
30023377 refreshContents(true);
3003
- }
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
+ }
30043392 else
30053393 {
30063394 //return super.action(event, arg);
....@@ -3009,7 +3397,6 @@
30093397 }
30103398
30113399 boolean useclient = false;
3012
- cRadio radio;
30133400
30143401 void ToggleRoot()
30153402 {
....@@ -3061,6 +3448,28 @@
30613448 refreshContents();
30623449 }
30633450
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
+ }
30643473
30653474 void ResetTransform()
30663475 {
....@@ -3173,7 +3582,7 @@
31733582 refreshContents();
31743583 }
31753584
3176
- void ResetCentroid()
3585
+ void ResetCentroid(boolean full)
31773586 {
31783587 Object3D obj;
31793588 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3188,12 +3597,16 @@
31883597 LA.matIdentity(Object3D.mat);
31893598 obj.getBounds(minima, maxima, false);
31903599 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3191
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3600
+ if (full)
3601
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31923602 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31933603 obj.TransformMesh(Object3D.mat);
3604
+
31943605 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3195
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3606
+ if (full)
3607
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31963608 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3609
+
31973610 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31983611 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31993612 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3222,7 +3635,8 @@
32223635
32233636 int size = obj.MemorySize();
32243637
3225
- 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)");
32263640 }
32273641 }
32283642 catch (Exception e)
....@@ -3259,9 +3673,9 @@
32593673 obj = (Object3D)e.nextElement();
32603674
32613675 System.out.println("Object is: " + obj);
3262
- GrafreeD.AnalyzeObject(obj);
3676
+ Grafreed.AnalyzeObject(obj);
32633677 System.out.println("Boundary rep: " + obj.bRep);
3264
- GrafreeD.AnalyzeObject(obj.bRep);
3678
+ Grafreed.AnalyzeObject(obj.bRep);
32653679
32663680 // System.err.println((size/1024) + " KB is the size of " + obj);
32673681 }
....@@ -3303,6 +3717,13 @@
33033717 void GenNormals(boolean crease)
33043718 {
33053719 group.GenNormalsS(crease);
3720
+
3721
+ refreshContents();
3722
+ }
3723
+
3724
+ void GenNormalsMESH()
3725
+ {
3726
+ group.GenNormalsMeshS();
33063727
33073728 refreshContents();
33083729 }
....@@ -3475,8 +3896,8 @@
34753896
34763897 void ParseVertices()
34773898 {
3478
- boolean epsequal = GrafreeD.epsequal;
3479
- GrafreeD.epsequal = true;
3899
+ boolean epsequal = Grafreed.epsequal;
3900
+ Grafreed.epsequal = true;
34803901
34813902 for (int i=0; i<group.selection.size(); i++)
34823903 {
....@@ -3501,7 +3922,7 @@
35013922 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35023923 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35033924
3504
- g.add(GrafreeD.clipboard);
3925
+ g.add(Grafreed.clipboard);
35053926
35063927 buffer.add(g);
35073928 }
....@@ -3516,7 +3937,7 @@
35163937 makeSomething(buffer, i==group.selection.size()-1);
35173938 }
35183939
3519
- GrafreeD.epsequal = epsequal;
3940
+ Grafreed.epsequal = epsequal;
35203941
35213942 refreshContents();
35223943 }
....@@ -3534,7 +3955,16 @@
35343955 String pigment = Object3D.GetPigment(tex);
35353956 //String bump = Object3D.GetBump(tex);
35363957
3537
- 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
+ }
35383968
35393969 double s = v.s;
35403970
....@@ -3622,11 +4052,11 @@
36224052
36234053 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36244054
3625
- boolean random = CameraPane.RANDOM;
3626
- CameraPane.RANDOM = false; // parse all random nodes
4055
+ boolean random = CameraPane.SWITCH;
4056
+ CameraPane.SWITCH = false; // parse all random nodes
36274057 lowres.linkVerticesThis(null);
36284058 lowres.linkVerticesThis(sn);
3629
- CameraPane.RANDOM = random;
4059
+ CameraPane.SWITCH = random;
36304060
36314061 System.err.flush();
36324062
....@@ -3666,7 +4096,7 @@
36664096 return;
36674097
36684098 Object3D poses = group.selection.get(0);
3669
- Object3D ref = GrafreeD.clipboard.get(0);
4099
+ Object3D ref = Grafreed.clipboard.get(0);
36704100
36714101 Object3D newgroup = new Object3D("Po:" + poses.name);
36724102
....@@ -3860,9 +4290,9 @@
38604290
38614291 void ClipMesh()
38624292 {
3863
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4293
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38644294 {
3865
- Object3D content = GrafreeD.clipboard.get(0);
4295
+ Object3D content = Grafreed.clipboard.get(0);
38664296
38674297 if (content instanceof cGroup && ((cGroup)content).transientlink )
38684298 content = ((cGroup)content).get(0);
....@@ -3871,7 +4301,7 @@
38714301 // {
38724302 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38734303 // }
3874
- group.selection.ClipMesh(GrafreeD.clipboard);
4304
+ group.selection.ClipMesh(Grafreed.clipboard);
38754305 }
38764306 // group.selection.ClipMesh(GrafreeD.clipboard);
38774307 System.out.println("DONE.");
....@@ -3918,6 +4348,18 @@
39184348 void MarkLeaves(boolean hide)
39194349 {
39204350 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);
39214363 refreshContents();
39224364 }
39234365
....@@ -4003,10 +4445,10 @@
40034445 {
40044446 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40054447 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4006
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4448
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40074449
40084450 Object3D elem = (Object3D)group.selection.elementAt(i);
4009
- if(elem != group)
4451
+ if(elem != group || !newWindow)
40104452 {
40114453 // if (!(elem instanceof Composite))
40124454 // newWindow = false;
....@@ -4096,7 +4538,6 @@
40964538 //case 702: // Event.LIST_DESELECT
40974539 group.deselectAll();
40984540 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4099
- objEditor.ClearInfo(); // .GetMaterial());
41004541 if (tps != null)
41014542 {
41024543 for (int i=0; i < tps.length; i++)
....@@ -4105,10 +4546,8 @@
41054546
41064547 //if (child.parent != null)
41074548 //child.parent.addSelectee(child);
4549
+ objEditor.SetMaterial(child);
41084550 group.addSelectee(child);
4109
- objEditor.SetMaterial(child); // .GetMaterial());
4110
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4111
- System.err.println("info : " + child.GetPath());
41124551 }
41134552 }
41144553 // else
....@@ -4118,16 +4557,17 @@
41184557 // System.err.println("info : " + group.GetPath());
41194558 // }
41204559
4121
- objEditor.SetText(); // jan 2014
4122
-
4123
- 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))
41244561 CameraPane.flash = true;
41254562
4126
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4563
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41274564 // a camera
41284565 {
4129
- CameraPane.camerachangeframe = 0; // don't refuse it
4130
- 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
+ }
41314571 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41324572 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41334573 }
....@@ -4140,6 +4580,26 @@
41404580
41414581 freezemodel = false;
41424582 }
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
+ }
41434603
41444604 void linkSomething(Object3D thing)
41454605 {
....@@ -4211,16 +4671,19 @@
42114671 {
42124672 if (group.selection.isEmpty())
42134673 return;
4214
- GrafreeD.clipboardIsTempGroup = false;
4674
+
4675
+ Grafreed.clipboardIsTempGroup = false;
42154676 Composite tGroup = null;
42164677 if (group.selection.size() > 0) // 1)
42174678 {
42184679 tGroup = new cGroup();
4219
- GrafreeD.clipboardIsTempGroup = true;
4680
+ Grafreed.clipboardIsTempGroup = true;
42204681 }
42214682
42224683 if (cut)
42234684 {
4685
+ if (Globals.SAVEONMAKE)
4686
+ Save();
42244687 //int indices[] = jList.getSelectedIndices();
42254688 //for (int i = indices.length - 1; i >= 0; i--)
42264689 //jList.remove(indices[i]);
....@@ -4256,16 +4719,16 @@
42564719 //System.out.println("cut " + child);
42574720 //System.out.println("parent = " + child.parent);
42584721 // tmp.addChild(child);
4259
- if (GrafreeD.clipboardIsTempGroup)
4722
+ if (Grafreed.clipboardIsTempGroup)
42604723 tGroup.add/*Child*/(tmp);
42614724 else
4262
- GrafreeD.clipboard = tmp;
4725
+ Grafreed.clipboard = tmp;
42634726 }
42644727 else
4265
- if (GrafreeD.clipboardIsTempGroup)
4728
+ if (Grafreed.clipboardIsTempGroup)
42664729 tGroup.add/*Child*/(child);
42674730 else
4268
- GrafreeD.clipboard = child;
4731
+ Grafreed.clipboard = child;
42694732 }
42704733
42714734 //ResetModel();
....@@ -4297,21 +4760,23 @@
42974760 //System.out.println("cut " + elem);
42984761 //System.out.println("parent = " + elem.parent);
42994762 // tmp.addChild(elem);
4300
- if (GrafreeD.clipboardIsTempGroup)
4763
+ if (Grafreed.clipboardIsTempGroup)
43014764 tGroup.add/*Child*/(tmp);
43024765 else
4303
- GrafreeD.clipboard = tmp;
4766
+ Grafreed.clipboard = tmp;
43044767 }
43054768 else
4306
- if (GrafreeD.clipboardIsTempGroup)
4769
+ if (Grafreed.clipboardIsTempGroup)
43074770 tGroup.add/*Child*/(child);
43084771 else
4309
- GrafreeD.clipboard = child;
4772
+ Grafreed.clipboard = child;
43104773 }
43114774
43124775 }
4313
- if (GrafreeD.clipboardIsTempGroup)
4314
- GrafreeD.clipboard = tGroup;
4776
+
4777
+ if (Grafreed.clipboardIsTempGroup)
4778
+ Grafreed.clipboard = tGroup;
4779
+
43154780 if (cut)
43164781 {
43174782 ResetModel();
....@@ -4325,7 +4790,7 @@
43254790 // return;
43264791 boolean first = true;
43274792
4328
- if (GrafreeD.clipboardIsTempGroup)
4793
+ if (Grafreed.clipboardIsTempGroup)
43294794 {
43304795 Composite temp;
43314796
....@@ -4336,7 +4801,7 @@
43364801 temp = (Composite)Applet3D.clipboard.deepCopy();
43374802 */
43384803 Object3D elem;
4339
- 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))
43404805 {
43414806 Object3D child = (Object3D)e.nextElement();
43424807
....@@ -4370,21 +4835,21 @@
43704835 //Object3D cb = Applet3D.clipboard;
43714836 //temp.addChild(cb);
43724837 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4373
- assert(GrafreeD.clipboard.parent == null);
4374
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4375
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4376
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4377
- 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());
43784843 else
4379
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4380
- GrafreeD.clipboard.get(0).parent = keepparent;
4844
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4845
+ Grafreed.clipboard.get(0).parent = keepparent;
43814846 }
43824847
43834848 ResetModel();
43844849 refreshContents();
43854850 }
43864851
4387
- void pasteInto(boolean copyit)
4852
+ void pasteInto(boolean copyit, boolean clone)
43884853 {
43894854 // if (GrafreeD.clipboard == null)
43904855 // return;
....@@ -4413,15 +4878,22 @@
44134878 if (copyit)
44144879 {
44154880 // paste(false);
4416
- CloneClipboard(false); // sept 2014
4881
+ if (clone)
4882
+ {
4883
+ CloneClipboard(false); // sept 2014
4884
+ }
4885
+ else
4886
+ {
4887
+ paste(false);
4888
+ }
44174889 }
44184890 else
44194891 {
44204892 boolean first = true;
44214893
4422
- if (GrafreeD.clipboardIsTempGroup)
4894
+ if (Grafreed.clipboardIsTempGroup)
44234895 {
4424
- Composite temp = (Composite)GrafreeD.clipboard;
4896
+ Composite temp = (Composite)Grafreed.clipboard;
44254897 Object3D copy;
44264898 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44274899 {
....@@ -4431,7 +4903,7 @@
44314903 }
44324904 } else
44334905 {
4434
- linkSomething(GrafreeD.clipboard); //.get(0));
4906
+ linkSomething(Grafreed.clipboard); //.get(0));
44354907 }
44364908 }
44374909 }
....@@ -4836,21 +5308,6 @@
48365308 }
48375309 */
48385310
4839
- void ImportGFD()
4840
- {
4841
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4842
- browser.show();
4843
- String filename = browser.getFile();
4844
- if (filename != null && filename.length() > 0)
4845
- {
4846
- String fullname = browser.getDirectory() + filename;
4847
-
4848
- //Object3D readobj =
4849
- objEditor.ReadGFD(fullname, objEditor);
4850
- //makeSomething(readobj);
4851
- }
4852
- }
4853
-
48545311 /*
48555312 public void Callback(Object obj)
48565313 {
....@@ -4874,26 +5331,9 @@
48745331 }
48755332 */
48765333
4877
- void ImportVRMLX3D()
4878
- {
4879
- if (GrafreeD.standAlone)
4880
- {
4881
- /**/
4882
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4883
- browser.show();
4884
- String filename = browser.getFile();
4885
- if (filename != null && filename.length() > 0)
4886
- {
4887
- String fullname = browser.getDirectory() + filename;
4888
- LoadVRMLX3D(fullname);
4889
- }
4890
- /**/
4891
- }
4892
- }
4893
-
48945334 String GetFile(String dialogName)
48955335 {
4896
- if (GrafreeD.standAlone)
5336
+ if (Grafreed.standAlone)
48975337 {
48985338 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48995339 browser.show();
....@@ -4957,10 +5397,33 @@
49575397 cButton flashSelectionButton;
49585398 cButton editButton;
49595399 cButton uneditButton;
5400
+ JCheckBox allParamsButton;
49605401 cButton clearpanelButton;
4961
- cButton allParamsButton;
49625402 cButton unselectButton;
49635403
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
+
49645427 cButton screenfitButton;
49655428 cButton screenfitpointButton;
49665429 cButton snapobjectButton;
....@@ -4971,14 +5434,6 @@
49715434 cButton closeButton;
49725435
49735436 cButton setsupportButton;
4974
-
4975
- cButton twoButton;
4976
- cButton sixButton;
4977
- cButton threeButton;
4978
- cButton sevenButton;
4979
- cButton fourButton; // full panel
4980
- cButton oneButton; // full XYZ
4981
- //cButton currentLayout;
49825437
49835438 //
49845439 //Composite
....@@ -4991,7 +5446,9 @@
49915446 private MenuItem lookFromItem;
49925447 private MenuItem switchItem;
49935448 private MenuItem cutItem;
4994
- private MenuItem duplicateItem;
5449
+ private MenuItem undoItem;
5450
+ private MenuItem redoItem;
5451
+ private JMenuItem duplicateItem;
49955452 private MenuItem cloneItem;
49965453 private MenuItem cloneSupportItem;
49975454 private MenuItem overwriteGeoItem;
....@@ -5004,7 +5461,7 @@
50045461 private MenuItem linkverticesItem;
50055462 private MenuItem relinkverticesItem;
50065463 private MenuItem setMasterItem;
5007
- private MenuItem resetMeshItem;
5464
+ private MenuItem resetAllItem;
50085465 private MenuItem stepAllItem;
50095466 private MenuItem revertMeshItem;
50105467 private MenuItem poseMeshItem;
....@@ -5015,6 +5472,7 @@
50155472 private MenuItem mergeGeometriesItem;
50165473 private MenuItem copyItem;
50175474 private MenuItem pasteItem;
5475
+ private MenuItem pasteIntoItem;
50185476 private MenuItem pasteLinkItem;
50195477 private MenuItem pasteCloneItem;
50205478 private MenuItem pasteExpandItem;
....@@ -5053,6 +5511,10 @@
50535511 private MenuItem showleavesItem;
50545512 private MenuItem markleavesItem;
50555513 private MenuItem unmarkleavesItem;
5514
+ private MenuItem rewindleavesItem;
5515
+ private MenuItem unrewindleavesItem;
5516
+ private MenuItem randomleavesItem;
5517
+ private MenuItem unrandomleavesItem;
50565518
50575519 private MenuItem flipVItem;
50585520 private MenuItem unflipVItem;
....@@ -5064,8 +5526,10 @@
50645526 private MenuItem panoTexturesItem;
50655527
50665528 private MenuItem resetCentroidItem;
5067
- private MenuItem transformgeometryItem;
5529
+ private MenuItem resetCentroidXZItem;
50685530 private MenuItem resetTransformItem;
5531
+ private MenuItem transformGeometryItem;
5532
+ private MenuItem transformChildrenItem;
50695533 private MenuItem hideItem;
50705534 private MenuItem grabItem;
50715535 private MenuItem backItem;
....@@ -5112,7 +5576,7 @@
51125576 private MenuItem blobItem;
51135577 private MenuItem latheItem;
51145578 private MenuItem bezierItem;
5115
- private MenuItem checkerItem;
5579
+ private MenuItem overlayItem;
51165580 private MenuItem meshItem;
51175581 // private MenuItem meshGroupItem;
51185582 private MenuItem springItem;
....@@ -5134,11 +5598,6 @@
51345598 private MenuItem doubleItem;
51355599 private MenuItem tripleItem;
51365600
5137
- private MenuItem importGFDItem;
5138
- private MenuItem importVRMLX3DItem;
5139
- private MenuItem import3DSItem;
5140
- private MenuItem importOBJItem;
5141
-
51425601 private MenuItem computeAOItem;
51435602 private MenuItem recompileItem;
51445603 private MenuItem editScriptItem;
....@@ -5148,4 +5607,8 @@
51485607 private MenuItem analyzeItem;
51495608 private MenuItem dumpItem;
51505609 //boolean freezemodel = false;
5610
+
5611
+ Menu cameraMenu;
5612
+ MenuItem editCameraItem;
5613
+ MenuItem revertCameraItem;
51515614 }