Normand Briere
2019-07-19 e79247ef52a0bbb3864d46bb1e2c716005b3ecf3
GroupEditor.java
....@@ -12,9 +12,10 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
17
-class GroupEditor extends ObjEditor implements iParse, //iCallBack,
18
+class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
1819 ObjectUI,
1920 Runnable,
2021 ActionListener,
....@@ -59,6 +60,12 @@
5960 this.copy = this.group = group;
6061 //selectees = this.group.selectees;
6162
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6269 if(ui)
6370 SetupUI(objEditor);
6471 }
....@@ -73,7 +80,13 @@
7380 this.copy = this.group = copy;
7481 //selectees = this.group.selectees;
7582
76
- SetupMenu2(objEditor);
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
89
+ SetupMenu2(this); //objEditor);
7790 SetupUI2(objEditor);
7891 objEditor.SetupUI(true);
7992 SetupViews(objEditor);
....@@ -83,7 +96,11 @@
8396
8497 void CloneSelection(boolean supports)
8598 {
86
- // Object3D keep = GraphreeD.clipboard;
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
103
+ // Object3D keep = GrafreeD.clipboard;
87104 //Object3D obj;
88105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
89106 {
....@@ -93,18 +110,19 @@
93110
94111 makeSomething(clone, i==group.selection.size()-1);
95112 }
113
+ Globals.REPLACEONMAKE = keep;
96114 }
97115
98116 void CloneClipboard(boolean supports)
99117 {
100
- assert(GraphreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
102
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GraphreeD.clipboard.get(0), false));
118
+ assert(Grafreed.clipboard.parent == null);
119
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
120
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
121
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
122
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105123 else
106
- makeSomething(CloneObject(GraphreeD.clipboard, false));
107
- GraphreeD.clipboard.get(0).parent = keepparent;
124
+ makeSomething(CloneObject(Grafreed.clipboard, false));
125
+ Grafreed.clipboard.get(0).parent = keepparent;
108126 }
109127
110128 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +136,7 @@
118136 // obj.support = null;
119137 if (!supports)
120138 obj.SaveSupports();
121
- Object3D clone = (Object3D)GraphreeD.clone(obj);
139
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122140 obj.parent = parent;
123141 // obj.support = support;
124142 // clone.support = support; // aout 2013
....@@ -147,30 +165,29 @@
147165
148166 //JTextField nameField;
149167
150
- void SetupMenu2(ObjEditor oe)
168
+ void SetupMenu2(GroupEditor oe)
151169 {
152
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
155
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
156
- oe.cameraMenu.add("-");
157
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
158
- openWindowItem.addActionListener(this);
159
- editLeafItem.addActionListener(this);
160
- lookAtItem.addActionListener(this);
161
- //lookFromItem.addActinoListener(this);
162
- //switchItem.addActionListener(this);
170
+ oe.jTree = new cTree();
171
+
163172 Menu menu;
164173 oe.menuBar.add(menu = new Menu("Edit"));
165174 //editItem = menu.add(new MenuItem("Edit"));
166175 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
176
+
177
+// undoItem = menu.add(new MenuItem("Undo"));
178
+// undoItem.addActionListener(this);
179
+// redoItem = menu.add(new MenuItem("Redo"));
180
+// redoItem.addActionListener(this);
181
+// menu.add("-");
182
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168183 duplicateItem.addActionListener(this);
169
- menu.add("-");
170184 cloneItem = menu.add(new MenuItem("Clone"));
171185 cloneItem.addActionListener(this);
186
+ if (Globals.ADVANCED)
187
+ {
172188 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173189 cloneSupportItem.addActionListener(this);
190
+ }
174191 menu.add("-");
175192 cutItem = menu.add(new MenuItem("Cut"));
176193 cutItem.addActionListener(this);
....@@ -178,26 +195,123 @@
178195 copyItem.addActionListener(this);
179196 pasteItem = menu.add(new MenuItem("Paste"));
180197 pasteItem.addActionListener(this);
198
+
199
+ menu.add("-");
200
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
201
+ pasteIntoItem.addActionListener(this);
181202 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182203 pasteLinkItem.addActionListener(this);
183204 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184205 pasteCloneItem.addActionListener(this);
185206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186207 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
208
+ menu.add("-");
209
+ deleteItem = menu.add(new MenuItem("Delete"));
210
+ deleteItem.addActionListener(this);
211
+
212
+ if (Globals.ADVANCED)
213
+ {
214
+ // Deletes the cameras...
189215 clearAllItem = menu.add(new MenuItem("Clear All"));
190216 clearAllItem.addActionListener(this);
191
- menu.add("-");
192
- resetMeshItem = menu.add(new MenuItem("Reset All"));
193
- resetMeshItem.addActionListener(this);
194
- stepAllItem = menu.add(new MenuItem("Step All"));
195
- stepAllItem.addActionListener(this);
217
+ }
218
+
219
+ menuBar.add(cameraMenu = new Menu("View"));
220
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
221
+ //zBufferItem.addActionListener(this);
222
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
223
+ //normalLensItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
226
+
227
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
228
+// toggleFullScreenItem.addItemListener(this);
229
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
230
+// cameraMenu.add("-");
231
+//
232
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
233
+// toggleTextureItem.addItemListener(this);
234
+// toggleTextureItem.setState(CameraPane.textureon);
235
+//
236
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
237
+// toggleSwitchItem.addItemListener(this);
238
+// toggleSwitchItem.setState(CameraPane.SWITCH);
239
+
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
241
+ toggleHandleItem.addItemListener(this);
242
+ toggleHandleItem.setState(CameraPane.HANDLES);
243
+
244
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
245
+ togglePaintItem.addItemListener(this);
246
+ togglePaintItem.setState(CameraPane.PAINTMODE);
247
+
248
+ if (Globals.ADVANCED)
249
+ {
250
+ cameraMenu.add("-");
251
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
252
+ toggleLiveItem.addItemListener(this);
253
+ toggleLiveItem.setState(Globals.isLIVE());
254
+
255
+ cameraMenu.add(stepItem = new MenuItem("Step"));
256
+ stepItem.addActionListener(this);
257
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
258
+ // toggleDLItem.addItemListener(this);
259
+ // toggleDLItem.setState(false);
260
+
261
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
262
+ toggleRenderItem.addItemListener(this);
263
+ toggleRenderItem.setState(!CameraPane.frozen);
264
+
265
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
266
+ toggleDebugItem.addItemListener(this);
267
+ toggleDebugItem.setState(Globals.DEBUG);
268
+
269
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
270
+ toggleFrustumItem.addItemListener(this);
271
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
272
+
273
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
274
+ toggleFootContactItem.addItemListener(this);
275
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
276
+
277
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
278
+ toggleTimelineItem.addItemListener(this);
279
+ }
280
+
281
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
282
+// toggleRootItem.addItemListener(this);
283
+// toggleRootItem.setState(false);
284
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
285
+// animationItem.addItemListener(this);
286
+// animationItem.setState(CameraPane.ANIMATION);
287
+ cameraMenu.add("-");
288
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
289
+ editCameraItem.addActionListener(this);
290
+
291
+ if (Globals.ADVANCED)
292
+ {
293
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
294
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
296
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
297
+ oe.cameraMenu.add("-");
298
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
299
+ openWindowItem.addActionListener(this);
300
+ editLeafItem.addActionListener(this);
301
+ lookAtItem.addActionListener(this);
302
+ //lookFromItem.addActinoListener(this);
303
+ //switchViewItem.addActionListener(this);
304
+ }
305
+
306
+ oe.menuBar.add(menu = new Menu("Setting"));
307
+ if (Globals.ADVANCED)
308
+ {
196309 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
197310 revertMeshItem.addActionListener(this);
198311 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
199312 resetreferencesItem.addActionListener(this);
200313 menu.add("-");
314
+ }
201315 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
202316 overwriteGeoItem.addActionListener(this);
203317 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -209,72 +323,104 @@
209323 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
210324 overwriteUVItem.addActionListener(this);
211325 menu.add("-");
326
+ if (Globals.ADVANCED)
327
+ {
212328 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
213329 generateMeshItem.addActionListener(this);
214330 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
215331 poseMeshItem.addActionListener(this);
216332 menu.add("-");
333
+ }
217334 resetsupportItem = menu.add(new MenuItem("Reset support"));
218335 resetsupportItem.addActionListener(this);
219336 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220337 linkverticesItem.addActionListener(this);
338
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
339
+ relinkverticesItem.addActionListener(this);
340
+
341
+ if (Globals.ADVANCED)
342
+ {
221343 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222344 setMasterItem.addActionListener(this);
345
+ }
223346
224
- oe.menuBar.add(menu = new Menu("Object"));
225
- grabItem = menu.add(new MenuItem("Grab"));
226
- grabItem.addActionListener(this);
227
- frontItem = menu.add(new MenuItem("Front"));
228
- frontItem.addActionListener(this);
347
+ oe.menuBar.add(menu = new Menu("Group"));
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
229350 backItem = menu.add(new MenuItem("Back"));
230351 backItem.addActionListener(this);
231
- compositeItem = menu.add(new MenuItem("Composite"));
232
- compositeItem.addActionListener(this);
233
- menu.add("-");
234
- randomItem = menu.add(new MenuItem("Random"));
235
- randomItem.addActionListener(this);
236
- physicsItem = menu.add(new MenuItem("Physics"));
237
- physicsItem.addActionListener(this);
238
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
239
- frameselectorItem.addActionListener(this);
352
+ frontItem = menu.add(new MenuItem("Front"));
353
+ frontItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
359
+ hideItem = menu.add(new MenuItem("Hidden Group"));
360
+ hideItem.addActionListener(this);
361
+ }
362
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
363
+ ungroupItem.addActionListener(this);
364
+
365
+// menu.add("-");
366
+//
367
+// switchItem = menu.add(new MenuItem("Switch node"));
368
+// switchItem.addActionListener(this);
369
+ if (Globals.ADVANCED)
370
+ {
240371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
241372 switchGeoItem.addActionListener(this);
242373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
243374 switchTransfoItem.addActionListener(this);
244
- morphItem = menu.add(new MenuItem("Morph"));
375
+ morphItem = menu.add(new MenuItem("Morph Group"));
245376 morphItem.addActionListener(this);
377
+
378
+ menu.add("-");
379
+ physicsItem = menu.add(new MenuItem("Physics"));
380
+ physicsItem.addActionListener(this);
381
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
382
+ frameselectorItem.addActionListener(this);
246383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
247384 scriptNodeItem.addActionListener(this);
248
- cameraItem = menu.add(new MenuItem("Camera"));
249
- cameraItem.addActionListener(this);
250
- menu.add("-");
251
- textureItem = menu.add(new MenuItem("Texture"));
252
- textureItem.addActionListener(this);
385
+ }
386
+
387
+ oe.menuBar.add(menu = new Menu("Object"));
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
390
+ billboardItem = menu.add(new MenuItem("Billboard"));
391
+ billboardItem.addActionListener(this);
253392 csgItem = menu.add(new MenuItem("CSG"));
254393 csgItem.addActionListener(this);
255
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
256395 shadowXItem.addActionListener(this);
257
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
258397 shadowYItem.addActionListener(this);
259
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
260399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
403
+ if (Globals.ADVANCED)
404
+ {
405
+ menu.add("-");
261406 linkerItem = menu.add(new MenuItem("Linker"));
262407 linkerItem.addActionListener(this);
263408 templateItem = menu.add(new MenuItem("Template"));
264409 templateItem.addActionListener(this);
265
- attributeItem = menu.add(new MenuItem("Attribute"));
266
- attributeItem.addActionListener(this);
267410 pointflowItem = menu.add(new MenuItem("Point Flow"));
268411 pointflowItem.addActionListener(this);
412
+ }
269413 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272414 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273415 resetTransformItem.addActionListener(this);
274416 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275417 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
418
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
419
+ resetCentroidXZItem.addActionListener(this);
420
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
421
+ transformGeometryItem.addActionListener(this);
422
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
423
+ transformChildrenItem.addActionListener(this);
278424
279425 oe.menuBar.add(menu = new Menu("Geometry"));
280426 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +429,13 @@
283429 genNormalsORGANItem.addActionListener(this);
284430 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285431 genNormalsCADItem.addActionListener(this);
432
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
433
+ genNormalsMESHItem.addActionListener(this);
434
+ if (Globals.ADVANCED)
435
+ {
436
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
437
+ genNormalsMINEItem.addActionListener(this);
438
+ }
286439 stripifyItem = menu.add(new MenuItem("Stripify"));
287440 stripifyItem.addActionListener(this);
288441 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +445,6 @@
292445 untrimItem = menu.add(new MenuItem("Untrim"));
293446 untrimItem.addActionListener(this);
294447 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297448 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298449 clearColorsItem.addActionListener(this);
299450 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -306,19 +457,34 @@
306457 reduce34MeshItem.addActionListener(this);
307458 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308459 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311460 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312461 clipMeshItem.addActionListener(this);
462
+
463
+ if (Globals.ADVANCED)
464
+ {
465
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
466
+ smoothMeshItem.addActionListener(this);
467
+ }
468
+
469
+ oe.menuBar.add(menu = new Menu("Attributes"));
470
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
471
+ clearMaterialsItem.addActionListener(this);
472
+ resetAllItem = menu.add(new MenuItem("Reset All"));
473
+ resetAllItem.addActionListener(this);
474
+ stepAllItem = menu.add(new MenuItem("Step All"));
475
+ stepAllItem.addActionListener(this);
313476 menu.add("-");
314477 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315478 liveleavesItem.addActionListener(this);
316479 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
317480 unliveleavesItem.addActionListener(this);
481
+ if (Globals.ADVANCED)
482
+ {
318483 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
319484 supportleavesItem.addActionListener(this);
320485 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
321486 unsupportleavesItem.addActionListener(this);
487
+ }
322488 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
323489 hideleavesItem.addActionListener(this);
324490 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -327,32 +493,31 @@
327493 markleavesItem.addActionListener(this);
328494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
329495 unmarkleavesItem.addActionListener(this);
496
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
497
+ rewindleavesItem.addActionListener(this);
498
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
499
+ unrewindleavesItem.addActionListener(this);
500
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
501
+ randomleavesItem.addActionListener(this);
502
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
503
+ unrandomleavesItem.addActionListener(this);
330504 menu.add("-");
331505 flipVItem = menu.add(new MenuItem("Flip V"));
332506 flipVItem.addActionListener(this);
333507 unflipVItem = menu.add(new MenuItem("Unflip V"));
334508 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
509
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336510 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
511
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338512 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
513
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340514 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
515
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342516 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
517
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344518 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
519
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346520 panoTexturesItem.addActionListener(this);
347
- menu.add("-");
348
- extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
349
- extractGeometriesItem.addActionListener(this);
350
- cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
351
- cloneGeometriesItem.addActionListener(this);
352
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
353
- shareGeometriesItem.addActionListener(this);
354
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
355
- mergeGeometriesItem.addActionListener(this);
356521
357522 oe.menuBar.add(menu = new Menu("Selection"));
358523 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -370,14 +535,42 @@
370535 sortbysizeItem.addActionListener(this);
371536 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372537 sortbynameItem.addActionListener(this);
538
+ menu.add("-");
539
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
540
+ shareGeometriesItem.addActionListener(this);
541
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
542
+ mergeGeometriesItem.addActionListener(this);
543
+ if (Globals.ADVANCED)
544
+ {
545
+ // Pretty much the same as duplicate and clone.
546
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
547
+ extractGeometriesItem.addActionListener(this);
548
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
549
+ cloneGeometriesItem.addActionListener(this);
550
+ }
551
+
373552 oe.menuBar.add(menu = new Menu("Insert"));
374553 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
554
+
555
+ oe.menuBar.add(menu = new Menu("Tools"));
376556 buildToolsMenu(menu);
377557 }
378558
559
+
379560 void SetupUI2(ObjEditor oe)
380561 {
562
+ // June 2019
563
+ if (oe == null)
564
+ {
565
+ //super.SetupUI2(this);
566
+ //return;
567
+ }
568
+
569
+ if (copy != group)
570
+ {
571
+ //super.SetupUI2(this);
572
+ }
573
+
381574 //new Exception().printStackTrace();
382575
383576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -406,150 +599,231 @@
406599 oe.radioPanel.add(dummyButton);
407600 oe.buttonGroup.add(dummyButton);
408601 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
412605
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
606
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
607
+
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
611
+
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
618
+
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ fullButton.setToolTipText("Full-screen window");
621
+ fullButton.addActionListener(this);
622
+
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ screenfitButton.setToolTipText("Screen fit");
625
+ screenfitButton.addActionListener(this);
626
+
627
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ restoreCameraButton.setToolTipText("Restore viewpoint");
629
+ restoreCameraButton.addActionListener(this);
630
+
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
633
+ saveButton.addActionListener(this);
634
+
635
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ undoButton.setToolTipText("Previous version");
637
+ undoButton.addActionListener(this);
638
+ undoButton.setEnabled(false);
639
+
640
+ cGridBag updown = new cGridBag().setVertical(true);
641
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ restoreButton.setToolTipText("Restore current");
643
+ restoreButton.addActionListener(this);
644
+ restoreButton.setEnabled(false);
645
+
646
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ replaceButton.setToolTipText("Replace current");
648
+ replaceButton.addActionListener(this);
649
+ replaceButton.setEnabled(false);
650
+
651
+ copyOptionsPanel.add(updown);
652
+
653
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ redoButton.setToolTipText("Next version");
655
+ redoButton.addActionListener(this);
656
+ redoButton.setEnabled(false);
657
+
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
659
+ liveCB.setToolTipText("Enable animation");
414660 liveCB.addItemListener(this);
415661
416
- oe.aConstraints.gridx += 1;
417
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
418
- supportCB.addItemListener(this);
419
-
420
- // oe.aConstraints.gridx += 1;
421
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
422
- // localCB.addItemListener(this);
423
-
424
- oe.aConstraints.gridx += 1;
425
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
426
- crowdCB.addItemListener(this);
427
-
428
- oe.aConstraints.gridx += 1;
429
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
430
- smoothCB.addItemListener(this);
431
-
432
- oe.aConstraints.gridx += 1;
433
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
+ oneStepButton.setToolTipText("Animate one step forward");
664
+ oneStepButton.addActionListener(this);
665
+
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
667
+ fastCB.setToolTipText("Fast mode");
434668 fastCB.addItemListener(this);
435
- oe.aConstraints.gridx += 1;
436
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
437
- slowCB.addItemListener(this);
438
- oe.aConstraints.gridx += 1;
439
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
440
- boxCB.addItemListener(this);
669
+
670
+ //oe.toolboxPanel.Return();
671
+
672
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
673
+// trackCB.setToolTipText("Enable tracking");
674
+// trackCB.addItemListener(this);
441675
442
-// oe.aConstraints.gridx += 1;
443
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
444
-// speakerMocapCB.addItemListener(this);
445
-
446
- if (false)
447
- {
448
- // handled in scripts
449
- oe.aConstraints.gridx += 1;
450
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
451
- speakerCameraCB.addItemListener(this);
452
-
453
- oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
455
- speakerFocusCB.addItemListener(this);
456
-
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
459
- smoothfocusCB.addItemListener(this);
460
- }
461
-
462
-//oe.aConstraints.gridx += 1;
463
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
464
-// debugCB.addItemListener(this);
465
-
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
468
- oeilCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
472
- lookAtCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
476
- trackCB.addItemListener(this);
477
-
478
- oe.aConstraints.gridx += 1;
479
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
480
- screenfitButton.addActionListener(this);
481
- oe.aConstraints.gridx += 1;
482676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
483677 // screenfitpointButton.addActionListener(this);
484
-// oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
486
- snapobjectButton.addActionListener(this);
487
- oe.aConstraints.gridx += 1;
488678
489
- //aConstraints.gridx = 0;
490
- //aConstraints.gridy += 1;
491
- oe.aConstraints.weighty = 0;
492
- oe.aConstraints.gridwidth = 1;
493
-
494
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
495
- flashSelectionButton.addActionListener(this);
496
- oe.aConstraints.gridx += 1;
497
- oe.aConstraints.weighty = 0;
498
- oe.aConstraints.gridwidth = 1;
679
+ if (Globals.ADVANCED)
680
+ {
681
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ snapobjectButton.addActionListener(this);
683
+ snapobjectButton.setToolTipText("Snap Object");
684
+ }
685
+
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
499687
500
- //
501
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
502
- twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504689 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
690
+ fourButton.setToolTipText("Show left panel only");
691
+
692
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ twoButton.setToolTipText("Show right view only");
694
+ twoButton.addActionListener(this);
695
+ this.fullscreenLayout = twoButton;
696
+
697
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
+ sixButton.setToolTipText("Show left and right");
506699 sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
508
- threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
510
- sevenButton.addActionListener(this);
700
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+// threeButton.setToolTipText("2-column layout right");
702
+// threeButton.addActionListener(this);
703
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+// sevenButton.setToolTipText("3-column layout");
705
+// sevenButton.addActionListener(this);
511706 //
512707
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
708
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ rootButton.setToolTipText("Open selection in new tab");
514710 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
711
+
712
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ closeButton.setToolTipText("Close tab");
517714 closeButton.addActionListener(this);
518715 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
519716 //clearButton.addActionListener(this);
520
- oe.aConstraints.gridx += 1;
521
-
522
- oe.aConstraints.gridx = 1; //
523
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
524
- editButton.addActionListener(this);
525
- oe.aConstraints.gridx += 1;
526
- oe.aConstraints.weighty = 0;
527
- oe.aConstraints.gridwidth = 1;
528717
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
718
+ // INSERT
719
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
720
+ gridButton.setToolTipText("Create grid");
721
+ gridButton.addActionListener(this);
722
+
723
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ boxButton.setToolTipText("Create box");
725
+ boxButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
728
+ sphereButton.setToolTipText("Create sphere");
729
+ sphereButton.addActionListener(this);
730
+
731
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
732
+ coneButton.setToolTipText("Create cone");
733
+ coneButton.addActionListener(this);
734
+
735
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+ torusButton.setToolTipText("Create torus");
737
+ torusButton.addActionListener(this);
738
+
739
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
740
+ superButton.setToolTipText("Create superellipsoid");
741
+ superButton.addActionListener(this);
742
+
743
+ if (Globals.ADVANCED)
744
+ {
745
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ kleinButton.setToolTipText("Create Klein bottle");
747
+ kleinButton.addActionListener(this);
748
+ }
749
+
750
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
751
+ particlesButton.setToolTipText("Create particle system");
752
+ particlesButton.addActionListener(this);
753
+
754
+ oe.toolboxPanel.Return();
755
+
756
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
757
+ groupButton.setToolTipText("Create group");
758
+ groupButton.addActionListener(this);
759
+
760
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
761
+ compositeButton.setToolTipText("Create composite");
762
+ compositeButton.addActionListener(this);
763
+
764
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ switchButton.setToolTipText("Create item switcher");
766
+ switchButton.addActionListener(this);
767
+
768
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ loopButton.setToolTipText("Create loop");
770
+ loopButton.addActionListener(this);
771
+
772
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ textureButton.setToolTipText("Create texture");
774
+ textureButton.addActionListener(this);
775
+
776
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ overlayButton.setToolTipText("Create overlay");
778
+ overlayButton.addActionListener(this);
779
+
780
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
+ lightButton.setToolTipText("Create light");
782
+ lightButton.addActionListener(this);
783
+
784
+ for (int i=6; --i>=0;)
785
+ {
786
+ oe.toolboxPanel.Return();
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ oe.toolboxPanel.add(new cGridBag());
794
+ }
795
+
796
+ // EDIT panel
797
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
798
+ editButton.setToolTipText("Pin selection controls");
799
+ editButton.addActionListener(this);
800
+
801
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
802
+ uneditButton.setToolTipText("Remove selection controls");
530803 uneditButton.addActionListener(this);
531804
532
- oe.aConstraints.gridx += 1;
533
- oe.aConstraints.weighty = 0;
534
- oe.aConstraints.gridwidth = 1;
535
-
536
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
537
- clearPanelButton.addActionListener(this);
538
-
539
- oe.aConstraints.gridx += 1;
540
- oe.aConstraints.weighty = 0;
541
- oe.aConstraints.gridwidth = 1;
542
-
543
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
805
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
806
+ allParamsButton.setToolTipText("Show all controle");
544807 allParamsButton.addActionListener(this);
545808
546
- oe.aConstraints.gridx += 1;
547
- oe.aConstraints.weighty = 0;
548
- oe.aConstraints.gridwidth = 1;
549
-
550
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
809
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
810
+ clearPanelButton.setToolTipText("Clear edit panel");
811
+ clearPanelButton.addActionListener(this);
812
+
813
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
814
+ unselectButton.setToolTipText("Unselect");
551815 unselectButton.addActionListener(this);
552816
817
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
818
+ flashSelectionButton.setToolTipText("Highlight selection");
819
+ flashSelectionButton.addActionListener(this);
820
+
821
+ editCommandsPanel.preferredHeight = 1;
822
+
823
+ SetPinStates(false);
824
+// oe.treePanel.add(commandsPanel);
825
+// oe.treePanel.Return();
826
+
553827 // oe.aConstraints.gridx += 1;
554828 // oe.aConstraints.weighty = 0;
555829 // oe.aConstraints.gridwidth = 1;
....@@ -561,40 +835,25 @@
561835 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
562836 // gcButton.addActionListener(this);
563837
564
- oe.aConstraints.gridx = 0;
565
- oe.aConstraints.gridy += 1;
566
-
567
- //ctrlPanel.add(objList = new List(5, true));
568
- oe.aConstraints.gridwidth = 100;
569
- // oe.aConstraints.gridheight = 100;
570
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
571
- oe.aConstraints.gridheight = 1;
572
- oe.aConstraints.weighty = 0.5;
573
- oe.aConstraints.gridx = 0;
574
- JScrollPane jSP;
838
+ cGridBag jSPPanel = new cGridBag();
839
+
840
+ JScrollPane jSP;
575841 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
576
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
842
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
577843 ResetModel();
578
- oe.aConstraints.weighty = 0.5;
579
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
580
- oe.aConstraints.gridy += 1;
581
- oe.aConstraints.gridwidth = 1;
582
-
583
- oe.aConstraints.weighty = 0;
584
- oe.aConstraints.gridwidth = 2;
585
-
586
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
587
- colorCB.addItemListener(this);
588
- oe.aConstraints.gridx += 2;
589
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
590
- materialCB.addItemListener(this);
591
- oe.aConstraints.gridx += 2;
592
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
593
- textureCB.addItemListener(this);
594
-
595
- oe.aConstraints.gridx = 0;
596
- oe.aConstraints.gridy += 1;
597844
845
+ oe.treePanel.add(jSPPanel);
846
+ oe.treePanel.Return();
847
+
848
+ oe.treePanel.add(copyOptionsPanel);
849
+ oe.treePanel.Return();
850
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
851
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852
+ sliderPane.preferredHeight = 1;
853
+
854
+// mainPanel.setDividerLocation(0.5); //1.0);
855
+// mainPanel.setResizeWeight(0.5);
856
+
598857 //jList.addListSelectionListener(this);
599858 oe.jTree.addTreeSelectionListener(this);
600859 //jTree.setRootVisible(false);
....@@ -613,23 +872,160 @@
613872 dgr.addDragGestureListener(this);
614873 }catch(Exception e) {}
615874 */
616
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
617876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
618877 }
878
+
879
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
880
+ {
881
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
882
+ colorCB.setToolTipText("Copy color when dropped");
883
+ colorCB.addItemListener(this);
884
+
885
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
886
+ materialCB.setToolTipText("Copy material when dropped");
887
+ materialCB.addItemListener(this);
888
+
889
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
890
+ textureCB.setToolTipText("Copy texture when dropped");
891
+ textureCB.addItemListener(this);
892
+
893
+ panel.Return();
894
+
895
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
896
+ boxCB.setToolTipText("Display bounding boxes");
897
+ boxCB.addItemListener(this);
898
+
899
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
900
+ zoomBoxCB.setToolTipText("Display only for wheel");
901
+ zoomBoxCB.addItemListener(this);
902
+
903
+ if (true) // Globals.ADVANCED)
904
+ {
905
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
906
+// supportCB.setToolTipText("Enable rigging");
907
+// supportCB.addItemListener(this);
908
+
909
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
910
+ freezeCB.setToolTipText("Fast moving camera");
911
+ freezeCB.addItemListener(this);
912
+
913
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
914
+ // localCB.addItemListener(this);
915
+
916
+ panel.Return();
917
+
918
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
919
+ crowdCB.setToolTipText("Used for crowds");
920
+ crowdCB.addItemListener(this);
921
+
922
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
923
+ smoothCB.setToolTipText("Snapping delay");
924
+ smoothCB.addItemListener(this);
925
+
926
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
927
+ slowCB.setToolTipText("Smooth interpolation");
928
+ slowCB.addItemListener(this);
929
+
930
+// constraints.gridy += 1;
931
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
932
+// speakerMocapCB.addItemListener(this);
933
+
934
+ panel.Return();
935
+
936
+ if (false)
937
+ {
938
+ // handled in scripts
939
+ //constraints.gridy += 1;
940
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
941
+ speakerCameraCB.addItemListener(this);
942
+
943
+ //constraints.gridy += 1;
944
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
945
+ speakerFocusCB.addItemListener(this);
946
+
947
+ //constraints.gridy += 1;
948
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
949
+ smoothfocusCB.addItemListener(this);
950
+ panel.Return();
951
+ }
952
+
953
+//constraints.gridx += 1;
954
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
955
+// debugCB.addItemListener(this);
956
+
957
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
958
+ trackCB.setToolTipText("Enable tracking target");
959
+ trackCB.addItemListener(this);
960
+
961
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
962
+ oeilCB.setToolTipText("Move camera when tracking");
963
+ oeilCB.addItemListener(this);
964
+
965
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
966
+ shadowCB.setToolTipText("When live compute shadows");
967
+ shadowCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
971
+ toggleTextureCB.setToolTipText("Load textures");
972
+ toggleTextureCB.addItemListener(this);
973
+
974
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
975
+ toggleSwitchCB.setToolTipText("Choose a single item");
976
+ toggleSwitchCB.addItemListener(this);
977
+
978
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
979
+ autokeepCB.setToolTipText("On structure change");
980
+ autokeepCB.addItemListener(this);
981
+
982
+ panel.Return();
983
+ if (Globals.ADVANCED)
984
+ {
985
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
986
+ lookAtCB.setToolTipText("Look-at target");
987
+ lookAtCB.addItemListener(this);
988
+ }
989
+
990
+ }
991
+
992
+ cGridBag fill = new cGridBag();
993
+ fill.preferredHeight = 200;
994
+ cGridBag fill2 = new cGridBag();
995
+ fill2.preferredHeight = 200;
996
+ cGridBag fill3 = new cGridBag();
997
+ fill3.preferredHeight = 200;
998
+
999
+ panel.add(fill);
1000
+ panel.add(fill2);
1001
+ panel.add(fill3);
1002
+
1003
+ }
6191004
6201005 void EditObject(Object3D obj)
6211006 {
622
- cRadio dummyButton = new cRadio(obj.name);
623
- dummyButton.SetObject(obj);
624
- dummyButton.layout = sevenButton;
625
- dummyButton.SetCamera(cameraView.renderCamera, false);
626
- dummyButton.addActionListener(this);
627
- radioPanel.add(dummyButton);
628
- buttonGroup.add(dummyButton);
629
- dummyButton.doClick();
1007
+ cRadio radioButton = new cRadio(obj.name);
1008
+
1009
+ // June 2019. Patch to avoid bug with transparency.
1010
+ radioButton.hadMaterial = obj.material != null;
1011
+ if (!radioButton.hadMaterial)
1012
+ {
1013
+ obj.material = new cMaterial();
1014
+ }
1015
+
1016
+ radioButton.SetObject(obj);
1017
+ radioButton.layout = sixButton; // sevenButton;
1018
+ radioButton.SetCamera(cameraView.renderCamera, false);
1019
+ radioButton.addActionListener(this);
1020
+ radioPanel.add(radioButton);
1021
+ buttonGroup.add(radioButton);
1022
+ radioButton.doClick();
6301023 }
1024
+
6311025 void SetupViews(ObjEditor oe)
6321026 {
1027
+ theFrame = this;
1028
+
6331029 oe.SetupViews();
6341030
6351031 System.out.println("SetupViews");
....@@ -638,22 +1034,28 @@
6381034 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6391035 }
6401036
641
- JCheckBox liveCB;
642
- JCheckBox supportCB;
643
- JCheckBox localCB;
644
- JCheckBox crowdCB;
645
- JCheckBox smoothCB;
646
- JCheckBox fastCB;
647
- JCheckBox slowCB;
648
- JCheckBox boxCB;
649
- JCheckBox trackCB;
650
- JCheckBox smoothfocusCB;
1037
+ cToggleButton liveCB;
1038
+ cCheckBox supportCB;
1039
+ cCheckBox localCB;
1040
+ cCheckBox crowdCB;
1041
+ cCheckBox smoothCB;
1042
+ cToggleButton fastCB;
1043
+ cCheckBox slowCB;
1044
+ cCheckBox boxCB;
1045
+ cCheckBox zoomBoxCB;
1046
+ cCheckBox freezeCB;
1047
+ //cToggleButton trackCB;
1048
+ cCheckBox trackCB;
1049
+ cCheckBox smoothfocusCB;
6511050 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
1051
+ cCheckBox speakerCameraCB;
1052
+ cCheckBox speakerFocusCB;
1053
+ cCheckBox debugCB;
1054
+
1055
+ cCheckBox oeilCB;
1056
+ cCheckBox shadowCB;
1057
+ cCheckBox autokeepCB;
1058
+ cCheckBox lookAtCB;
6571059
6581060 // static int COLOR = 1;
6591061 // static int MATERIAL = 2;
....@@ -661,9 +1063,9 @@
6611063
6621064 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6631065
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
1066
+ cCheckBox colorCB;
1067
+ cCheckBox materialCB;
1068
+ cCheckBox textureCB;
6671069
6681070 public void itemStateChanged(ItemEvent e)
6691071 {
....@@ -688,10 +1090,10 @@
6881090 dropAttributes |= Object3D.TEXTURE;
6891091 else
6901092 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
1093
+ } else if(e.getSource() == liveCB)
6931094 {
6941095 cameraView.ToggleLive();
1096
+ refreshContents(false);
6951097 }
6961098 else if(e.getSource() == supportCB)
6971099 {
....@@ -727,6 +1129,10 @@
7271129 cameraView.repaint();
7281130 // refreshContents();
7291131 }
1132
+ else if(e.getSource() == zoomBoxCB)
1133
+ {
1134
+ cameraView.ToggleZoomBoxMode();
1135
+ }
7301136 else if(e.getSource() == smoothfocusCB)
7311137 {
7321138 cameraView.ToggleSmoothFocus();
....@@ -752,6 +1158,18 @@
7521158 {
7531159 cameraView.ToggleOeil();
7541160 }
1161
+ else if(e.getSource() == shadowCB)
1162
+ {
1163
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1164
+ }
1165
+ else if(e.getSource() == freezeCB)
1166
+ {
1167
+ Globals.FREEZEONMOVE ^= true;
1168
+ }
1169
+ else if(e.getSource() == autokeepCB)
1170
+ {
1171
+ Globals.REPLACEONMAKE ^= true;
1172
+ }
7551173 else if(e.getSource() == lookAtCB)
7561174 {
7571175 cameraView.ToggleLookAt();
....@@ -768,7 +1186,8 @@
7681186
7691187 /**/
7701188 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
771
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1190
+ TreePath path = objEditor.jTree.getSelectionPath();
7721191 if ((path == null) || (path.getPathCount() <= 1)) {
7731192 // We can't move the root node or an empty selection
7741193 return;
....@@ -831,8 +1250,6 @@
8311250 }
8321251 }
8331252
834
- String string = (String) object;
835
-
8361253 System.out.println("Transfer = " + object + "; drop : " + target);
8371254 // if( object instanceof java.io.File[])
8381255 // {
....@@ -840,7 +1257,11 @@
8401257 // objEditor.DropFile((java.io.File[]) object, true);
8411258 // return;
8421259 // }
843
- if (string.charAt(0) == '/')
1260
+
1261
+ String string = object.toString();
1262
+
1263
+ // File path for Mac and Windows
1264
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441265 {
8451266 // file(s)
8461267 String[] names = string.split("\n");
....@@ -867,7 +1288,7 @@
8671288
8681289 flashIt = false;
8691290 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1291
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711292 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721293
8731294 if (group.selection.size() == 1)
....@@ -883,23 +1304,33 @@
8831304
8841305 assert target == objEditor.jTree;
8851306 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1307
+ Object3D destinationLeaf;
8861308 try {
887
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1309
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
8881310 } catch (Exception e) {
8891311 System.out.println("destinationPath : " + destinationPath);
8901312 return;
8911313 }
8921314
893
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1315
+ for (int i=group.selection.size(); --i>=0;)
8941316 {
1317
+ Object3D child = (Object3D)group.selection.elementAt(i);
1318
+
1319
+ // Cannot move into itself
1320
+ if (child == destinationLeaf)
1321
+ return;
1322
+ }
1323
+
1324
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1325
+// {
8951326 loadClipboard(true);
8961327 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
898
- } else {
899
- loadClipboard(false);
900
- objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
902
- }
1328
+ pasteInto(false, false);
1329
+// } else {
1330
+// loadClipboard(false);
1331
+// objEditor.jTree.setSelectionPath(destinationPath);
1332
+// pasteInto(false, false); // true); // ???
1333
+// }
9031334 }
9041335 public void dropActionChanged(DropTargetDragEvent dtde)
9051336 // Called if the user has modified the current drop gesture
....@@ -1002,90 +1433,109 @@
10021433
10031434 void buildCreateMenu(Menu menu)
10041435 {
1005
- gridItem = menu.add(new MenuItem("Grid"));
1006
- gridItem.addActionListener(this);
1007
- rectoidItem = menu.add(new MenuItem("Box"));
1008
- rectoidItem.addActionListener(this);
1009
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1010
- ellipsoidItem.addActionListener(this);
1011
- coneItem = menu.add(new MenuItem("Cone"));
1012
- coneItem.addActionListener(this);
1013
- torusItem = menu.add(new MenuItem("Torus"));
1014
- torusItem.addActionListener(this);
1015
- superItem = menu.add(new MenuItem("Superellipsoid"));
1016
- superItem.addActionListener(this);
1017
- particleItem = menu.add(new MenuItem("Particle system"));
1018
- particleItem.addActionListener(this);
1436
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1437
+ //heightFieldItem.addActionListener(this);
1438
+// gridItem = menu.add(new MenuItem("Grid"));
1439
+// gridItem.addActionListener(this);
1440
+// rectoidItem = menu.add(new MenuItem("Box"));
1441
+// rectoidItem.addActionListener(this);
1442
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1443
+// ellipsoidItem.addActionListener(this);
1444
+// coneItem = menu.add(new MenuItem("Cone"));
1445
+// coneItem.addActionListener(this);
1446
+// torusItem = menu.add(new MenuItem("Torus"));
1447
+// torusItem.addActionListener(this);
1448
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1449
+// superItem.addActionListener(this);
1450
+
1451
+ cameraItem = menu.add(new MenuItem("Camera"));
1452
+ cameraItem.addActionListener(this);
1453
+
1454
+ if (!Globals.ADVANCED)
1455
+ {
1456
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1457
+ kleinItem.addActionListener(this);
1458
+ }
1459
+
1460
+// particleItem = menu.add(new MenuItem("Particle system"));
1461
+// particleItem.addActionListener(this);
1462
+ if (Globals.ADVANCED)
1463
+ {
10191464 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201465 ragdollItem.addActionListener(this);
10211466 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221467 ragdoll2Item.addActionListener(this);
1468
+ }
10231469 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1470
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251471 meshItem.addActionListener(this);
10261472 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271473 // meshGroupItem.addActionListener(this);
1474
+ if (Globals.ADVANCED)
1475
+ {
10281476 springItem = menu.add(new MenuItem("Spring"));
10291477 springItem.addActionListener(this);
10301478 flagItem = menu.add(new MenuItem("Flag"));
10311479 flagItem.addActionListener(this);
1032
- bezierItem = menu.add(new MenuItem("Patch"));
1033
- bezierItem.addActionListener(this);
1034
- checkerItem = menu.add(new MenuItem("Checker"));
1035
- checkerItem.addActionListener(this);
10361480 blobItem = menu.add(new MenuItem("Blob"));
10371481 blobItem.addActionListener(this);
10381482 latheItem = menu.add(new MenuItem("Lathe"));
10391483 latheItem.addActionListener(this);
1040
- lightItem = menu.add(new MenuItem("Light"));
1041
- lightItem.addActionListener(this);
1484
+ }
1485
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1486
+ bezierItem.addActionListener(this);
1487
+// overlayItem = menu.add(new MenuItem("Overlay"));
1488
+// overlayItem.addActionListener(this);
1489
+// lightItem = menu.add(new MenuItem("Light"));
1490
+// lightItem.addActionListener(this);
10421491 menu.add("-");
10431492 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10441493 //superLoopItem.addActionListener(this);
1045
- loopItem = menu.add(new MenuItem("Loop"));
1046
- loopItem.addActionListener(this);
1494
+// loopItem = menu.add(new MenuItem("Loop"));
1495
+// loopItem.addActionListener(this);
10471496 doubleItem = menu.add(new MenuItem("Fork"));
10481497 doubleItem.addActionListener(this);
1498
+ if (Globals.ADVANCED)
1499
+ {
10491500 tripleItem = menu.add(new MenuItem("Trident"));
10501501 tripleItem.addActionListener(this);
1051
- menu.add("-");
1052
- importGFDItem = menu.add(new MenuItem("GraphreeD Object..."));
1053
- importGFDItem.addActionListener(this);
1054
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
1055
- importVRMLX3DItem.addActionListener(this);
1056
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
1057
- importOBJItem.addActionListener(this);
1058
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
1059
- import3DSItem.addActionListener(this);
1502
+ }
10601503 }
10611504
10621505 void buildToolsMenu(Menu menu)
10631506 {
10641507 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651508 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1509
+ animationItem.setState(Globals.ANIMATION);
1510
+
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
10671513
10681514 menu.add("-");
10691515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701516 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1517
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1518
+ textureFieldItem.addActionListener(this);
1519
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721520 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751521 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761522 reduceMorphItem.addActionListener(this);
10771523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781524 reduce34MorphItem.addActionListener(this);
1079
-
1080
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1081
- computeAOItem.addActionListener(this);
10821525 menu.add("-");
1083
-
10841526 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851527 memoryItem.addActionListener(this);
1528
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1529
+ computeAOItem.addActionListener(this);
1530
+
1531
+ if (Globals.ADVANCED)
1532
+ {
1533
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1534
+ mirrorItem.addActionListener(this);
1535
+ menu.add("-");
10861536 menu.add(analyzeItem = new MenuItem("Analyze"));
10871537 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
1538
+ menu.add(dumpItem = new MenuItem("Print"));
10891539 dumpItem.addActionListener(this);
10901540 // menu.add(pathItem = new MenuItem("From-to path"));
10911541 // pathItem.addActionListener(this);
....@@ -1094,6 +1544,8 @@
10941544 resetParentItem.addActionListener(this);
10951545 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961546 repairParentItem.addActionListener(this);
1547
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1548
+ repairShadowItem.addActionListener(this);
10971549 menu.add(invariantsItem = new MenuItem("Invariants"));
10981550 invariantsItem.addActionListener(this);
10991551 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1553,7 @@
11011553 menu.add("-");
11021554 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031555 editScriptItem.addActionListener(this);
1556
+ }
11041557 }
11051558
11061559 void ScreenFit()
....@@ -1223,9 +1676,34 @@
12231676 shadow.material = new cMaterial(obj.material);
12241677 shadow.material.diffuse = 0.0001f;
12251678 shadow.material.specular = 0.0001f;
1679
+ //shadow.projectedVertices[1].x = 300;
12261680
12271681 makeSomething(shadow);
12281682 }
1683
+
1684
+ private void ClearUnpinned()
1685
+ {
1686
+ //for (Object3D obj : listUI)
1687
+ for (int i=listUI.size(); --i>=0;)
1688
+ {
1689
+ Object3D obj = listUI.elementAt(i);
1690
+ if (!obj.pinned)
1691
+ {
1692
+ obj.CloseUI();
1693
+ listUI.remove(i);
1694
+ }
1695
+ }
1696
+ }
1697
+
1698
+ private void EditElement(Object3D elem, boolean newWindow)
1699
+ {
1700
+ // if (!(elem instanceof Composite))
1701
+ // newWindow = false;
1702
+ listUI.add(elem);
1703
+ elem.openEditWindow(this, newWindow); //, false);
1704
+ System.out.println("edit : " + elem);
1705
+ elem.editWindow.refreshContents(true); // ? new
1706
+ }
12291707
12301708 /**
12311709 * applyExample
....@@ -1429,9 +1907,9 @@
14291907
14301908 void Overwrite(int mask)
14311909 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1910
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14331911 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1912
+ Object3D content = Grafreed.clipboard.get(0);
14351913
14361914 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371915 content = ((cGroup)content).get(0);
....@@ -1454,6 +1932,7 @@
14541932 //
14551933 public void actionPerformed(ActionEvent event) // , Object arg)
14561934 {
1935
+ Object source = event.getSource();
14571936 /*
14581937 if (event.getSource() == nameField)
14591938 {
....@@ -1465,11 +1944,11 @@
14651944 }
14661945 else
14671946 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1947
+ if (source == lookAtItem || source == lookFromItem)
14691948 {
14701949 ScreenFit();
14711950 } else
1472
- if (event.getSource() == switchItem)
1951
+ if (source == switchViewItem)
14731952 {
14741953 cVector v1 = new cVector();
14751954 cVector v2 = new cVector();
....@@ -1478,11 +1957,11 @@
14781957 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791958 objEditor.cameraView.repaint();
14801959 } else
1481
- if (event.getSource() == rectoidItem)
1960
+ if (source == rectoidItem || source == boxButton)
14821961 {
14831962 makeSomething(new Box());
14841963 } else
1485
- if (event.getSource() == particleItem)
1964
+ if (source == particleItem || source == particlesButton)
14861965 {
14871966 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881967 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1982,9 @@
15031982 applyExample(particleGeom, "SMOKE");
15041983 makeSomething(particleGeom);
15051984 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1985
+ if (source == ragdollItem || source == ragdoll2Item)
15071986 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1987
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091988
15101989 ragdoll.toParent = LA.newMatrix();
15111990 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +2000,71 @@
15212000 makeSomething(ragdoll);
15222001 //makeSomething(new VehicleDemo());
15232002 } else
1524
- if (event.getSource() == gridItem)
2003
+ /*
2004
+ */
2005
+ if (source == heightFieldItem)
2006
+ {
2007
+ Object3D obj = new Object3D();
2008
+
2009
+ obj.CreateMaterial();
2010
+ obj.bRep = new BoundaryRep();
2011
+
2012
+ obj.bRep.CreateMesh(new iHeightField()
2013
+ {
2014
+ public double f(double x, double y)
2015
+ {
2016
+ // The Mandelbrot set is represented by coloring
2017
+ // each point (x,y) according to the number of
2018
+ // iterations it takes before the while loop in
2019
+ // this method ends. For points that are actually
2020
+ // in the Mandelbrot set, or very close to it, the
2021
+ // count will reach the maximum value, 80. These
2022
+ // points will be colored purple. All other colors
2023
+ // represent points that are definitely NOT in the set.
2024
+ x -= 600;
2025
+ y -= 500;
2026
+ x /= 200;
2027
+ y /= 200;
2028
+ int count = 0;
2029
+ double zx = x;
2030
+ double zy = y;
2031
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
2032
+ double new_zx = zx*zx - zy*zy + x;
2033
+ zy = 2*zx*zy + y;
2034
+ zx = new_zx;
2035
+ count++;
2036
+ }
2037
+ return count; // Math.sqrt(count);
2038
+ }
2039
+ }, 1000,1000);
2040
+
2041
+ makeSomething(obj);
2042
+ } else
2043
+ if (source == gridItem || source == gridButton)
15252044 {
15262045 makeSomething(new Grid());
15272046 } else
1528
- if (event.getSource() == ellipsoidItem)
2047
+ if (source == ellipsoidItem || source == sphereButton)
15292048 {
15302049 makeSomething(new Sphere());
15312050 } else
1532
- if (event.getSource() == coneItem)
2051
+ if (source == coneItem || source == coneButton)
15332052 {
15342053 makeSomething(new Cone());
15352054 } else
1536
- if (event.getSource() == torusItem)
2055
+ if (source == torusItem || source == torusButton)
15372056 {
15382057 makeSomething(new Torus());
15392058 } else
1540
- if (event.getSource() == superItem)
2059
+ if (source == superItem || source == superButton)
15412060 {
15422061 makeSomething(new Superellipsoid());
15432062 } else
1544
- if (event.getSource() == blobItem)
2063
+ if (source == kleinItem || source == kleinButton)
2064
+ {
2065
+ makeSomething(new Klein());
2066
+ } else
2067
+ if (source == blobItem)
15452068 {
15462069 Blob blob = new Blob();
15472070 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2072,15 @@
15492072 //blob.retile();
15502073 makeSomething(blob);
15512074 } else
1552
- if (event.getSource() == latheItem)
2075
+ if (source == latheItem)
15532076 {
15542077 makeSomething(new Lathe());
15552078 } else
1556
- if (event.getSource() == bezierItem)
2079
+ if (source == bezierItem)
15572080 {
15582081 makeSomething(new BezierSurface());
15592082 } else
1560
- if (event.getSource() == checkerItem)
2083
+ if (source == overlayItem || source == overlayButton)
15612084 {
15622085 /*
15632086 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2093,9 @@
15702093 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712094 LA.matInvert(obj.toParent, obj.fromParent);
15722095 */
1573
- makeSomething(new CheckerIG());
2096
+ makeSomething(new Checker());
15742097 } else
1575
- if (event.getSource() == meshItem)
2098
+ if (source == meshItem)
15762099 {
15772100 Object3D itemtomake = new Object3D();
15782101 Object3D child;
....@@ -1593,35 +2116,35 @@
15932116 makeSomething(child);
15942117 }
15952118 } else
1596
- if (event.getSource() == springItem)
2119
+ if (source == springItem)
15972120 {
15982121 cSpring s = new cSpring();
15992122 s.setup();
16002123 makeSomething(s);
16012124 } else
1602
- if (event.getSource() == flagItem)
2125
+ if (source == flagItem)
16032126 {
16042127 cSpring s = new cFlag();
16052128 s.setup();
16062129 makeSomething(s);
16072130 } else
1608
- if (event.getSource() == lightItem)
2131
+ if (source == lightItem || source == lightButton)
16092132 {
16102133 makeSomething(new Light());
16112134 } else
1612
- if (event.getSource() == csgItem)
2135
+ if (source == csgItem)
16132136 {
16142137 group(new CSG());
16152138 } else
1616
- if (event.getSource() == templateItem)
2139
+ if (source == templateItem)
16172140 {
16182141 group(new cTemplate());
16192142 } else
1620
- if (event.getSource() == attributeItem)
2143
+ if (source == attributeItem)
16212144 {
16222145 makeSomething(new Attribute());
16232146 } else
1624
- if (event.getSource() == pointflowItem)
2147
+ if (source == pointflowItem)
16252148 {
16262149 makeSomething(new PointFlow());
16272150 } else
....@@ -1633,7 +2156,7 @@
16332156 } else
16342157 */
16352158
1636
- if (event.getSource() == superLoopItem)
2159
+ if (source == superLoopItem)
16372160 {
16382161 Composite g = new cGroup();
16392162 for (int i=0; i<15; i++)
....@@ -1655,30 +2178,30 @@
16552178
16562179 group(g);
16572180 } else
1658
- if (event.getSource() == loopItem)
2181
+ if (source == loopItem || source == loopButton)
16592182 {
16602183 Composite csg = new GroupLeaf();
16612184 csg.count = 5;
16622185 group(csg);
1663
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
16642187 csg.addChild(child);
16652188 child.addChild(csg);
16662189 } else
1667
- if (event.getSource() == doubleItem)
2190
+ if (source == doubleItem)
16682191 {
1669
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
16702193 csg.count = 5;
16712194 group(csg);
1672
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
16732196 csg.addChild(child);
16742197 child.addChild(csg);
1675
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
16762199 csg.addChild(child);
16772200 child.addChild(csg);
16782201 } else
1679
- if (event.getSource() == tripleItem)
2202
+ if (source == tripleItem)
16802203 {
1681
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
16822205 csg.count = 4;
16832206 group(csg);
16842207 Composite child = new cGroup();
....@@ -1691,73 +2214,98 @@
16912214 csg.addChild(child);
16922215 child.addChild(csg);
16932216 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2217
+ if (source == computeAOItem)
16962218 {
1697
- ImportGFD();
2219
+ Globals.drawMode = CameraPane.OCCLUSION;
2220
+ Globals.theRenderer.repaint();
16982221 } else
1699
- if (event.getSource() == importVRMLX3DItem)
1700
- {
1701
- ImportVRMLX3D();
1702
- } else
1703
- if (event.getSource() == import3DSItem)
1704
- {
1705
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1706
- } else
1707
- if (event.getSource() == importOBJItem)
1708
- {
1709
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1710
- } else
1711
- if (event.getSource() == computeAOItem)
1712
- {
1713
- CameraPane.drawMode = CameraPane.OCCLUSION;
1714
- CameraPane.theRenderer.repaint();
1715
- } else
1716
- if (event.getSource() == recompileItem)
2222
+ if (source == recompileItem)
17172223 {
17182224 Recompile();
17192225 refreshContents();
17202226 } else
1721
- if (event.getSource() == editScriptItem)
2227
+ if (source == editScriptItem)
17222228 {
17232229 OpenDialog();
17242230 refreshContents();
17252231 } else
1726
- if (event.getSource() == invariantsItem)
2232
+ if (source == invariantsItem)
17272233 {
17282234 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2235
+ Grafreed.grafreeD.universe.invariants();
17302236 } else
1731
- if (event.getSource() == memoryItem)
2237
+ if (source == memoryItem)
17322238 {
17332239 //System.out.println("Invariants:");
17342240 PrintMemory();
17352241 } else
1736
- if (event.getSource() == pathItem)
2242
+ if (source == pathItem)
17372243 {
17382244 PrintPath();
17392245 } else
1740
- if (event.getSource() == analyzeItem)
2246
+ if (source == analyzeItem)
17412247 {
17422248 AnalyzeObject();
17432249 } else
1744
- if (event.getSource() == dumpItem)
2250
+ if (source == dumpItem)
17452251 {
17462252 DumpObject();
17472253 } else
1748
- if (event.getSource() == screenfitButton)
2254
+ if (source == minButton)
17492255 {
1750
- //Reload(lastConverter, lastFilename, true);
2256
+ Minimize();
2257
+ } else
2258
+ if (source == maxButton)
2259
+ {
2260
+ Maximize();
2261
+ } else
2262
+ if (source == fullButton)
2263
+ {
2264
+ ToggleFullScreen();
2265
+ } else
2266
+ if (source == undoButton)
2267
+ {
2268
+ // Go to previous version
2269
+ //if (!Undo())
2270
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2271
+ Undo();
2272
+ } else
2273
+ if (source == restoreButton)
2274
+ {
2275
+ // Restore current version
2276
+ Restore();
2277
+ } else
2278
+ if (source == replaceButton)
2279
+ {
2280
+ // Overwrite current version
2281
+ Replace();
2282
+ } else
2283
+ if (source == redoButton)
2284
+ {
2285
+ // Go to next version
2286
+ Redo();
2287
+ } else
2288
+ if (source == saveButton)
2289
+ {
2290
+ // Save a new version
2291
+ if (!Save(true))
2292
+ java.awt.Toolkit.getDefaultToolkit().beep();
2293
+ } else
2294
+ if (source == oneStepButton)
2295
+ {
2296
+ Globals.ONESTEP = true;
2297
+ cameraView.repaint();
2298
+ } else
2299
+ if (source == screenfitButton)
2300
+ {
17512301 ScreenFit();
17522302 } else
1753
- if (event.getSource() == screenfitpointButton)
2303
+ if (source == screenfitpointButton)
17542304 {
1755
- //Reload(lastConverter, lastFilename, true);
17562305 ScreenFitPoint();
17572306 } else
1758
- if (event.getSource() == snapobjectButton)
2307
+ if (source == snapobjectButton)
17592308 {
1760
- //Reload(lastConverter, lastFilename, true);
17612309 SnapObject();
17622310 } else
17632311 // if (event.getSource() == recompileButton)
....@@ -1766,13 +2314,13 @@
17662314 // Recompile();
17672315 // refreshContents();
17682316 // } else
1769
- if (event.getSource() == gcButton)
2317
+ if (source == gcButton)
17702318 {
17712319 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722320 System.gc();
17732321 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742322 } else
1775
- if (event.getSource() == editLeafItem)
2323
+ if (source == editLeafItem)
17762324 {
17772325 Object3D obj;
17782326 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2334,78 @@
17862334 }
17872335 refreshContents(true);
17882336 } else
1789
- if (event.getSource() == openWindowItem)
2337
+ if (source == openWindowItem)
17902338 {
17912339 EditSelection(true);
17922340 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2341
+ if (source == cutItem || source == clearButton)
17942342 {
17952343 loadClipboard(true);
17962344 } else
1797
- if (event.getSource() == duplicateItem)
2345
+ if (source == undoItem)
17982346 {
1799
- Object3D keep = GraphreeD.clipboard;
2347
+ Undo();
2348
+ } else
2349
+ if (source == redoItem)
2350
+ {
2351
+ Redo();
2352
+ } else
2353
+ if (source == duplicateItem)
2354
+ {
2355
+ Object3D keep = Grafreed.clipboard;
18002356 loadClipboard(false);
18012357 paste(false);
1802
- GraphreeD.clipboard = keep;
2358
+ Grafreed.clipboard = keep;
18032359 } else
1804
- if (event.getSource() == cloneItem)
2360
+ if (source == cloneItem)
18052361 {
18062362 CloneSelection(false);
18072363 } else
1808
- if (event.getSource() == cloneSupportItem)
2364
+ if (source == cloneSupportItem)
18092365 {
18102366 CloneSelection(true);
18112367 } else
1812
- if (event.getSource() == copyItem)
2368
+ if (source == copyItem)
18132369 {
18142370 loadClipboard(false);
18152371 } else
1816
- if (event.getSource() == pasteItem)
2372
+ if (source == pasteItem)
18172373 {
18182374 paste(false);
18192375 } else
1820
- if (event.getSource() == pasteLinkItem)
2376
+ if (source == pasteIntoItem)
18212377 {
1822
- pasteInto(false);
2378
+ pasteInto(true, false);
18232379 } else
1824
- if (event.getSource() == pasteCloneItem)
2380
+ if (source == pasteLinkItem)
18252381 {
1826
- pasteInto(true);
2382
+ pasteInto(false, false);
18272383 } else
1828
- if (event.getSource() == pasteExpandItem)
2384
+ if (source == pasteCloneItem)
2385
+ {
2386
+ pasteInto(true, true);
2387
+ } else
2388
+ if (source == pasteExpandItem)
18292389 {
18302390 paste(true);
18312391 } else
1832
- if (event.getSource() == synchronizeItem)
2392
+ if (source == synchronizeItem)
18332393 {
18342394 Overwrite(Object3D.TRANSFORM);
18352395 } else
1836
- if (event.getSource() == overwriteNameItem)
2396
+ if (source == overwriteNameItem)
18372397 {
18382398 Overwrite(Object3D.NAME);
18392399 } else
1840
- if (event.getSource() == overwriteUVItem)
2400
+ if (source == overwriteUVItem)
18412401 {
18422402 Overwrite(Object3D.UV);
18432403 } else
1844
- if (event.getSource() == overwriteMatItem)
2404
+ if (source == overwriteMatItem)
18452405 {
2406
+ /* july 2015
18462407 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2408
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482409 else
18492410 {
18502411 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2417,16 @@
18562417 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572418 }
18582419 }
2420
+ */
2421
+
2422
+ Overwrite(dropAttributes);
18592423 }
1860
- if (event.getSource() == overwriteGeoItem)
2424
+ if (source == overwriteGeoItem)
18612425 {
18622426 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2427
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642428 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2429
+// Object3D content = GrafreeD.clipboard.get(0);
18662430 //
18672431 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682432 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2438,7 @@
18742438 // refreshContents();
18752439 // }
18762440 } else
1877
- if (event.getSource() == generateMeshItem)
2441
+ if (source == generateMeshItem)
18782442 {
18792443 //if (group.selection.size() == 1)
18802444 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2449,7 @@
18852449 ResetModel();
18862450 refreshContents();
18872451 } else
1888
- if (event.getSource() == extractGeometriesItem)
2452
+ if (source == extractGeometriesItem)
18892453 {
18902454 boolean one = false;
18912455
....@@ -1912,7 +2476,7 @@
19122476 ResetModel();
19132477 refreshContents();
19142478 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2479
+ if (source == cloneGeometriesItem)
19162480 {
19172481 boolean one = false;
19182482
....@@ -1938,32 +2502,37 @@
19382502 ResetModel();
19392503 refreshContents();
19402504 } else
1941
- if (event.getSource() == shareGeometriesItem)
2505
+ if (source == shareGeometriesItem)
19422506 {
19432507 boolean one = false;
19442508
19452509 if (group.selection.size() == 1)
19462510 one = true;
19472511
2512
+ Object3D merge = null;
2513
+
19482514 Object3D content = new cGroup();
19492515
19502516 for (int i=0; i<group.selection.size(); i++)
19512517 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2518
+ merge = new Merge(group.selection.get(i));
19532519
19542520 if (one)
1955
- makeSomething(sel, false);
2521
+ makeSomething(merge, false);
19562522 else
1957
- content.addChild(sel);
2523
+ content.addChild(merge);
19582524 }
19592525
19602526 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2527
+ makeSomething(content, true);
2528
+ else
2529
+ {
2530
+ ResetModel();
2531
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2532
+ refreshContents();
2533
+ }
19652534 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2535
+ if (source == mergeGeometriesItem)
19672536 {
19682537 boolean one = false;
19692538
....@@ -1993,11 +2562,11 @@
19932562 ResetModel();
19942563 refreshContents();
19952564 } else
1996
- if (event.getSource() == linkverticesItem)
2565
+ if (source == linkverticesItem)
19972566 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2567
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992568 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2569
+// Object3D content = GrafreeD.clipboard.get(0);
20012570 //
20022571 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032572 // content = ((cGroup)content).get(0);
....@@ -2006,39 +2575,48 @@
20062575 // group.selection.get(0).setMasterThis(content); // should be identity
20072576 // refreshContents();
20082577 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2578
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20102579 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2580
+ Object3D content = Grafreed.clipboard.get(0);
20122581
20132582 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142583 content = ((cGroup)content).get(0);
20152584
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2585
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172586 for (int i=0; i<group.selection.size(); i++)
20182587 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
2588
+ boolean random = CameraPane.SWITCH;
2589
+ CameraPane.SWITCH = false; // parse all random nodes
20212590 group.selection.get(i).linkVerticesThis(content);
20222591 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
2592
+ CameraPane.SWITCH = random;
20242593 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2594
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262595 refreshContents();
20272596 }
20282597 } else
2029
- if (event.getSource() == resetsupportItem)
2598
+ if (source == resetsupportItem)
20302599 {
20312600 for (int i=0; i<group.selection.size(); i++)
20322601 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
2602
+ boolean random = CameraPane.SWITCH;
2603
+ CameraPane.SWITCH = false; // parse all random nodes
20352604 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
2605
+ CameraPane.SWITCH = random;
20372606 }
20382607
20392608 refreshContents();
20402609 } else
2041
- if (event.getSource() == resetreferencesItem)
2610
+ if (source == relinkverticesItem)
2611
+ {
2612
+ boolean random = CameraPane.SWITCH;
2613
+ CameraPane.SWITCH = false; // parse all random nodes
2614
+ group.selection.RelinkToSupport();
2615
+ CameraPane.SWITCH = random;
2616
+
2617
+ refreshContents();
2618
+ } else
2619
+ if (source == resetreferencesItem)
20422620 {
20432621 for (int i=0; i<group.selection.size(); i++)
20442622 {
....@@ -2047,11 +2625,11 @@
20472625
20482626 refreshContents();
20492627 } else
2050
- if (event.getSource() == setMasterItem)
2628
+ if (source == setMasterItem)
20512629 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2630
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20532631 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2632
+ Object3D content = Grafreed.clipboard.get(0);
20552633
20562634 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572635 content = ((cGroup)content).get(0);
....@@ -2060,13 +2638,13 @@
20602638 refreshContents();
20612639 }
20622640 } else
2063
- if (event.getSource() == poseMeshItem)
2641
+ if (source == poseMeshItem)
20642642 {
20652643 if (group.selection.size() == 1)
20662644 {
2067
- if (GraphreeD.clipboard.size() == 1)
2645
+ if (Grafreed.clipboard.size() == 1)
20682646 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2647
+ Object3D content = Grafreed.clipboard.get(0);
20702648
20712649 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722650 content = ((cGroup)content).get(0);
....@@ -2079,19 +2657,19 @@
20792657 }
20802658
20812659 } else
2082
- if (event.getSource() == revertMeshItem)
2660
+ if (source == revertMeshItem)
20832661 {
20842662 RevertMeshes();
20852663 } else
2086
- if (event.getSource() == resetMeshItem)
2664
+ if (source == resetAllItem)
20872665 {
20882666 ResetAll();
20892667 } else
2090
- if (event.getSource() == stepAllItem)
2668
+ if (source == stepAllItem)
20912669 {
20922670 StepAll();
20932671 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
20952673 {
20962674 //int indices[] = jList.getSelectedIndices();
20972675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2677,46 @@
20992677
21002678 ClearSelection(false);
21012679 } else
2102
- if (event.getSource() == clearAllItem)
2680
+ if (source == clearAllItem)
21032681 {
21042682 ClearSelection(true);
21052683 } else
2106
- if (event.getSource() == grabItem)
2684
+ if (source == grabItem || source == groupButton)
21072685 {
2108
- group(new cGroup(), true);
2686
+ group(new cGroup(), false); // true);
21092687 } else
2110
- if (event.getSource() == frontItem)
2688
+ if (source == hideItem)
2689
+ {
2690
+ group(new HiddenObject());
2691
+ } else
2692
+ if (source == frontItem)
21112693 {
21122694 front();
21132695 } else
2114
- if (event.getSource() == backItem)
2696
+ if (source == backItem)
21152697 {
21162698 back();
21172699 } else
2118
- if (event.getSource() == cameraItem)
2700
+ if (source == cameraItem)
21192701 {
21202702 makeSomething(new Camera());
21212703 } else
2122
- if (event.getSource() == compositeItem)
2704
+ if (source == compositeItem || source == compositeButton)
21232705 {
21242706 group(new Composite());
21252707 } else
2126
- if (event.getSource() == randomItem)
2708
+ if (source == switchItem || source == switchButton)
21272709 {
21282710 RandomNode random = new RandomNode();
21292711 group(random);
21302712 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
2713
+ random.name = random.get(0).name + "Switch";
21322714 } else
2133
- if (event.getSource() == physicsItem)
2715
+ if (source == physicsItem)
21342716 {
21352717 group(new PhysicsNode());
21362718 } else
2137
- if (event.getSource() == frameselectorItem)
2719
+ if (source == frameselectorItem)
21382720 {
21392721 for (int i=0; i<group.selection.size(); i++)
21402722 {
....@@ -2146,7 +2728,7 @@
21462728 ResetModel();
21472729 refreshContents();
21482730 } else
2149
- if (event.getSource() == switchGeoItem)
2731
+ if (source == switchGeoItem)
21502732 {
21512733 for (int i=0; i<group.selection.size(); i++)
21522734 {
....@@ -2158,7 +2740,7 @@
21582740 ResetModel();
21592741 refreshContents();
21602742 } else
2161
- if (event.getSource() == switchTransfoItem)
2743
+ if (source == switchTransfoItem)
21622744 {
21632745 for (int i=0; i<group.selection.size(); i++)
21642746 {
....@@ -2170,7 +2752,7 @@
21702752 ResetModel();
21712753 refreshContents();
21722754 } else
2173
- if (event.getSource() == morphItem)
2755
+ if (source == morphItem)
21742756 {
21752757 for (int i=0; i<group.selection.size(); i++)
21762758 {
....@@ -2182,7 +2764,7 @@
21822764 ResetModel();
21832765 refreshContents();
21842766 } else
2185
- if (event.getSource() == scriptNodeItem)
2767
+ if (source == scriptNodeItem)
21862768 {
21872769 boolean atleastone = false;
21882770
....@@ -2221,191 +2803,252 @@
22212803 }
22222804 }
22232805 } else
2224
- if (event.getSource() == linkerItem)
2806
+ if (source == linkerItem)
22252807 {
22262808 group(new cLinker());
22272809 } else
2228
- if (event.getSource() == textureItem)
2810
+ if (source == textureItem || source == textureButton)
22292811 {
22302812 group(new TextureNode());
22312813 } else
2232
- if (event.getSource() == shadowXItem)
2814
+ if (source == billboardItem)
2815
+ {
2816
+ group(new BillboardNode());
2817
+ } else
2818
+ if (source == shadowXItem)
22332819 {
22342820 CastShadow(0);
22352821 } else
2236
- if (event.getSource() == shadowYItem)
2822
+ if (source == shadowYItem)
22372823 {
22382824 CastShadow(1);
22392825 } else
2240
- if (event.getSource() == shadowZItem)
2826
+ if (source == shadowZItem)
22412827 {
22422828 CastShadow(2);
22432829 } else
2244
- if (event.getSource() == ungroupItem)
2830
+ if (source == ungroupItem || source == ungroupButton)
22452831 {
2246
- ungroup();
2832
+ boolean hasRoot = false;
2833
+
2834
+ for (int i=0; i<group.selection.size(); i++)
2835
+ {
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
2841
+ }
2842
+
2843
+ if (!hasRoot)
2844
+ {
2845
+ for (int i=0; i<group.selection.size(); i++)
2846
+ {
2847
+ Ungroup(group.selection.get(i));
2848
+ }
2849
+
2850
+ ClearSelection(false);
2851
+
2852
+ refreshContents();
2853
+ }
22472854 } else
2248
- if (event.getSource() == genUVItem)
2855
+ if (source == genUVItem)
22492856 {
22502857 GenUV();
22512858 } else
2252
- if (event.getSource() == genNormalsCADItem)
2859
+ if (source == genNormalsCADItem)
22532860 {
22542861 GenNormals(true);
22552862 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2863
+ if (source == genNormalsMESHItem)
2864
+ {
2865
+ GenNormalsMESH();
2866
+ } else
2867
+ if (source == genNormalsORGANItem)
22572868 {
22582869 GenNormals(false);
22592870 } else
2260
- if (event.getSource() == stripifyItem)
2871
+ if (source == genNormalsMINEItem)
2872
+ {
2873
+ GenNormalsMINE();
2874
+ } else
2875
+ if (source == stripifyItem)
22612876 {
22622877 Stripify();
22632878 } else
2264
- if (event.getSource() == unstripifyItem)
2879
+ if (source == unstripifyItem)
22652880 {
22662881 Unstripify();
22672882 } else
2268
- if (event.getSource() == trimItem)
2883
+ if (source == trimItem)
22692884 {
22702885 Trim();
22712886 } else
2272
- if (event.getSource() == untrimItem)
2887
+ if (source == untrimItem)
22732888 {
22742889 Untrim();
22752890 } else
2276
- if (event.getSource() == clearColorsItem)
2891
+ if (source == clearColorsItem)
22772892 {
22782893 ClearColors();
22792894 } else
2280
- if (event.getSource() == clearMaterialsItem)
2895
+ if (source == clearMaterialsItem)
22812896 {
22822897 ClearMaterials();
22832898 } else
2284
- if (event.getSource() == liveleavesItem)
2899
+ if (source == liveleavesItem)
22852900 {
22862901 LiveLeaves(true);
22872902 } else
2288
- if (event.getSource() == unliveleavesItem)
2903
+ if (source == unliveleavesItem)
22892904 {
22902905 LiveLeaves(false);
22912906 } else
2292
- if (event.getSource() == supportleavesItem)
2907
+ if (source == supportleavesItem)
22932908 {
22942909 SupportLeaves(true);
22952910 } else
2296
- if (event.getSource() == unsupportleavesItem)
2911
+ if (source == unsupportleavesItem)
22972912 {
22982913 SupportLeaves(false);
22992914 } else
2300
- if (event.getSource() == hideleavesItem)
2915
+ if (source == hideleavesItem)
23012916 {
23022917 HideLeaves(true);
23032918 } else
2304
- if (event.getSource() == showleavesItem)
2919
+ if (source == showleavesItem)
23052920 {
23062921 HideLeaves(false);
23072922 } else
2308
- if (event.getSource() == markleavesItem)
2923
+ if (source == markleavesItem)
23092924 {
23102925 MarkLeaves(true);
23112926 } else
2312
- if (event.getSource() == unmarkleavesItem)
2927
+ if (source == unmarkleavesItem)
23132928 {
23142929 MarkLeaves(false);
23152930 } else
2316
- if (event.getSource() == flipVItem)
2931
+ if (source == rewindleavesItem)
2932
+ {
2933
+ RewindLeaves(true);
2934
+ } else
2935
+ if (source == unrewindleavesItem)
2936
+ {
2937
+ RewindLeaves(false);
2938
+ } else
2939
+ if (source == randomleavesItem)
2940
+ {
2941
+ RandomLeaves(true);
2942
+ } else
2943
+ if (source == unrandomleavesItem)
2944
+ {
2945
+ RandomLeaves(false);
2946
+ } else
2947
+ if (source == flipVItem)
23172948 {
23182949 FlipV(true);
23192950 } else
2320
- if (event.getSource() == unflipVItem)
2951
+ if (source == unflipVItem)
23212952 {
23222953 FlipV(false);
23232954 } else
2324
- if (event.getSource() == lowTexturesItem)
2955
+ if (source == lowTexturesItem)
23252956 {
23262957 SetTexRes(0);
23272958 } else
2328
- if (event.getSource() == normalTexturesItem)
2959
+ if (source == normalTexturesItem)
23292960 {
23302961 SetTexRes(1);
23312962 } else
2332
- if (event.getSource() == highTexturesItem)
2963
+ if (source == highTexturesItem)
23332964 {
23342965 SetTexRes(2);
23352966 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2967
+ if (source == veryhighTexturesItem)
23372968 {
23382969 SetTexRes(3);
23392970 } else
2340
- if (event.getSource() == maxTexturesItem)
2971
+ if (source == maxTexturesItem)
23412972 {
23422973 SetTexRes(4);
23432974 } else
2344
- if (event.getSource() == panoTexturesItem)
2975
+ if (source == panoTexturesItem)
23452976 {
23462977 SetTexRes(5);
23472978 } else
2348
- if (event.getSource() == reverseNormalsItem)
2979
+ if (source == reverseNormalsItem)
23492980 {
23502981 ReverseNormals();
23512982 } else
2352
- if (event.getSource() == parseverticesItem)
2983
+ if (source == parseverticesItem)
23532984 {
23542985 ParseVertices();
23552986 } else
2356
- if (event.getSource() == alignItem)
2987
+ if (source == textureFieldItem)
2988
+ {
2989
+ TextureVertices();
2990
+ } else
2991
+ if (source == alignItem)
23572992 {
23582993 Align();
23592994 } else
2360
- if (event.getSource() == mirrorItem)
2995
+ if (source == mirrorItem)
23612996 {
23622997 MirrorPoses();
23632998 } else
2364
- if (event.getSource() == reduceMorphItem)
2999
+ if (source == reduceMorphItem)
23653000 {
23663001 MeshReduction(false);
23673002 } else
2368
- if (event.getSource() == reduce34MorphItem)
3003
+ if (source == reduce34MorphItem)
23693004 {
23703005 MeshReduction(true);
23713006 } else
2372
- if (event.getSource() == reverseTrianglesItem)
3007
+ if (source == reverseTrianglesItem)
23733008 {
23743009 ReverseTriangles();
23753010 } else
2376
- if (event.getSource() == reduceMeshItem)
3011
+ if (source == reduceMeshItem)
23773012 {
23783013 ReduceMesh(false);
23793014 } else
2380
- if (event.getSource() == reduce34MeshItem)
3015
+ if (source == reduce34MeshItem)
23813016 {
23823017 ReduceMesh(true);
23833018 } else
2384
- if (event.getSource() == increaseMeshItem)
3019
+ if (source == increaseMeshItem)
23853020 {
23863021 IncreaseMesh();
23873022 } else
2388
- if (event.getSource() == clipMeshItem)
3023
+ if (source == clipMeshItem)
23893024 {
23903025 ClipMesh();
23913026 } else
2392
- if (event.getSource() == smoothMeshItem)
3027
+ if (source == smoothMeshItem)
23933028 {
23943029 SmoothMesh();
23953030 } else
2396
- if (event.getSource() == transformgeometryItem)
3031
+ if (source == transformGeometryItem)
23973032 {
23983033 TransformGeometry();
23993034 } else
2400
- if (event.getSource() == resetTransformItem)
3035
+ if (source == transformChildrenItem)
3036
+ {
3037
+ TransformChildren();
3038
+ } else
3039
+ if (source == resetTransformItem)
24013040 {
24023041 ResetTransform();
24033042 } else
2404
- if (event.getSource() == resetCentroidItem)
3043
+ if (source == resetCentroidItem)
24053044 {
2406
- ResetCentroid();
3045
+ ResetCentroid(true);
24073046 } else
2408
- if (event.getSource() == resetParentItem)
3047
+ if (source == resetCentroidXZItem)
3048
+ {
3049
+ ResetCentroid(false);
3050
+ } else
3051
+ if (source == resetParentItem)
24093052 {
24103053 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24113054 {
....@@ -2415,7 +3058,7 @@
24153058
24163059 refreshContents();
24173060 } else
2418
- if (event.getSource() == repairParentItem)
3061
+ if (source == repairParentItem)
24193062 {
24203063 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24213064 {
....@@ -2429,7 +3072,21 @@
24293072
24303073 refreshContents();
24313074 } else
2432
- if (event.getSource() == sortbysizeItem)
3075
+ if (source == repairShadowItem)
3076
+ {
3077
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3078
+ {
3079
+ Object3D obj = (Object3D)e.nextElement();
3080
+ obj.RepairShadow();
3081
+// for (int i=0; i<obj.size(); i++)
3082
+// {
3083
+// obj.get(i).parent = obj;
3084
+// }
3085
+ }
3086
+
3087
+ refreshContents();
3088
+ } else
3089
+ if (source == sortbysizeItem)
24333090 {
24343091 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353092 {
....@@ -2441,7 +3098,7 @@
24413098 ResetModel();
24423099 refreshContents();
24433100 } else
2444
- if (event.getSource() == sortbynameItem)
3101
+ if (source == sortbynameItem)
24453102 {
24463103 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473104 {
....@@ -2453,7 +3110,7 @@
24533110 ResetModel();
24543111 refreshContents();
24553112 } else
2456
- if (event.getSource() == attachPigmentItem)
3113
+ if (source == attachPigmentItem)
24573114 {
24583115 String texture = GetFile("Attach pigment");
24593116 Object3D obj;
....@@ -2465,7 +3122,7 @@
24653122
24663123 refreshContents();
24673124 } else
2468
- if (event.getSource() == detachPigmentItem)
3125
+ if (source == detachPigmentItem)
24693126 {
24703127 Object3D obj;
24713128 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3133,7 @@
24763133
24773134 refreshContents();
24783135 } else
2479
- if (event.getSource() == attachBumpItem)
3136
+ if (source == attachBumpItem)
24803137 {
24813138 String texture = GetFile("Attach bump");
24823139 Object3D obj;
....@@ -2488,7 +3145,7 @@
24883145
24893146 refreshContents();
24903147 } else
2491
- if (event.getSource() == detachBumpItem)
3148
+ if (source == detachBumpItem)
24923149 {
24933150 Object3D obj;
24943151 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +3156,7 @@
24993156
25003157 refreshContents();
25013158 } else
2502
- if (event.getSource() == pigmentBumpItem)
3159
+ if (source == pigmentBumpItem)
25033160 {
25043161 Object3D obj;
25053162 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +3167,237 @@
25103167
25113168 refreshContents();
25123169 } else
2513
- if (event.getSource() == flashSelectionButton)
3170
+ if (source == flashSelectionButton)
25143171 {
25153172 CameraPane.flash = true;
25163173 refreshContents();
25173174 } else
2518
- if (event.getSource() == oneButton)
3175
+ if (source == oneButton)
25193176 {
25203177 } else
2521
- if (event.getSource() == twoButton)
3178
+ if (source == twoButton)
25223179 {
25233180 radio.layout = twoButton;
3181
+
3182
+ if (CameraPane.FULLSCREEN)
3183
+ fullscreenLayout = radio.layout;
3184
+
25243185 // bug
25253186 //gridPanel.setDividerLocation(1.0);
25263187 //bigPanel.setDividerLocation(0.0);
2527
- bigThree.remove(jtp);
2528
- bigThree.remove(cameraPanel);
2529
- bigThree.remove(XYZPanel);
2530
- aWindowConstraints.gridx = 0;
2531
- aWindowConstraints.gridy = 0;
2532
- aWindowConstraints.gridwidth = 1;
2533
- // aConstraints.gridheight = 3;
2534
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2535
- aWindowConstraints.weightx = 0;
2536
- aWindowConstraints.weighty = 1;
2537
- //bigThree.add(jtp, aWindowConstraints);
2538
- aWindowConstraints.weightx = 1;
2539
- aWindowConstraints.gridwidth = 3;
2540
- // aConstraints.gridheight = 3;
2541
- aWindowConstraints.gridx = 1;
2542
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2543
- bigThree.add(cameraPanel, aWindowConstraints);
2544
- aWindowConstraints.weightx = 0;
2545
- aWindowConstraints.gridx = 4;
2546
- aWindowConstraints.gridwidth = 1;
2547
- // aConstraints.gridheight = 3;
2548
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2549
- //bigThree.add(XYZPanel, aWindowConstraints);
2550
- bigThree.revalidate();
3188
+// bigThree.remove(scenePanel);
3189
+// bigThree.remove(centralPanel);
3190
+// bigThree.remove(XYZPanel);
3191
+// aWindowConstraints.gridx = 0;
3192
+// aWindowConstraints.gridy = 0;
3193
+// aWindowConstraints.gridwidth = 1;
3194
+// // aConstraints.gridheight = 3;
3195
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3196
+// aWindowConstraints.weightx = 0;
3197
+// aWindowConstraints.weighty = 1;
3198
+// //bigThree.add(jtp, aWindowConstraints);
3199
+// aWindowConstraints.weightx = 1;
3200
+// aWindowConstraints.gridwidth = 3;
3201
+// // aConstraints.gridheight = 3;
3202
+// aWindowConstraints.gridx = 1;
3203
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3204
+// bigThree.add(centralPanel, aWindowConstraints);
3205
+// aWindowConstraints.weightx = 0;
3206
+// aWindowConstraints.gridx = 4;
3207
+// aWindowConstraints.gridwidth = 1;
3208
+// // aConstraints.gridheight = 3;
3209
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3210
+// //bigThree.add(XYZPanel, aWindowConstraints);
3211
+// scenePanel.setVisible(false);
3212
+// centralPanel.setVisible(true);
3213
+// XYZPanel.setVisible(false);
3214
+ bigThree.ClearUI();
3215
+ bigThree.add(centralPanel);
3216
+ bigThree.FlushUI();
3217
+
3218
+ cameraView.requestFocusInWindow();
3219
+
3220
+// refreshContents(true);
3221
+//
3222
+// try
3223
+// {
3224
+// java.awt.Robot bot = new java.awt.Robot();
3225
+// int mask = InputEvent.BUTTON1_MASK;
3226
+// bot.mouseMove(100, 100);
3227
+// bot.mousePress(mask);
3228
+// bot.mouseRelease(mask);
3229
+// }
3230
+// catch (Exception e)
3231
+// {
3232
+//
3233
+// }
3234
+
25513235 } else
2552
- if (event.getSource() == threeButton)
3236
+ if (source == threeButton)
25533237 {
25543238 radio.layout = threeButton;
2555
- bigThree.remove(jtp);
2556
- bigThree.remove(cameraPanel);
2557
- bigThree.remove(XYZPanel);
2558
- aWindowConstraints.gridx = 0;
2559
- aWindowConstraints.gridy = 0;
2560
- aWindowConstraints.gridwidth = 1;
2561
- // aConstraints.gridheight = 3;
2562
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2563
- aWindowConstraints.weightx = 0;
2564
- aWindowConstraints.weighty = 1;
2565
- //bigThree.add(jtp, aWindowConstraints);
2566
- aWindowConstraints.weightx = 1;
2567
- aWindowConstraints.gridwidth = 3;
2568
- // aConstraints.gridheight = 3;
2569
- aWindowConstraints.gridx = 1;
2570
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2571
- bigThree.add(cameraPanel, aWindowConstraints);
2572
- aWindowConstraints.weightx = 0;
2573
- aWindowConstraints.gridx = 4;
2574
- aWindowConstraints.gridwidth = 1;
2575
- // aConstraints.gridheight = 3;
2576
- aConstraints.fill = GridBagConstraints.VERTICAL;
2577
- bigThree.add(XYZPanel, aWindowConstraints);
2578
- bigThree.revalidate();
3239
+
3240
+ if (CameraPane.FULLSCREEN)
3241
+ fullscreenLayout = radio.layout;
3242
+
3243
+// bigThree.remove(scenePanel);
3244
+// bigThree.remove(centralPanel);
3245
+// bigThree.remove(XYZPanel);
3246
+// aWindowConstraints.gridx = 0;
3247
+// aWindowConstraints.gridy = 0;
3248
+// aWindowConstraints.gridwidth = 1;
3249
+// // aConstraints.gridheight = 3;
3250
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3251
+// aWindowConstraints.weightx = 0;
3252
+// aWindowConstraints.weighty = 1;
3253
+// //bigThree.add(jtp, aWindowConstraints);
3254
+// aWindowConstraints.weightx = 1;
3255
+// aWindowConstraints.gridwidth = 3;
3256
+// // aConstraints.gridheight = 3;
3257
+// aWindowConstraints.gridx = 1;
3258
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3259
+// bigThree.add(centralPanel, aWindowConstraints);
3260
+// aWindowConstraints.weightx = 0;
3261
+// aWindowConstraints.gridx = 4;
3262
+// aWindowConstraints.gridwidth = 1;
3263
+// // aConstraints.gridheight = 3;
3264
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3265
+// bigThree.add(XYZPanel, aWindowConstraints);
3266
+// bigThree.validate();
3267
+// scenePanel.setVisible(false);
3268
+// centralPanel.setVisible(true);
3269
+// XYZPanel.setVisible(true);
3270
+ bigThree.ClearUI();
3271
+ bigThree.add(centralPanel);
3272
+ bigThree.add(XYZPanel);
3273
+ bigThree.FlushUI();
3274
+
3275
+ cameraView.requestFocusInWindow();
25793276 } else
2580
- if (event.getSource() == fourButton)
3277
+ if (source == fourButton)
25813278 {
25823279 radio.layout = fourButton;
2583
- bigThree.remove(jtp);
2584
- bigThree.remove(cameraPanel);
2585
- bigThree.remove(XYZPanel);
2586
- aWindowConstraints.gridx = 0;
2587
- aWindowConstraints.gridy = 0;
2588
- aWindowConstraints.gridwidth = 1;
2589
- // aWindowConstraints.gridheight = 3;
2590
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2591
- aWindowConstraints.weightx = 1;
2592
- aWindowConstraints.weighty = 1;
2593
- bigThree.add(jtp, aWindowConstraints);
2594
- aWindowConstraints.weightx = 1;
2595
- aWindowConstraints.gridwidth = 3;
2596
- // aConstraints.gridheight = 3;
2597
- aWindowConstraints.gridx = 1;
2598
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2599
- //bigThree.add(cameraPanel, aWindowConstraints);
2600
- aWindowConstraints.weightx = 0;
2601
- aWindowConstraints.gridx = 4;
2602
- aWindowConstraints.gridwidth = 1;
2603
- // aWindowConstraints.gridheight = 3;
2604
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2605
- //bigThree.add(XYZPanel, aWindowConstraints);
2606
- bigThree.revalidate();
3280
+
3281
+ if (CameraPane.FULLSCREEN)
3282
+ fullscreenLayout = radio.layout;
3283
+
3284
+// bigThree.remove(scenePanel);
3285
+// bigThree.remove(centralPanel);
3286
+// bigThree.remove(XYZPanel);
3287
+// aWindowConstraints.gridx = 0;
3288
+// aWindowConstraints.gridy = 0;
3289
+// aWindowConstraints.gridwidth = 1;
3290
+// // aWindowConstraints.gridheight = 3;
3291
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3292
+// aWindowConstraints.weightx = 1;
3293
+// aWindowConstraints.weighty = 1;
3294
+// bigThree.add(scenePanel, aWindowConstraints);
3295
+// aWindowConstraints.weightx = 1;
3296
+// aWindowConstraints.gridwidth = 3;
3297
+// // aConstraints.gridheight = 3;
3298
+// aWindowConstraints.gridx = 1;
3299
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3300
+// //bigThree.add(cameraPanel, aWindowConstraints);
3301
+// aWindowConstraints.weightx = 0;
3302
+// aWindowConstraints.gridx = 4;
3303
+// aWindowConstraints.gridwidth = 1;
3304
+// // aWindowConstraints.gridheight = 3;
3305
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3306
+// //bigThree.add(XYZPanel, aWindowConstraints);
3307
+// bigThree.validate();
3308
+// scenePanel.setVisible(true);
3309
+// centralPanel.setVisible(false);
3310
+// XYZPanel.setVisible(false);
3311
+ bigThree.ClearUI();
3312
+ bigThree.add(scenePanel);
3313
+ bigThree.FlushUI();
3314
+
3315
+ cameraView.requestFocusInWindow();
26073316 } else
2608
- if (event.getSource() == sixButton)
3317
+ if (source == sixButton)
26093318 {
26103319 radio.layout = sixButton;
2611
- bigThree.remove(jtp);
2612
- bigThree.remove(cameraPanel);
2613
- bigThree.remove(XYZPanel);
2614
- aWindowConstraints.gridx = 0;
2615
- aWindowConstraints.gridy = 0;
2616
- aWindowConstraints.gridwidth = 1;
2617
- // aConstraints.gridheight = 3;
2618
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2619
- aWindowConstraints.weightx = 0;
2620
- aWindowConstraints.weighty = 1;
2621
- bigThree.add(jtp, aWindowConstraints);
2622
- aWindowConstraints.weightx = 1;
2623
- aWindowConstraints.gridwidth = 3;
2624
- // aWindowConstraints.gridheight = 3;
2625
- aWindowConstraints.gridx = 1;
2626
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2627
- bigThree.add(cameraPanel, aWindowConstraints);
2628
- aWindowConstraints.weightx = 0;
2629
- aWindowConstraints.gridx = 4;
2630
- aWindowConstraints.gridwidth = 1;
2631
- // aWindowConstraints.gridheight = 3;
2632
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2633
- //bigThree.add(XYZPanel, aConstraints);
2634
- bigThree.revalidate();
3320
+
3321
+ if (CameraPane.FULLSCREEN)
3322
+ fullscreenLayout = radio.layout;
3323
+
3324
+// bigThree.remove(scenePanel);
3325
+// bigThree.remove(centralPanel);
3326
+// bigThree.remove(XYZPanel);
3327
+// aWindowConstraints.gridx = 0;
3328
+// aWindowConstraints.gridy = 0;
3329
+// aWindowConstraints.gridwidth = 1;
3330
+// // aConstraints.gridheight = 3;
3331
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3332
+// aWindowConstraints.weightx = 0;
3333
+// aWindowConstraints.weighty = 1;
3334
+// bigThree.add(scenePanel, aWindowConstraints);
3335
+// aWindowConstraints.weightx = 1;
3336
+// aWindowConstraints.gridwidth = 3;
3337
+// // aWindowConstraints.gridheight = 3;
3338
+// aWindowConstraints.gridx = 1;
3339
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3340
+// bigThree.add(centralPanel, aWindowConstraints);
3341
+// aWindowConstraints.weightx = 0;
3342
+// aWindowConstraints.gridx = 4;
3343
+// aWindowConstraints.gridwidth = 1;
3344
+// // aWindowConstraints.gridheight = 3;
3345
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3346
+// //bigThree.add(XYZPanel, aConstraints);
3347
+// bigThree.validate();
3348
+// scenePanel.setVisible(true);
3349
+// centralPanel.setVisible(true);
3350
+// XYZPanel.setVisible(false);
3351
+ bigThree.ClearUI();
3352
+ bigThree.add(scenePanel);
3353
+ bigThree.add(centralPanel);
3354
+ bigThree.FlushUI();
3355
+
3356
+ cameraView.requestFocusInWindow();
26353357 } else
2636
- if (event.getSource() == sevenButton)
3358
+ if (source == sevenButton)
26373359 {
26383360 radio.layout = sevenButton;
2639
- bigThree.remove(jtp);
2640
- bigThree.remove(cameraPanel);
2641
- bigThree.remove(XYZPanel);
2642
- aWindowConstraints.gridx = 0;
2643
- aWindowConstraints.gridy = 0;
2644
- aWindowConstraints.gridwidth = 1;
2645
- // aWindowConstraints.gridheight = 3;
2646
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2647
- aWindowConstraints.weightx = 0;
2648
- aWindowConstraints.weighty = 1;
2649
- bigThree.add(jtp, aWindowConstraints);
2650
- aWindowConstraints.weightx = 1;
2651
- aWindowConstraints.gridwidth = 3;
2652
- // aWindowConstraints.gridheight = 3;
2653
- aWindowConstraints.gridx = 1;
2654
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2655
- bigThree.add(cameraPanel, aWindowConstraints);
2656
- aWindowConstraints.weightx = 0;
2657
- aWindowConstraints.gridx = 4;
2658
- aWindowConstraints.gridwidth = 1;
2659
- // aConstraints.gridheight = 3;
2660
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2661
- bigThree.add(XYZPanel, aWindowConstraints);
2662
- bigThree.revalidate();
3361
+
3362
+ if (CameraPane.FULLSCREEN)
3363
+ fullscreenLayout = radio.layout;
3364
+
3365
+// bigThree.remove(scenePanel);
3366
+// bigThree.remove(centralPanel);
3367
+// bigThree.remove(XYZPanel);
3368
+// aWindowConstraints.gridx = 0;
3369
+// aWindowConstraints.gridy = 0;
3370
+// aWindowConstraints.gridwidth = 1;
3371
+// // aWindowConstraints.gridheight = 3;
3372
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3373
+// aWindowConstraints.weightx = 0;
3374
+// aWindowConstraints.weighty = 1;
3375
+// bigThree.add(scenePanel, aWindowConstraints);
3376
+// aWindowConstraints.weightx = 1;
3377
+// aWindowConstraints.gridwidth = 3;
3378
+// // aWindowConstraints.gridheight = 3;
3379
+// aWindowConstraints.gridx = 1;
3380
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3381
+// bigThree.add(centralPanel, aWindowConstraints);
3382
+// aWindowConstraints.weightx = 0;
3383
+// aWindowConstraints.gridx = 4;
3384
+// aWindowConstraints.gridwidth = 1;
3385
+// // aConstraints.gridheight = 3;
3386
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3387
+// bigThree.add(XYZPanel, aWindowConstraints);
3388
+// bigThree.validate();
3389
+// scenePanel.setVisible(true);
3390
+// centralPanel.setVisible(true);
3391
+// XYZPanel.setVisible(true);
3392
+ bigThree.ClearUI();
3393
+ bigThree.add(scenePanel);
3394
+ bigThree.add(centralPanel);
3395
+ bigThree.add(XYZPanel);
3396
+ bigThree.FlushUI();
3397
+
3398
+ cameraView.requestFocusInWindow();
26633399 } else
2664
- if (event.getSource() == rootButton)
3400
+ if (source == rootButton)
26653401 {
26663402 Object3D obj;
26673403 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2671,66 +3407,84 @@
26713407 EditObject(obj);
26723408 }
26733409
3410
+ cameraView.requestFocusInWindow();
26743411 refreshContents(true);
26753412 } else
2676
- if (event.getSource() == closeButton)
3413
+ if (source == closeButton)
26773414 {
26783415 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793416 cRadio ab;
26803417 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813418 {
26823419 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3420
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843421 {
3422
+ // Patch to avoid bug with transparency.
3423
+ if (!ab.hadMaterial)
3424
+ {
3425
+ ab.object.material = null;
3426
+ }
3427
+
26853428 buttonGroup.remove(ab);
26863429 radioPanel.remove(ab);
26873430
2688
- ab.GetObject().editWindow = null;
3431
+ //ab.GetObject().editWindow = null;
3432
+ ab.GetObject().manipWindow = null;
26893433 // ab.GetObject().objectUI = null; // ?????????
26903434
26913435 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923436 break;
26933437 }
26943438 }
3439
+
3440
+ cameraView.requestFocusInWindow();
26953441 refreshContents(true);
26963442 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3443
+ if (source == editItem || source == editButton)
26983444 {
3445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3446
+ {
3447
+ Object3D child = (Object3D)e.nextElement();
3448
+ child.pinned = true;
3449
+ }
3450
+
26993451 EditSelection(false);
27003452 } else
2701
- if (event.getSource() == uneditButton)
3453
+ if (source == uneditButton)
27023454 {
27033455 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043456 {
27053457 Object3D child = (Object3D)e.nextElement();
27063458 if(child.editWindow != null)
27073459 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3460
+ child.pinned = false;
27083461 child.CloseUI();
27093462 listUI.remove(child);
27103463
2711
- child.editWindow = null; // ???????????
3464
+ //child.editWindow = null; // ???????????
27123465 }
2713
- objEditor.ctrlPanel.revalidate();
3466
+ objEditor.ctrlPanel.FlushUI();
27143467 //objEditor.jTree.clearSelection();
27153468 //objEditor.ResetSliders();
27163469 refreshContents(true);
27173470 } else
2718
- if (event.getSource() == clearPanelButton)
3471
+ if (source == clearPanelButton)
27193472 {
27203473 assert(copy == group);
27213474 //copy.ClearUI();
27223475 for (Object3D obj : listUI)
27233476 {
3477
+ obj.pinned = false;
27243478 obj.CloseUI();
27253479 }
27263480 listUI.clear();
27273481 refreshContents(true);
27283482 } else
2729
- if (event.getSource() == allParamsButton)
3483
+ if (source == allParamsButton)
27303484 {
27313485 assert(copy == group);
27323486
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3487
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27343488
27353489 for (Object3D obj : listUI)
27363490 {
....@@ -2747,19 +3501,19 @@
27473501
27483502 refreshContents(true);
27493503 } else
2750
- if (event.getSource() == unselectButton)
3504
+ if (source == unselectButton)
27513505 {
27523506 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3507
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543508 objEditor.ResetSliders();
27553509 refreshContents(true);
27563510 } else
2757
- if(event.getSource() instanceof cRadio)
3511
+ if(source instanceof cRadio)
27583512 {
27593513 group.parent = keepparent;
27603514 group.attributes = 0;
27613515 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3516
+ /*cRadio*/ radio = (cRadio)source;
27633517 Object3D obj = radio.GetObject();
27643518 System.out.println("Edit " + obj);
27653519 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +3533,10 @@
27793533 }
27803534
27813535 copy = group;
2782
- //CameraPane.theRenderer.object = group;
3536
+
3537
+ SetUndoStates();
3538
+
3539
+ //Globals.theRenderer.object = group;
27833540 if(!useclient)
27843541 {
27853542 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +3545,52 @@
27883545 cameraView.cameras[cameraView.cameracount] = radio.camera;
27893546 cameraView.targetLookAt.set(radio.camera.lookAt);
27903547 cameraView.object = group;
2791
- cameraView.lighttouched = true;
3548
+ //cameraView.lighttouched = true;
3549
+ Globals.lighttouched = true;
27923550 topView.object = group;
27933551 frontView.object = group;
27943552 sideView.object = group;
27953553 }
2796
- group.editWindow = this;
3554
+
3555
+// fix "+" issue
3556
+ //group.editWindow = this;
3557
+ group.manipWindow = this;
3558
+
27973559 /*
27983560 currentLayout = radio.layout;
27993561 if (currentLayout == null)
28003562 currentLayout = sevenButton;
28013563 */
28023564 radio.layout.doClick();
3565
+
3566
+ ClearUnpinned();
3567
+ //Grafreed.Assert(group != null);
3568
+ //Grafreed.Assert(group.selection != null);
3569
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3570
+ if (group.selection == null || group.selection.size() == 1)
3571
+ EditSelection(false);
28033572 keepparent = group.parent;
28043573 // PARENT = NULL or not???
28053574 //group.parent = null; // ROOT
28063575 //group.attributes = -1;
28073576 ResetModel();
3577
+
3578
+ cameraView.requestFocusInWindow();
28083579 refreshContents(true);
2809
- }
3580
+ } else if (event.getSource() == editCameraItem)
3581
+ {
3582
+ cameraView.ProtectCamera();
3583
+ cameraView.repaint();
3584
+ return;
3585
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3586
+ {
3587
+ cameraView.RevertCamera();
3588
+ cameraView.repaint();
3589
+ return;
3590
+ // } else if (event.getSource() == textureButton)
3591
+ // {
3592
+ // return; // true;
3593
+ }
28103594 else
28113595 {
28123596 //return super.action(event, arg);
....@@ -2815,7 +3599,6 @@
28153599 }
28163600
28173601 boolean useclient = false;
2818
- cRadio radio;
28193602
28203603 void ToggleRoot()
28213604 {
....@@ -2824,7 +3607,7 @@
28243607 if (useclient)
28253608 {
28263609 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3610
+ Globals.lighttouched = true;
28283611 //topView.object = client;
28293612 //frontView.object = client;
28303613 //sideView.object = client;
....@@ -2832,7 +3615,7 @@
28323615 else
28333616 {
28343617 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3618
+ Globals.lighttouched = true;
28363619 //topView.object = group;
28373620 //frontView.object = group;
28383621 //sideView.object = group;
....@@ -2867,6 +3650,28 @@
28673650 refreshContents();
28683651 }
28693652
3653
+ void TransformChildren()
3654
+ {
3655
+ Object3D obj;
3656
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3657
+ {
3658
+ obj = (Object3D)e.nextElement();
3659
+ obj.KeepTextureMatrices();
3660
+ obj.TransformChildren();
3661
+ obj.RestoreTextureMatrices();
3662
+
3663
+// if (obj.parent == null)
3664
+// {
3665
+// System.out.println("NULL PARENT!");
3666
+// new Exception().printStackTrace();
3667
+// }
3668
+// else
3669
+// TouchTransform(obj);
3670
+// //obj.parent.Touch();
3671
+ }
3672
+
3673
+ refreshContents();
3674
+ }
28703675
28713676 void ResetTransform()
28723677 {
....@@ -2979,7 +3784,7 @@
29793784 refreshContents();
29803785 }
29813786
2982
- void ResetCentroid()
3787
+ void ResetCentroid(boolean full)
29833788 {
29843789 Object3D obj;
29853790 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +3799,16 @@
29943799 LA.matIdentity(Object3D.mat);
29953800 obj.getBounds(minima, maxima, false);
29963801 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3802
+ if (full)
3803
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29983804 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29993805 obj.TransformMesh(Object3D.mat);
3806
+
30003807 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3808
+ if (full)
3809
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30023810 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3811
+
30033812 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30043813 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30053814 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +3837,8 @@
30283837
30293838 int size = obj.MemorySize();
30303839
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
3840
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3841
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30323842 }
30333843 }
30343844 catch (Exception e)
....@@ -3065,9 +3875,9 @@
30653875 obj = (Object3D)e.nextElement();
30663876
30673877 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3878
+ Grafreed.AnalyzeObject(obj);
30693879 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3880
+ Grafreed.AnalyzeObject(obj.bRep);
30713881
30723882 // System.err.println((size/1024) + " KB is the size of " + obj);
30733883 }
....@@ -3109,6 +3919,20 @@
31093919 void GenNormals(boolean crease)
31103920 {
31113921 group.GenNormalsS(crease);
3922
+
3923
+ refreshContents();
3924
+ }
3925
+
3926
+ void GenNormalsMESH()
3927
+ {
3928
+ group.GenNormalsMeshS();
3929
+
3930
+ refreshContents();
3931
+ }
3932
+
3933
+ void GenNormalsMINE()
3934
+ {
3935
+ group.selection.GenNormalsMINE();
31123936
31133937 refreshContents();
31143938 }
....@@ -3157,104 +3981,259 @@
31573981
31583982 //Object3D buffer;
31593983 cVector temp = new cVector();
3160
- BoundaryRep temprep;
3161
- Object3D nodes;
3162
- Vector<Vertex> vertices;
3163
-
3164
- public void Vertex(Object3D node, Vertex v)
3165
- {
3166
- vertices.add(v);
3167
- nodes.addElement(node);
3168
-
3169
- if (temprep.GetCache(v) != null)
3170
- {
3171
- temprep.Remove(v);
3172
- }
3173
- else
3174
- {
3175
- temprep.Remember(v);
3176
- }
3177
- }
3178
-
3179
- public void Face(Object3D node, Face f)
3180
- {
3181
-
3182
- }
3183
-
3984
+// BoundaryRep temprep;
3985
+// Object3D nodes;
3986
+// Vector<Vertex> vertices;
3987
+//
3988
+// cGroup buffer;
3989
+//
3990
+// public void Vertex(Object3D node, Vertex v)
3991
+// {
3992
+//// vertices.add(v);
3993
+//// nodes.addElement(node);
3994
+////
3995
+//// if (temprep.GetCache(v) != null)
3996
+//// {
3997
+//// temprep.Remove(v);
3998
+//// } else
3999
+//// {
4000
+//// temprep.Remember(v);
4001
+//// }
4002
+//
4003
+// //Object3D node = nodes.get(index);
4004
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
4005
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4006
+//
4007
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4008
+//
4009
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4010
+//
4011
+// cGroup g = new cGroup();
4012
+//
4013
+// if (g.toParent == null)
4014
+// {
4015
+// g.toParent = LA.newMatrix();
4016
+// g.fromParent = LA.newMatrix();
4017
+// }
4018
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4019
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4020
+//
4021
+// g.add(GrafreeD.clipboard);
4022
+//
4023
+// buffer.add(g);
4024
+// }
4025
+//
4026
+// public void Face(Object3D node, Face f)
4027
+// {
4028
+//
4029
+// }
4030
+//
4031
+// void ParseVerticesOld() // ??
4032
+// {
4033
+// //if (group.selection.size() != 1)
4034
+// // return;
4035
+//
4036
+// temprep = new BoundaryRep();
4037
+// nodes = new Object3D();
4038
+// vertices = new Vector<Vertex>();
4039
+//
4040
+// boolean epsequal = GrafreeD.epsequal;
4041
+// GrafreeD.epsequal = true;
4042
+//
4043
+// for (int i=0; i<group.selection.size(); i++)
4044
+// {
4045
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4046
+//
4047
+// group.selection.get(i).Parse(
4048
+//this );
4049
+//
4050
+// int repsize = temprep.VertexCount();
4051
+// int tablesize = temprep.vertextable.size();
4052
+// int nodesize = nodes.size();
4053
+//
4054
+// assert(vertices.size() == nodes.size());
4055
+//
4056
+// temprep.vertextable.elements();
4057
+//
4058
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4059
+//
4060
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
4061
+// {
4062
+// cGroup g = new cGroup();
4063
+//
4064
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
4065
+//
4066
+// Object3D node = nodes.get(index);
4067
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
4068
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4069
+//
4070
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4071
+//
4072
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4073
+//
4074
+// if (g.toParent == null)
4075
+// {
4076
+// g.toParent = LA.newMatrix();
4077
+// g.fromParent = LA.newMatrix();
4078
+// }
4079
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4080
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4081
+//
4082
+// g.add(GrafreeD.clipboard);
4083
+//
4084
+// buffer.add(g);
4085
+// }
4086
+//
4087
+// makeSomething(buffer, i==group.selection.size()-1);
4088
+// }
4089
+//
4090
+// GrafreeD.epsequal = epsequal;
4091
+//
4092
+// //buffer = null;
4093
+// temprep = null;
4094
+// nodes = null;
4095
+//
4096
+// refreshContents();
4097
+// }
4098
+
31844099 void ParseVertices()
31854100 {
3186
- //if (group.selection.size() != 1)
3187
- // return;
3188
-
3189
- temprep = new BoundaryRep();
3190
- nodes = new Object3D();
3191
- vertices = new Vector<Vertex>();
3192
-
3193
- boolean epsequal = GraphreeD.epsequal;
3194
- GraphreeD.epsequal = true;
4101
+ boolean epsequal = Grafreed.epsequal;
4102
+ Grafreed.epsequal = true;
31954103
31964104 for (int i=0; i<group.selection.size(); i++)
31974105 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4106
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994107
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4108
+ group.selection.get(i).Parse(
4109
+
4110
+ new iParse()
4111
+ {
4112
+ public void Vertex(Object3D node, Vertex v)
4113
+ {
4114
+ temp.set(v);
4115
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054116
3206
- assert(vertices.size() == nodes.size());
3207
-
3208
- temprep.vertextable.elements();
3209
-
3210
- java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4117
+ cGroup g = new cGroup();
32114118
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4119
+ if (g.toParent == null)
4120
+ {
4121
+ g.toParent = LA.newMatrix();
4122
+ g.fromParent = LA.newMatrix();
4123
+ }
4124
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4125
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154126
3216
- int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3217
- Object3D node = nodes.get(index);
3218
- temp.set(vertices.get(index)); // temprep.GetVertex(k));
3219
- // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4127
+ g.add(Grafreed.clipboard);
32204128
3221
- LA.xformPos(temp, node.GlobalTransformInv(), temp);
3222
-
3223
- // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3224
-
3225
- if (g.toParent == null)
3226
- {
3227
- g.toParent = LA.newMatrix();
3228
- g.fromParent = LA.newMatrix();
3229
- }
3230
- LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3231
- LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4129
+ buffer.add(g);
4130
+ }
32324131
3233
- g.add(GraphreeD.clipboard);
4132
+ public void Face(Object3D node, Face f)
4133
+ {
32344134
3235
- buffer.add(g);
3236
- }
4135
+ }
4136
+ }
4137
+ );
32374138
32384139 makeSomething(buffer, i==group.selection.size()-1);
32394140 }
32404141
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4142
+ Grafreed.epsequal = epsequal;
32464143
32474144 refreshContents();
32484145 }
3249
-
4146
+
4147
+ void TextureVertices()
4148
+ {
4149
+ for (int i=0; i<group.selection.size(); i++)
4150
+ {
4151
+ group.selection.get(i).Parse(
4152
+ new iParse()
4153
+ {
4154
+ public void Vertex(Object3D node, Vertex v)
4155
+ {
4156
+ cTexture tex = node.GetTextures();
4157
+ String pigment = Object3D.GetPigment(tex);
4158
+ //String bump = Object3D.GetBump(tex);
4159
+
4160
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4161
+
4162
+ try
4163
+ {
4164
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4165
+ }
4166
+ catch (Exception e)
4167
+ {
4168
+ System.err.println("FAIL: " + node);
4169
+ }
4170
+
4171
+ double s = v.s;
4172
+
4173
+ if (s == 1)
4174
+ s = 0;
4175
+
4176
+ double t = v.t;
4177
+
4178
+ if (t == 1)
4179
+ t = 0;
4180
+
4181
+ int indexs = (int) (texturedata.getWidth() * s);
4182
+ int indext = (int) (texturedata.getHeight() * t);
4183
+
4184
+ int index = indext * texturedata.getWidth() + indexs;
4185
+
4186
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4187
+
4188
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4189
+
4190
+ float scale = bytebuf.get(index*slide) & 0xFF;
4191
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4192
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4193
+ scale /= 3;
4194
+
4195
+ scale /= 0xFF;
4196
+ // c'est quoi ca? scale /= 4;
4197
+
4198
+ //v.AO = scale;
4199
+
4200
+ v.x += v.norm.x * scale;
4201
+ v.y += v.norm.y * scale;
4202
+ v.z += v.norm.z * scale;
4203
+ }
4204
+
4205
+ public void Face(Object3D node, Face f)
4206
+ {
4207
+ }
4208
+ }
4209
+ );
4210
+ }
4211
+
4212
+ refreshContents();
4213
+ }
4214
+
32504215 void Align()
32514216 {
4217
+ if (group.selection.size() == 0)
4218
+ return;
4219
+
4220
+ cVector bbmin = new cVector();
4221
+ cVector bbmax = new cVector();
4222
+
4223
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4224
+
4225
+ double dx = bbmax.x - bbmin.x;
4226
+ double dy = bbmax.y - bbmin.y;
4227
+ double dz = bbmax.z - bbmin.z;
4228
+
4229
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4230
+
32524231 for (int i=0; i<group.selection.size(); i++)
32534232 {
32544233 Object3D obj = group.selection.get(i);
32554234
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4235
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4236
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584237 }
32594238
32604239 refreshContents();
....@@ -3267,7 +4246,7 @@
32674246 // ref.SaveSupports();
32684247 // Object3D par = ref.parent;
32694248 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4249
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714250 // ref.parent = par;
32724251 // ref.RestoreSupports();
32734252
....@@ -3275,11 +4254,11 @@
32754254
32764255 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774256
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4257
+ boolean random = CameraPane.SWITCH;
4258
+ CameraPane.SWITCH = false; // parse all random nodes
32804259 lowres.linkVerticesThis(null);
32814260 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4261
+ CameraPane.SWITCH = random;
32834262
32844263 System.err.flush();
32854264
....@@ -3297,7 +4276,7 @@
32974276 // lowres.SaveSupports();
32984277 // par = lowres.parent;
32994278 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4279
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014280 Object3D newlow = CloneObject(lowres, false);
33024281 newlow.name = sn.switchobject.get(i).name;
33034282 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4298,7 @@
33194298 return;
33204299
33214300 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4301
+ Object3D ref = Grafreed.clipboard.get(0);
33234302
33244303 Object3D newgroup = new Object3D("Po:" + poses.name);
33254304
....@@ -3488,7 +4467,7 @@
34884467 group.selection.RelinkToSupport(); // july 2014
34894468 System.out.println("DONE.");
34904469 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4470
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34924471 }
34934472
34944473 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +4492,20 @@
35134492
35144493 void ClipMesh()
35154494 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4495
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35174496 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
4497
+ Object3D content = Grafreed.clipboard.get(0);
35194498
35204499 if (content instanceof cGroup && ((cGroup)content).transientlink )
35214500 content = ((cGroup)content).get(0);
35224501
35234502 // for (int i=0; i<group.selection.size(); i++)
35244503 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4504
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264505 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4506
+ group.selection.ClipMesh(Grafreed.clipboard);
35284507 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4508
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304509 System.out.println("DONE.");
35314510 refreshContents();
35324511 }
....@@ -3571,6 +4550,18 @@
35714550 void MarkLeaves(boolean hide)
35724551 {
35734552 group.selection.MarkLeaves(hide);
4553
+ refreshContents();
4554
+ }
4555
+
4556
+ void RewindLeaves(boolean hide)
4557
+ {
4558
+ group.selection.RewindLeaves(hide);
4559
+ refreshContents();
4560
+ }
4561
+
4562
+ void RandomLeaves(boolean hide)
4563
+ {
4564
+ group.selection.RandomLeaves(hide);
35744565 refreshContents();
35754566 }
35764567
....@@ -3645,28 +4636,25 @@
36454636 // }
36464637 // }
36474638
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36524639 void EditSelection(boolean newWindow)
36534640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
36544647 // aConstraints.gridy = 0;
36554648 for (int i=0; i<group.selection.size(); i++)
36564649 {
36574650 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36584651 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4652
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36604653
36614654 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
4655
+ if(elem != group || !newWindow)
36634656 {
3664
- // if (!(elem instanceof Composite))
3665
- // newWindow = false;
3666
- listUI.add(elem);
3667
- elem.openEditWindow(this, newWindow); //, false);
3668
- System.out.println("edit : " + elem);
3669
- elem.editWindow.refreshContents(true); // ? new
4657
+ EditElement(elem, newWindow); // ? new
36704658 }
36714659 }
36724660 }
....@@ -3741,7 +4729,8 @@
37414729 //new Exception().printStackTrace();
37424730
37434731 freezemodel = true;
3744
-
4732
+ ClearUnpinned();
4733
+
37454734 /**/
37464735 //switch (event.id)
37474736 {
....@@ -3749,7 +4738,6 @@
37494738 //case 702: // Event.LIST_DESELECT
37504739 group.deselectAll();
37514740 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37534741 if (tps != null)
37544742 {
37554743 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +4746,39 @@
37584746
37594747 //if (child.parent != null)
37604748 //child.parent.addSelectee(child);
4749
+ objEditor.SetMaterial(child);
37614750 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37654751 }
37664752 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
4753
+// else
4754
+// {
4755
+// objEditor.SetMaterial(group); // .GetMaterial());
4756
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4757
+// System.err.println("info : " + group.GetPath());
4758
+// }
37734759
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4760
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37774761 CameraPane.flash = true;
37784762
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4763
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37804764 // a camera
37814765 {
3782
- CameraPane.camerachangeframe = 0; // don't refuse it
3783
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3784
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3785
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
4766
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4767
+ {
4768
+ CameraPane.camerachangeframe = 0; // don't refuse it
4769
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4770
+ }
4771
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4772
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864773 }
37874774
4775
+ if (tps != null && tps.length == 1)
4776
+ {
4777
+ EditSelection(false);
4778
+ }
4779
+
4780
+ SetPinStates(tps != null && tps.length > 0);
4781
+
37884782 refreshContents();
37894783 //return true;
37904784 }
....@@ -3793,6 +4787,35 @@
37934787
37944788 freezemodel = false;
37954789 }
4790
+
4791
+ void SetPinStates(boolean enabled)
4792
+ {
4793
+ editButton.setEnabled(enabled);
4794
+ uneditButton.setEnabled(enabled);
4795
+ unselectButton.setEnabled(enabled);
4796
+ flashSelectionButton.setEnabled(enabled);
4797
+ }
4798
+
4799
+ void refreshContents(boolean cp)
4800
+ {
4801
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4802
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4803
+ {
4804
+ objEditor.ClearInfo(); // .GetMaterial());
4805
+
4806
+ for (int i=0; i < group.selection.Size(); i++)
4807
+ {
4808
+ Object3D child = (Object3D) group.selection.get(i);
4809
+
4810
+ objEditor.AddInfo(child, this, true);
4811
+ System.err.println("info : " + child.GetPath());
4812
+ }
4813
+
4814
+ objEditor.SetText(); // jan 2014
4815
+ }
4816
+
4817
+ super.refreshContents(cp);
4818
+ }
37964819
37974820 void linkSomething(Object3D thing)
37984821 {
....@@ -3864,16 +4887,19 @@
38644887 {
38654888 if (group.selection.isEmpty())
38664889 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4890
+
4891
+ Grafreed.clipboardIsTempGroup = false;
38684892 Composite tGroup = null;
38694893 if (group.selection.size() > 0) // 1)
38704894 {
38714895 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4896
+ Grafreed.clipboardIsTempGroup = true;
38734897 }
38744898
38754899 if (cut)
38764900 {
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
38774903 //int indices[] = jList.getSelectedIndices();
38784904 //for (int i = indices.length - 1; i >= 0; i--)
38794905 //jList.remove(indices[i]);
....@@ -3909,16 +4935,16 @@
39094935 //System.out.println("cut " + child);
39104936 //System.out.println("parent = " + child.parent);
39114937 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4938
+ if (Grafreed.clipboardIsTempGroup)
39134939 tGroup.add/*Child*/(tmp);
39144940 else
3915
- GraphreeD.clipboard = tmp;
4941
+ Grafreed.clipboard = tmp;
39164942 }
39174943 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4944
+ if (Grafreed.clipboardIsTempGroup)
39194945 tGroup.add/*Child*/(child);
39204946 else
3921
- GraphreeD.clipboard = child;
4947
+ Grafreed.clipboard = child;
39224948 }
39234949
39244950 //ResetModel();
....@@ -3950,21 +4976,23 @@
39504976 //System.out.println("cut " + elem);
39514977 //System.out.println("parent = " + elem.parent);
39524978 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4979
+ if (Grafreed.clipboardIsTempGroup)
39544980 tGroup.add/*Child*/(tmp);
39554981 else
3956
- GraphreeD.clipboard = tmp;
4982
+ Grafreed.clipboard = tmp;
39574983 }
39584984 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4985
+ if (Grafreed.clipboardIsTempGroup)
39604986 tGroup.add/*Child*/(child);
39614987 else
3962
- GraphreeD.clipboard = child;
4988
+ Grafreed.clipboard = child;
39634989 }
39644990
39654991 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4992
+
4993
+ if (Grafreed.clipboardIsTempGroup)
4994
+ Grafreed.clipboard = tGroup;
4995
+
39684996 if (cut)
39694997 {
39704998 ResetModel();
....@@ -3974,11 +5002,15 @@
39745002
39755003 void paste(boolean expand)
39765004 {
3977
- // if (GraphreeD.clipboard == null)
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
5009
+ // if (GrafreeD.clipboard == null)
39785010 // return;
39795011 boolean first = true;
39805012
3981
- if (GraphreeD.clipboardIsTempGroup)
5013
+ if (Grafreed.clipboardIsTempGroup)
39825014 {
39835015 Composite temp;
39845016
....@@ -3989,7 +5021,7 @@
39895021 temp = (Composite)Applet3D.clipboard.deepCopy();
39905022 */
39915023 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5024
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39935025 {
39945026 Object3D child = (Object3D)e.nextElement();
39955027
....@@ -4003,7 +5035,7 @@
40035035 else
40045036 elem = child.deepCopy(); // ?
40055037 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
5038
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40075039 // elem = elem.get(0);
40085040 makeSomething(elem, true); // ?? first);
40095041 //group.addChild(elem);
....@@ -4023,23 +5055,24 @@
40235055 //Object3D cb = Applet3D.clipboard;
40245056 //temp.addChild(cb);
40255057 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4026
- assert(GraphreeD.clipboard.parent == null);
4027
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
4028
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
4029
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
4030
- makeSomething(expand?GraphreeD.clipboard.get(0).copyExpand():GraphreeD.clipboard.get(0).deepCopy());
5058
+ assert(Grafreed.clipboard.parent == null);
5059
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5060
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5061
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5062
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40315063 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
5064
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5065
+ Grafreed.clipboard.get(0).parent = keepparent;
40345066 }
40355067
5068
+ Globals.REPLACEONMAKE = keep;
40365069 ResetModel();
40375070 refreshContents();
40385071 }
40395072
4040
- void pasteInto(boolean copyit)
5073
+ void pasteInto(boolean copyit, boolean clone)
40415074 {
4042
-// if (GraphreeD.clipboard == null)
5075
+// if (GrafreeD.clipboard == null)
40435076 // return;
40445077
40455078 if (group.selection.size() != 1)
....@@ -4066,15 +5099,22 @@
40665099 if (copyit)
40675100 {
40685101 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5102
+ if (clone)
5103
+ {
5104
+ CloneClipboard(false); // sept 2014
5105
+ }
5106
+ else
5107
+ {
5108
+ paste(false);
5109
+ }
40705110 }
40715111 else
40725112 {
40735113 boolean first = true;
40745114
4075
- if (GraphreeD.clipboardIsTempGroup)
5115
+ if (Grafreed.clipboardIsTempGroup)
40765116 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5117
+ Composite temp = (Composite)Grafreed.clipboard;
40785118 Object3D copy;
40795119 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805120 {
....@@ -4084,7 +5124,7 @@
40845124 }
40855125 } else
40865126 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5127
+ linkSomething(Grafreed.clipboard); //.get(0));
40885128 }
40895129 }
40905130 }
....@@ -4161,6 +5201,10 @@
41615201
41625202 void group(Object3D csg, boolean grab)
41635203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
41645208 if (//false) // why??
41655209 !group.selection.isEmpty())
41665210 {
....@@ -4274,8 +5318,34 @@
42745318 //node.add(csg);
42755319 //makeSomething(node);
42765320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
42775322 }
42785323
5324
+ void Ungroup(Object3D g)
5325
+ {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
5330
+ if (g instanceof HiddenObject)
5331
+ {
5332
+ HiddenObject h = (HiddenObject) g;
5333
+
5334
+ for (int i=0; i<h.ActualSize(); i++)
5335
+ {
5336
+ objEditor.makeSomething(h.get(i), false);
5337
+ }
5338
+ }
5339
+ else
5340
+ {
5341
+ for (int i=0; i<g.Size(); i++)
5342
+ {
5343
+ objEditor.makeSomething(g.get(i), false);
5344
+ }
5345
+ }
5346
+ Globals.REPLACEONMAKE = keep;
5347
+ }
5348
+
42795349 void ungroup()
42805350 {
42815351 /*
....@@ -4469,21 +5539,6 @@
44695539 }
44705540 */
44715541
4472
- void ImportGFD()
4473
- {
4474
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4475
- browser.show();
4476
- String filename = browser.getFile();
4477
- if (filename != null && filename.length() > 0)
4478
- {
4479
- String fullname = browser.getDirectory() + filename;
4480
-
4481
- //Object3D readobj =
4482
- objEditor.ReadGFD(fullname, objEditor);
4483
- //makeSomething(readobj);
4484
- }
4485
- }
4486
-
44875542 /*
44885543 public void Callback(Object obj)
44895544 {
....@@ -4507,26 +5562,9 @@
45075562 }
45085563 */
45095564
4510
- void ImportVRMLX3D()
4511
- {
4512
- if (GraphreeD.standAlone)
4513
- {
4514
- /**/
4515
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4516
- browser.show();
4517
- String filename = browser.getFile();
4518
- if (filename != null && filename.length() > 0)
4519
- {
4520
- String fullname = browser.getDirectory() + filename;
4521
- LoadVRMLX3D(fullname);
4522
- }
4523
- /**/
4524
- }
4525
- }
4526
-
45275565 String GetFile(String dialogName)
45285566 {
4529
- if (GraphreeD.standAlone)
5567
+ if (Grafreed.standAlone)
45305568 {
45315569 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45325570 browser.show();
....@@ -4590,10 +5628,33 @@
45905628 cButton flashSelectionButton;
45915629 cButton editButton;
45925630 cButton uneditButton;
5631
+ JCheckBox allParamsButton;
45935632 cButton clearpanelButton;
4594
- cButton allParamsButton;
45955633 cButton unselectButton;
45965634
5635
+ cButton restoreCameraButton;
5636
+
5637
+ cButton saveButton;
5638
+ cButton oneStepButton;
5639
+
5640
+ cButton groupButton;
5641
+ cButton ungroupButton;
5642
+ cButton compositeButton;
5643
+ cButton switchButton;
5644
+ cButton loopButton;
5645
+ cButton textureButton;
5646
+
5647
+ cButton gridButton;
5648
+ cButton boxButton;
5649
+ cButton sphereButton;
5650
+ cButton coneButton;
5651
+ cButton torusButton;
5652
+ cButton superButton;
5653
+ cButton kleinButton;
5654
+ cButton particlesButton;
5655
+ cButton overlayButton;
5656
+ cButton lightButton;
5657
+
45975658 cButton screenfitButton;
45985659 cButton screenfitpointButton;
45995660 cButton snapobjectButton;
....@@ -4605,14 +5666,6 @@
46055666
46065667 cButton setsupportButton;
46075668
4608
- cButton twoButton;
4609
- cButton sixButton;
4610
- cButton threeButton;
4611
- cButton sevenButton;
4612
- cButton fourButton; // full panel
4613
- cButton oneButton; // full XYZ
4614
- //cButton currentLayout;
4615
-
46165669 //
46175670 //Composite
46185671 Object3D // to do !!
....@@ -4622,9 +5675,11 @@
46225675 //JTree jTree;
46235676 private MenuItem lookAtItem;
46245677 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
5678
+ private MenuItem switchViewItem;
46265679 private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
5680
+ private MenuItem undoItem;
5681
+ private MenuItem redoItem;
5682
+ private JMenuItem duplicateItem;
46285683 private MenuItem cloneItem;
46295684 private MenuItem cloneSupportItem;
46305685 private MenuItem overwriteGeoItem;
....@@ -4635,8 +5690,9 @@
46355690 private MenuItem resetsupportItem;
46365691 private MenuItem resetreferencesItem;
46375692 private MenuItem linkverticesItem;
5693
+ private MenuItem relinkverticesItem;
46385694 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
5695
+ private MenuItem resetAllItem;
46405696 private MenuItem stepAllItem;
46415697 private MenuItem revertMeshItem;
46425698 private MenuItem poseMeshItem;
....@@ -4647,14 +5703,17 @@
46475703 private MenuItem mergeGeometriesItem;
46485704 private MenuItem copyItem;
46495705 private MenuItem pasteItem;
5706
+ private MenuItem pasteIntoItem;
46505707 private MenuItem pasteLinkItem;
46515708 private MenuItem pasteCloneItem;
46525709 private MenuItem pasteExpandItem;
4653
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
46545711 private MenuItem clearAllItem;
46555712 private MenuItem genUVItem;
5713
+ private MenuItem genNormalsMESHItem;
46565714 private MenuItem genNormalsCADItem;
46575715 private MenuItem genNormalsORGANItem;
5716
+ private MenuItem genNormalsMINEItem;
46585717 private MenuItem stripifyItem;
46595718 private MenuItem unstripifyItem;
46605719 private MenuItem trimItem;
....@@ -4683,6 +5742,10 @@
46835742 private MenuItem showleavesItem;
46845743 private MenuItem markleavesItem;
46855744 private MenuItem unmarkleavesItem;
5745
+ private MenuItem rewindleavesItem;
5746
+ private MenuItem unrewindleavesItem;
5747
+ private MenuItem randomleavesItem;
5748
+ private MenuItem unrandomleavesItem;
46865749
46875750 private MenuItem flipVItem;
46885751 private MenuItem unflipVItem;
....@@ -4694,14 +5757,17 @@
46945757 private MenuItem panoTexturesItem;
46955758
46965759 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
5760
+ private MenuItem resetCentroidXZItem;
46985761 private MenuItem resetTransformItem;
5762
+ private MenuItem transformGeometryItem;
5763
+ private MenuItem transformChildrenItem;
5764
+ private MenuItem hideItem;
46995765 private MenuItem grabItem;
47005766 private MenuItem backItem;
47015767 private MenuItem frontItem;
47025768 private MenuItem cameraItem;
47035769 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
5770
+ private MenuItem switchItem;
47055771 private MenuItem physicsItem;
47065772 private MenuItem frameselectorItem;
47075773 private MenuItem scriptNodeItem;
....@@ -4716,6 +5782,7 @@
47165782
47175783 private MenuItem resetParentItem;
47185784 private MenuItem repairParentItem;
5785
+ private MenuItem repairShadowItem;
47195786 private MenuItem sortbysizeItem;
47205787 private MenuItem sortbynameItem;
47215788
....@@ -4728,16 +5795,19 @@
47285795 private MenuItem particleItem;
47295796 private MenuItem ragdollItem;
47305797 private MenuItem ragdoll2Item;
5798
+ private MenuItem heightFieldItem;
5799
+ private MenuItem textureFieldItem;
47315800 private MenuItem gridItem;
47325801 private MenuItem rectoidItem;
47335802 private MenuItem ellipsoidItem;
47345803 private MenuItem coneItem;
47355804 private MenuItem torusItem;
47365805 private MenuItem superItem;
5806
+ private MenuItem kleinItem;
47375807 private MenuItem blobItem;
47385808 private MenuItem latheItem;
47395809 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
5810
+ private MenuItem overlayItem;
47415811 private MenuItem meshItem;
47425812 // private MenuItem meshGroupItem;
47435813 private MenuItem springItem;
....@@ -4746,6 +5816,7 @@
47465816 private MenuItem csgItem;
47475817 private MenuItem templateItem;
47485818 private MenuItem textureItem;
5819
+ private MenuItem billboardItem;
47495820 private MenuItem shadowXItem;
47505821 private MenuItem shadowYItem;
47515822 private MenuItem shadowZItem;
....@@ -4758,11 +5829,6 @@
47585829 private MenuItem doubleItem;
47595830 private MenuItem tripleItem;
47605831
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47665832 private MenuItem computeAOItem;
47675833 private MenuItem recompileItem;
47685834 private MenuItem editScriptItem;
....@@ -4772,4 +5838,8 @@
47725838 private MenuItem analyzeItem;
47735839 private MenuItem dumpItem;
47745840 //boolean freezemodel = false;
5841
+
5842
+ Menu cameraMenu;
5843
+ MenuItem editCameraItem;
5844
+ MenuItem restoreCameraItem;
47755845 }