Normand Briere
2019-07-18 d7a17c35c443e2cb6c09eaa3cfeaf590a571faa1
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);
208
+ menu.add("-");
187209 clearItem = menu.add(new MenuItem("Clear"));
188210 clearItem.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("My 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,230 @@
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);
688
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
689
+ twoButton.setToolTipText("Show center view only");
502690 twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
691
+ this.fullscreenLayout = twoButton;
692
+
693
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504694 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
695
+ fourButton.setToolTipText("Show left panel only");
696
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697
+ sixButton.setToolTipText("2-column layout left");
506698 sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ threeButton.setToolTipText("2-column layout right");
508701 threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
702
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+ sevenButton.setToolTipText("3-column layout");
510704 sevenButton.addActionListener(this);
511705 //
512706
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
707
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ rootButton.setToolTipText("Edit selection in new tab");
514709 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
710
+
711
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
712
+ closeButton.setToolTipText("Close tab");
517713 closeButton.addActionListener(this);
518714 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
519715 //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;
528716
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
717
+ // INSERT
718
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ gridButton.setToolTipText("Create grid");
720
+ gridButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ boxButton.setToolTipText("Create box");
724
+ boxButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ sphereButton.setToolTipText("Create sphere");
728
+ sphereButton.addActionListener(this);
729
+
730
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
731
+ coneButton.setToolTipText("Create cone");
732
+ coneButton.addActionListener(this);
733
+
734
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
735
+ torusButton.setToolTipText("Create torus");
736
+ torusButton.addActionListener(this);
737
+
738
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
739
+ superButton.setToolTipText("Create superellipsoid");
740
+ superButton.addActionListener(this);
741
+
742
+ if (Globals.ADVANCED)
743
+ {
744
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ kleinButton.setToolTipText("Create Klein bottle");
746
+ kleinButton.addActionListener(this);
747
+ }
748
+
749
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ particlesButton.setToolTipText("Create particle system");
751
+ particlesButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.Return();
754
+
755
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ groupButton.setToolTipText("Create group");
757
+ groupButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ compositeButton.setToolTipText("Create composite");
761
+ compositeButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ switchButton.setToolTipText("Create item switcher");
765
+ switchButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ loopButton.setToolTipText("Create loop");
769
+ loopButton.addActionListener(this);
770
+
771
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
772
+ textureButton.setToolTipText("Create texture");
773
+ textureButton.addActionListener(this);
774
+
775
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
776
+ overlayButton.setToolTipText("Create overlay");
777
+ overlayButton.addActionListener(this);
778
+
779
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ lightButton.setToolTipText("Create light");
781
+ lightButton.addActionListener(this);
782
+
783
+ for (int i=6; --i>=0;)
784
+ {
785
+ oe.toolboxPanel.Return();
786
+ oe.toolboxPanel.add(new cGridBag());
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
+ }
794
+
795
+ // EDIT panel
796
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ editButton.setToolTipText("Pin selection controls");
798
+ editButton.addActionListener(this);
799
+
800
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ uneditButton.setToolTipText("Remove selection controls");
530802 uneditButton.addActionListener(this);
531803
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);
804
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
805
+ allParamsButton.setToolTipText("Show all controle");
544806 allParamsButton.addActionListener(this);
545807
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);
808
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ clearPanelButton.setToolTipText("Clear edit panel");
810
+ clearPanelButton.addActionListener(this);
811
+
812
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ unselectButton.setToolTipText("Unselect");
551814 unselectButton.addActionListener(this);
552815
816
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ flashSelectionButton.setToolTipText("Highlight selection");
818
+ flashSelectionButton.addActionListener(this);
819
+
820
+ editCommandsPanel.preferredHeight = 1;
821
+
822
+ SetPinStates(false);
823
+// oe.treePanel.add(commandsPanel);
824
+// oe.treePanel.Return();
825
+
553826 // oe.aConstraints.gridx += 1;
554827 // oe.aConstraints.weighty = 0;
555828 // oe.aConstraints.gridwidth = 1;
....@@ -561,40 +834,25 @@
561834 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
562835 // gcButton.addActionListener(this);
563836
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;
837
+ cGridBag jSPPanel = new cGridBag();
838
+
839
+ JScrollPane jSP;
575840 //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);
841
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
577842 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;
597843
844
+ oe.treePanel.add(jSPPanel);
845
+ oe.treePanel.Return();
846
+
847
+ oe.treePanel.add(copyOptionsPanel);
848
+ oe.treePanel.Return();
849
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
850
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
851
+ sliderPane.preferredHeight = 1;
852
+
853
+// mainPanel.setDividerLocation(0.5); //1.0);
854
+// mainPanel.setResizeWeight(0.5);
855
+
598856 //jList.addListSelectionListener(this);
599857 oe.jTree.addTreeSelectionListener(this);
600858 //jTree.setRootVisible(false);
....@@ -616,20 +874,157 @@
616874 radio.layout = sevenButton;
617875 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
618876 }
877
+
878
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
879
+ {
880
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
881
+ colorCB.setToolTipText("Copy color when dropped");
882
+ colorCB.addItemListener(this);
883
+
884
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
885
+ materialCB.setToolTipText("Copy material when dropped");
886
+ materialCB.addItemListener(this);
887
+
888
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
889
+ textureCB.setToolTipText("Copy texture when dropped");
890
+ textureCB.addItemListener(this);
891
+
892
+ panel.Return();
893
+
894
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
895
+ boxCB.setToolTipText("Display bounding boxes");
896
+ boxCB.addItemListener(this);
897
+
898
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
899
+ zoomBoxCB.setToolTipText("Display only for wheel");
900
+ zoomBoxCB.addItemListener(this);
901
+
902
+ if (true) // Globals.ADVANCED)
903
+ {
904
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
905
+// supportCB.setToolTipText("Enable rigging");
906
+// supportCB.addItemListener(this);
907
+
908
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
909
+ freezeCB.setToolTipText("Fast moving camera");
910
+ freezeCB.addItemListener(this);
911
+
912
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
913
+ // localCB.addItemListener(this);
914
+
915
+ panel.Return();
916
+
917
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
918
+ crowdCB.setToolTipText("Used for crowds");
919
+ crowdCB.addItemListener(this);
920
+
921
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
922
+ smoothCB.setToolTipText("Snapping delay");
923
+ smoothCB.addItemListener(this);
924
+
925
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
926
+ slowCB.setToolTipText("Smooth interpolation");
927
+ slowCB.addItemListener(this);
928
+
929
+// constraints.gridy += 1;
930
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
931
+// speakerMocapCB.addItemListener(this);
932
+
933
+ panel.Return();
934
+
935
+ if (false)
936
+ {
937
+ // handled in scripts
938
+ //constraints.gridy += 1;
939
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
940
+ speakerCameraCB.addItemListener(this);
941
+
942
+ //constraints.gridy += 1;
943
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
944
+ speakerFocusCB.addItemListener(this);
945
+
946
+ //constraints.gridy += 1;
947
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
948
+ smoothfocusCB.addItemListener(this);
949
+ panel.Return();
950
+ }
951
+
952
+//constraints.gridx += 1;
953
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
954
+// debugCB.addItemListener(this);
955
+
956
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
957
+ trackCB.setToolTipText("Enable tracking target");
958
+ trackCB.addItemListener(this);
959
+
960
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
961
+ oeilCB.setToolTipText("Move camera when tracking");
962
+ oeilCB.addItemListener(this);
963
+
964
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
965
+ shadowCB.setToolTipText("When live compute shadows");
966
+ shadowCB.addItemListener(this);
967
+
968
+ panel.Return();
969
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
970
+ toggleTextureCB.setToolTipText("Load textures");
971
+ toggleTextureCB.addItemListener(this);
972
+
973
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
974
+ toggleSwitchCB.setToolTipText("Choose a single item");
975
+ toggleSwitchCB.addItemListener(this);
976
+
977
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
978
+ autokeepCB.setToolTipText("On structure change");
979
+ autokeepCB.addItemListener(this);
980
+
981
+ panel.Return();
982
+ if (Globals.ADVANCED)
983
+ {
984
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
985
+ lookAtCB.setToolTipText("Look-at target");
986
+ lookAtCB.addItemListener(this);
987
+ }
988
+
989
+ }
990
+
991
+ cGridBag fill = new cGridBag();
992
+ fill.preferredHeight = 200;
993
+ cGridBag fill2 = new cGridBag();
994
+ fill2.preferredHeight = 200;
995
+ cGridBag fill3 = new cGridBag();
996
+ fill3.preferredHeight = 200;
997
+
998
+ panel.add(fill);
999
+ panel.add(fill2);
1000
+ panel.add(fill3);
1001
+
1002
+ }
6191003
6201004 void EditObject(Object3D obj)
6211005 {
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();
1006
+ cRadio radioButton = new cRadio(obj.name);
1007
+
1008
+ // June 2019. Patch to avoid bug with transparency.
1009
+ radioButton.hadMaterial = obj.material != null;
1010
+ if (!radioButton.hadMaterial)
1011
+ {
1012
+ obj.material = new cMaterial();
1013
+ }
1014
+
1015
+ radioButton.SetObject(obj);
1016
+ radioButton.layout = sevenButton;
1017
+ radioButton.SetCamera(cameraView.renderCamera, false);
1018
+ radioButton.addActionListener(this);
1019
+ radioPanel.add(radioButton);
1020
+ buttonGroup.add(radioButton);
1021
+ radioButton.doClick();
6301022 }
1023
+
6311024 void SetupViews(ObjEditor oe)
6321025 {
1026
+ theFrame = this;
1027
+
6331028 oe.SetupViews();
6341029
6351030 System.out.println("SetupViews");
....@@ -638,22 +1033,28 @@
6381033 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6391034 }
6401035
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;
1036
+ cToggleButton liveCB;
1037
+ cCheckBox supportCB;
1038
+ cCheckBox localCB;
1039
+ cCheckBox crowdCB;
1040
+ cCheckBox smoothCB;
1041
+ cToggleButton fastCB;
1042
+ cCheckBox slowCB;
1043
+ cCheckBox boxCB;
1044
+ cCheckBox zoomBoxCB;
1045
+ cCheckBox freezeCB;
1046
+ //cToggleButton trackCB;
1047
+ cCheckBox trackCB;
1048
+ cCheckBox smoothfocusCB;
6511049 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
1050
+ cCheckBox speakerCameraCB;
1051
+ cCheckBox speakerFocusCB;
1052
+ cCheckBox debugCB;
1053
+
1054
+ cCheckBox oeilCB;
1055
+ cCheckBox shadowCB;
1056
+ cCheckBox autokeepCB;
1057
+ cCheckBox lookAtCB;
6571058
6581059 // static int COLOR = 1;
6591060 // static int MATERIAL = 2;
....@@ -661,9 +1062,9 @@
6611062
6621063 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6631064
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
1065
+ cCheckBox colorCB;
1066
+ cCheckBox materialCB;
1067
+ cCheckBox textureCB;
6671068
6681069 public void itemStateChanged(ItemEvent e)
6691070 {
....@@ -688,10 +1089,10 @@
6881089 dropAttributes |= Object3D.TEXTURE;
6891090 else
6901091 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
1092
+ } else if(e.getSource() == liveCB)
6931093 {
6941094 cameraView.ToggleLive();
1095
+ refreshContents(false);
6951096 }
6961097 else if(e.getSource() == supportCB)
6971098 {
....@@ -727,6 +1128,10 @@
7271128 cameraView.repaint();
7281129 // refreshContents();
7291130 }
1131
+ else if(e.getSource() == zoomBoxCB)
1132
+ {
1133
+ cameraView.ToggleZoomBoxMode();
1134
+ }
7301135 else if(e.getSource() == smoothfocusCB)
7311136 {
7321137 cameraView.ToggleSmoothFocus();
....@@ -752,6 +1157,18 @@
7521157 {
7531158 cameraView.ToggleOeil();
7541159 }
1160
+ else if(e.getSource() == shadowCB)
1161
+ {
1162
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1163
+ }
1164
+ else if(e.getSource() == freezeCB)
1165
+ {
1166
+ Globals.FREEZEONMOVE ^= true;
1167
+ }
1168
+ else if(e.getSource() == autokeepCB)
1169
+ {
1170
+ Globals.REPLACEONMAKE ^= true;
1171
+ }
7551172 else if(e.getSource() == lookAtCB)
7561173 {
7571174 cameraView.ToggleLookAt();
....@@ -768,7 +1185,8 @@
7681185
7691186 /**/
7701187 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
771
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1188
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ TreePath path = objEditor.jTree.getSelectionPath();
7721190 if ((path == null) || (path.getPathCount() <= 1)) {
7731191 // We can't move the root node or an empty selection
7741192 return;
....@@ -831,8 +1249,6 @@
8311249 }
8321250 }
8331251
834
- String string = (String) object;
835
-
8361252 System.out.println("Transfer = " + object + "; drop : " + target);
8371253 // if( object instanceof java.io.File[])
8381254 // {
....@@ -840,7 +1256,11 @@
8401256 // objEditor.DropFile((java.io.File[]) object, true);
8411257 // return;
8421258 // }
843
- if (string.charAt(0) == '/')
1259
+
1260
+ String string = object.toString();
1261
+
1262
+ // File path for Mac and Windows
1263
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441264 {
8451265 // file(s)
8461266 String[] names = string.split("\n");
....@@ -867,7 +1287,7 @@
8671287
8681288 flashIt = false;
8691289 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1290
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711291 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721292
8731293 if (group.selection.size() == 1)
....@@ -883,23 +1303,33 @@
8831303
8841304 assert target == objEditor.jTree;
8851305 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1306
+ Object3D destinationLeaf;
8861307 try {
887
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1308
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
8881309 } catch (Exception e) {
8891310 System.out.println("destinationPath : " + destinationPath);
8901311 return;
8911312 }
8921313
893
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1314
+ for (int i=group.selection.size(); --i>=0;)
8941315 {
1316
+ Object3D child = (Object3D)group.selection.elementAt(i);
1317
+
1318
+ // Cannot move into itself
1319
+ if (child == destinationLeaf)
1320
+ return;
1321
+ }
1322
+
1323
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1324
+// {
8951325 loadClipboard(true);
8961326 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
898
- } else {
899
- loadClipboard(false);
900
- objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
902
- }
1327
+ pasteInto(false, false);
1328
+// } else {
1329
+// loadClipboard(false);
1330
+// objEditor.jTree.setSelectionPath(destinationPath);
1331
+// pasteInto(false, false); // true); // ???
1332
+// }
9031333 }
9041334 public void dropActionChanged(DropTargetDragEvent dtde)
9051335 // Called if the user has modified the current drop gesture
....@@ -1002,90 +1432,109 @@
10021432
10031433 void buildCreateMenu(Menu menu)
10041434 {
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);
1435
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1436
+ //heightFieldItem.addActionListener(this);
1437
+// gridItem = menu.add(new MenuItem("Grid"));
1438
+// gridItem.addActionListener(this);
1439
+// rectoidItem = menu.add(new MenuItem("Box"));
1440
+// rectoidItem.addActionListener(this);
1441
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1442
+// ellipsoidItem.addActionListener(this);
1443
+// coneItem = menu.add(new MenuItem("Cone"));
1444
+// coneItem.addActionListener(this);
1445
+// torusItem = menu.add(new MenuItem("Torus"));
1446
+// torusItem.addActionListener(this);
1447
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1448
+// superItem.addActionListener(this);
1449
+
1450
+ cameraItem = menu.add(new MenuItem("Camera"));
1451
+ cameraItem.addActionListener(this);
1452
+
1453
+ if (!Globals.ADVANCED)
1454
+ {
1455
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1456
+ kleinItem.addActionListener(this);
1457
+ }
1458
+
1459
+// particleItem = menu.add(new MenuItem("Particle system"));
1460
+// particleItem.addActionListener(this);
1461
+ if (Globals.ADVANCED)
1462
+ {
10191463 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201464 ragdollItem.addActionListener(this);
10211465 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221466 ragdoll2Item.addActionListener(this);
1467
+ }
10231468 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1469
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251470 meshItem.addActionListener(this);
10261471 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271472 // meshGroupItem.addActionListener(this);
1473
+ if (Globals.ADVANCED)
1474
+ {
10281475 springItem = menu.add(new MenuItem("Spring"));
10291476 springItem.addActionListener(this);
10301477 flagItem = menu.add(new MenuItem("Flag"));
10311478 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);
10361479 blobItem = menu.add(new MenuItem("Blob"));
10371480 blobItem.addActionListener(this);
10381481 latheItem = menu.add(new MenuItem("Lathe"));
10391482 latheItem.addActionListener(this);
1040
- lightItem = menu.add(new MenuItem("Light"));
1041
- lightItem.addActionListener(this);
1483
+ }
1484
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1485
+ bezierItem.addActionListener(this);
1486
+// overlayItem = menu.add(new MenuItem("Overlay"));
1487
+// overlayItem.addActionListener(this);
1488
+// lightItem = menu.add(new MenuItem("Light"));
1489
+// lightItem.addActionListener(this);
10421490 menu.add("-");
10431491 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10441492 //superLoopItem.addActionListener(this);
1045
- loopItem = menu.add(new MenuItem("Loop"));
1046
- loopItem.addActionListener(this);
1493
+// loopItem = menu.add(new MenuItem("Loop"));
1494
+// loopItem.addActionListener(this);
10471495 doubleItem = menu.add(new MenuItem("Fork"));
10481496 doubleItem.addActionListener(this);
1497
+ if (Globals.ADVANCED)
1498
+ {
10491499 tripleItem = menu.add(new MenuItem("Trident"));
10501500 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);
1501
+ }
10601502 }
10611503
10621504 void buildToolsMenu(Menu menu)
10631505 {
10641506 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651507 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1508
+ animationItem.setState(Globals.ANIMATION);
1509
+
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
10671512
10681513 menu.add("-");
10691514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701515 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1516
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1517
+ textureFieldItem.addActionListener(this);
1518
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721519 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751520 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761521 reduceMorphItem.addActionListener(this);
10771522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781523 reduce34MorphItem.addActionListener(this);
1079
-
1080
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1081
- computeAOItem.addActionListener(this);
10821524 menu.add("-");
1083
-
10841525 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851526 memoryItem.addActionListener(this);
1527
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1528
+ computeAOItem.addActionListener(this);
1529
+
1530
+ if (Globals.ADVANCED)
1531
+ {
1532
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1533
+ mirrorItem.addActionListener(this);
1534
+ menu.add("-");
10861535 menu.add(analyzeItem = new MenuItem("Analyze"));
10871536 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
1537
+ menu.add(dumpItem = new MenuItem("Print"));
10891538 dumpItem.addActionListener(this);
10901539 // menu.add(pathItem = new MenuItem("From-to path"));
10911540 // pathItem.addActionListener(this);
....@@ -1094,6 +1543,8 @@
10941543 resetParentItem.addActionListener(this);
10951544 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961545 repairParentItem.addActionListener(this);
1546
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1547
+ repairShadowItem.addActionListener(this);
10971548 menu.add(invariantsItem = new MenuItem("Invariants"));
10981549 invariantsItem.addActionListener(this);
10991550 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1552,7 @@
11011552 menu.add("-");
11021553 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031554 editScriptItem.addActionListener(this);
1555
+ }
11041556 }
11051557
11061558 void ScreenFit()
....@@ -1223,9 +1675,24 @@
12231675 shadow.material = new cMaterial(obj.material);
12241676 shadow.material.diffuse = 0.0001f;
12251677 shadow.material.specular = 0.0001f;
1678
+ //shadow.projectedVertices[1].x = 300;
12261679
12271680 makeSomething(shadow);
12281681 }
1682
+
1683
+ private void ClearUnpinned()
1684
+ {
1685
+ //for (Object3D obj : listUI)
1686
+ for (int i=listUI.size(); --i>=0;)
1687
+ {
1688
+ Object3D obj = listUI.elementAt(i);
1689
+ if (!obj.pinned)
1690
+ {
1691
+ obj.CloseUI();
1692
+ listUI.remove(i);
1693
+ }
1694
+ }
1695
+ }
12291696
12301697 /**
12311698 * applyExample
....@@ -1429,9 +1896,9 @@
14291896
14301897 void Overwrite(int mask)
14311898 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1899
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14331900 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1901
+ Object3D content = Grafreed.clipboard.get(0);
14351902
14361903 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371904 content = ((cGroup)content).get(0);
....@@ -1454,6 +1921,7 @@
14541921 //
14551922 public void actionPerformed(ActionEvent event) // , Object arg)
14561923 {
1924
+ Object source = event.getSource();
14571925 /*
14581926 if (event.getSource() == nameField)
14591927 {
....@@ -1465,11 +1933,11 @@
14651933 }
14661934 else
14671935 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1936
+ if (source == lookAtItem || source == lookFromItem)
14691937 {
14701938 ScreenFit();
14711939 } else
1472
- if (event.getSource() == switchItem)
1940
+ if (source == switchViewItem)
14731941 {
14741942 cVector v1 = new cVector();
14751943 cVector v2 = new cVector();
....@@ -1478,11 +1946,11 @@
14781946 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791947 objEditor.cameraView.repaint();
14801948 } else
1481
- if (event.getSource() == rectoidItem)
1949
+ if (source == rectoidItem || source == boxButton)
14821950 {
14831951 makeSomething(new Box());
14841952 } else
1485
- if (event.getSource() == particleItem)
1953
+ if (source == particleItem || source == particlesButton)
14861954 {
14871955 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881956 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1971,9 @@
15031971 applyExample(particleGeom, "SMOKE");
15041972 makeSomething(particleGeom);
15051973 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1974
+ if (source == ragdollItem || source == ragdoll2Item)
15071975 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1976
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091977
15101978 ragdoll.toParent = LA.newMatrix();
15111979 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +1989,71 @@
15211989 makeSomething(ragdoll);
15221990 //makeSomething(new VehicleDemo());
15231991 } else
1524
- if (event.getSource() == gridItem)
1992
+ /*
1993
+ */
1994
+ if (source == heightFieldItem)
1995
+ {
1996
+ Object3D obj = new Object3D();
1997
+
1998
+ obj.CreateMaterial();
1999
+ obj.bRep = new BoundaryRep();
2000
+
2001
+ obj.bRep.CreateMesh(new iHeightField()
2002
+ {
2003
+ public double f(double x, double y)
2004
+ {
2005
+ // The Mandelbrot set is represented by coloring
2006
+ // each point (x,y) according to the number of
2007
+ // iterations it takes before the while loop in
2008
+ // this method ends. For points that are actually
2009
+ // in the Mandelbrot set, or very close to it, the
2010
+ // count will reach the maximum value, 80. These
2011
+ // points will be colored purple. All other colors
2012
+ // represent points that are definitely NOT in the set.
2013
+ x -= 600;
2014
+ y -= 500;
2015
+ x /= 200;
2016
+ y /= 200;
2017
+ int count = 0;
2018
+ double zx = x;
2019
+ double zy = y;
2020
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
2021
+ double new_zx = zx*zx - zy*zy + x;
2022
+ zy = 2*zx*zy + y;
2023
+ zx = new_zx;
2024
+ count++;
2025
+ }
2026
+ return count; // Math.sqrt(count);
2027
+ }
2028
+ }, 1000,1000);
2029
+
2030
+ makeSomething(obj);
2031
+ } else
2032
+ if (source == gridItem || source == gridButton)
15252033 {
15262034 makeSomething(new Grid());
15272035 } else
1528
- if (event.getSource() == ellipsoidItem)
2036
+ if (source == ellipsoidItem || source == sphereButton)
15292037 {
15302038 makeSomething(new Sphere());
15312039 } else
1532
- if (event.getSource() == coneItem)
2040
+ if (source == coneItem || source == coneButton)
15332041 {
15342042 makeSomething(new Cone());
15352043 } else
1536
- if (event.getSource() == torusItem)
2044
+ if (source == torusItem || source == torusButton)
15372045 {
15382046 makeSomething(new Torus());
15392047 } else
1540
- if (event.getSource() == superItem)
2048
+ if (source == superItem || source == superButton)
15412049 {
15422050 makeSomething(new Superellipsoid());
15432051 } else
1544
- if (event.getSource() == blobItem)
2052
+ if (source == kleinItem || source == kleinButton)
2053
+ {
2054
+ makeSomething(new Klein());
2055
+ } else
2056
+ if (source == blobItem)
15452057 {
15462058 Blob blob = new Blob();
15472059 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2061,15 @@
15492061 //blob.retile();
15502062 makeSomething(blob);
15512063 } else
1552
- if (event.getSource() == latheItem)
2064
+ if (source == latheItem)
15532065 {
15542066 makeSomething(new Lathe());
15552067 } else
1556
- if (event.getSource() == bezierItem)
2068
+ if (source == bezierItem)
15572069 {
15582070 makeSomething(new BezierSurface());
15592071 } else
1560
- if (event.getSource() == checkerItem)
2072
+ if (source == overlayItem || source == overlayButton)
15612073 {
15622074 /*
15632075 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2082,9 @@
15702082 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712083 LA.matInvert(obj.toParent, obj.fromParent);
15722084 */
1573
- makeSomething(new CheckerIG());
2085
+ makeSomething(new Checker());
15742086 } else
1575
- if (event.getSource() == meshItem)
2087
+ if (source == meshItem)
15762088 {
15772089 Object3D itemtomake = new Object3D();
15782090 Object3D child;
....@@ -1593,35 +2105,35 @@
15932105 makeSomething(child);
15942106 }
15952107 } else
1596
- if (event.getSource() == springItem)
2108
+ if (source == springItem)
15972109 {
15982110 cSpring s = new cSpring();
15992111 s.setup();
16002112 makeSomething(s);
16012113 } else
1602
- if (event.getSource() == flagItem)
2114
+ if (source == flagItem)
16032115 {
16042116 cSpring s = new cFlag();
16052117 s.setup();
16062118 makeSomething(s);
16072119 } else
1608
- if (event.getSource() == lightItem)
2120
+ if (source == lightItem || source == lightButton)
16092121 {
16102122 makeSomething(new Light());
16112123 } else
1612
- if (event.getSource() == csgItem)
2124
+ if (source == csgItem)
16132125 {
16142126 group(new CSG());
16152127 } else
1616
- if (event.getSource() == templateItem)
2128
+ if (source == templateItem)
16172129 {
16182130 group(new cTemplate());
16192131 } else
1620
- if (event.getSource() == attributeItem)
2132
+ if (source == attributeItem)
16212133 {
16222134 makeSomething(new Attribute());
16232135 } else
1624
- if (event.getSource() == pointflowItem)
2136
+ if (source == pointflowItem)
16252137 {
16262138 makeSomething(new PointFlow());
16272139 } else
....@@ -1633,7 +2145,7 @@
16332145 } else
16342146 */
16352147
1636
- if (event.getSource() == superLoopItem)
2148
+ if (source == superLoopItem)
16372149 {
16382150 Composite g = new cGroup();
16392151 for (int i=0; i<15; i++)
....@@ -1655,30 +2167,30 @@
16552167
16562168 group(g);
16572169 } else
1658
- if (event.getSource() == loopItem)
2170
+ if (source == loopItem || source == loopButton)
16592171 {
16602172 Composite csg = new GroupLeaf();
16612173 csg.count = 5;
16622174 group(csg);
1663
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
16642176 csg.addChild(child);
16652177 child.addChild(csg);
16662178 } else
1667
- if (event.getSource() == doubleItem)
2179
+ if (source == doubleItem)
16682180 {
1669
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
16702182 csg.count = 5;
16712183 group(csg);
1672
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
16732185 csg.addChild(child);
16742186 child.addChild(csg);
1675
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
16762188 csg.addChild(child);
16772189 child.addChild(csg);
16782190 } else
1679
- if (event.getSource() == tripleItem)
2191
+ if (source == tripleItem)
16802192 {
1681
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
16822194 csg.count = 4;
16832195 group(csg);
16842196 Composite child = new cGroup();
....@@ -1691,73 +2203,98 @@
16912203 csg.addChild(child);
16922204 child.addChild(csg);
16932205 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2206
+ if (source == computeAOItem)
16962207 {
1697
- ImportGFD();
2208
+ Globals.drawMode = CameraPane.OCCLUSION;
2209
+ Globals.theRenderer.repaint();
16982210 } 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)
2211
+ if (source == recompileItem)
17172212 {
17182213 Recompile();
17192214 refreshContents();
17202215 } else
1721
- if (event.getSource() == editScriptItem)
2216
+ if (source == editScriptItem)
17222217 {
17232218 OpenDialog();
17242219 refreshContents();
17252220 } else
1726
- if (event.getSource() == invariantsItem)
2221
+ if (source == invariantsItem)
17272222 {
17282223 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2224
+ Grafreed.grafreeD.universe.invariants();
17302225 } else
1731
- if (event.getSource() == memoryItem)
2226
+ if (source == memoryItem)
17322227 {
17332228 //System.out.println("Invariants:");
17342229 PrintMemory();
17352230 } else
1736
- if (event.getSource() == pathItem)
2231
+ if (source == pathItem)
17372232 {
17382233 PrintPath();
17392234 } else
1740
- if (event.getSource() == analyzeItem)
2235
+ if (source == analyzeItem)
17412236 {
17422237 AnalyzeObject();
17432238 } else
1744
- if (event.getSource() == dumpItem)
2239
+ if (source == dumpItem)
17452240 {
17462241 DumpObject();
17472242 } else
1748
- if (event.getSource() == screenfitButton)
2243
+ if (source == minButton)
17492244 {
1750
- //Reload(lastConverter, lastFilename, true);
2245
+ Minimize();
2246
+ } else
2247
+ if (source == maxButton)
2248
+ {
2249
+ Maximize();
2250
+ } else
2251
+ if (source == fullButton)
2252
+ {
2253
+ ToggleFullScreen();
2254
+ } else
2255
+ if (source == undoButton)
2256
+ {
2257
+ // Go to previous version
2258
+ //if (!Undo())
2259
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2260
+ Undo();
2261
+ } else
2262
+ if (source == restoreButton)
2263
+ {
2264
+ // Restore current version
2265
+ Restore();
2266
+ } else
2267
+ if (source == replaceButton)
2268
+ {
2269
+ // Overwrite current version
2270
+ Replace();
2271
+ } else
2272
+ if (source == redoButton)
2273
+ {
2274
+ // Go to next version
2275
+ Redo();
2276
+ } else
2277
+ if (source == saveButton)
2278
+ {
2279
+ // Save a new version
2280
+ if (!Save(true))
2281
+ java.awt.Toolkit.getDefaultToolkit().beep();
2282
+ } else
2283
+ if (source == oneStepButton)
2284
+ {
2285
+ Globals.ONESTEP = true;
2286
+ cameraView.repaint();
2287
+ } else
2288
+ if (source == screenfitButton)
2289
+ {
17512290 ScreenFit();
17522291 } else
1753
- if (event.getSource() == screenfitpointButton)
2292
+ if (source == screenfitpointButton)
17542293 {
1755
- //Reload(lastConverter, lastFilename, true);
17562294 ScreenFitPoint();
17572295 } else
1758
- if (event.getSource() == snapobjectButton)
2296
+ if (source == snapobjectButton)
17592297 {
1760
- //Reload(lastConverter, lastFilename, true);
17612298 SnapObject();
17622299 } else
17632300 // if (event.getSource() == recompileButton)
....@@ -1766,13 +2303,13 @@
17662303 // Recompile();
17672304 // refreshContents();
17682305 // } else
1769
- if (event.getSource() == gcButton)
2306
+ if (source == gcButton)
17702307 {
17712308 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722309 System.gc();
17732310 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742311 } else
1775
- if (event.getSource() == editLeafItem)
2312
+ if (source == editLeafItem)
17762313 {
17772314 Object3D obj;
17782315 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2323,78 @@
17862323 }
17872324 refreshContents(true);
17882325 } else
1789
- if (event.getSource() == openWindowItem)
2326
+ if (source == openWindowItem)
17902327 {
17912328 EditSelection(true);
17922329 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2330
+ if (source == cutItem || source == clearButton)
17942331 {
17952332 loadClipboard(true);
17962333 } else
1797
- if (event.getSource() == duplicateItem)
2334
+ if (source == undoItem)
17982335 {
1799
- Object3D keep = GraphreeD.clipboard;
2336
+ Undo();
2337
+ } else
2338
+ if (source == redoItem)
2339
+ {
2340
+ Redo();
2341
+ } else
2342
+ if (source == duplicateItem)
2343
+ {
2344
+ Object3D keep = Grafreed.clipboard;
18002345 loadClipboard(false);
18012346 paste(false);
1802
- GraphreeD.clipboard = keep;
2347
+ Grafreed.clipboard = keep;
18032348 } else
1804
- if (event.getSource() == cloneItem)
2349
+ if (source == cloneItem)
18052350 {
18062351 CloneSelection(false);
18072352 } else
1808
- if (event.getSource() == cloneSupportItem)
2353
+ if (source == cloneSupportItem)
18092354 {
18102355 CloneSelection(true);
18112356 } else
1812
- if (event.getSource() == copyItem)
2357
+ if (source == copyItem)
18132358 {
18142359 loadClipboard(false);
18152360 } else
1816
- if (event.getSource() == pasteItem)
2361
+ if (source == pasteItem)
18172362 {
18182363 paste(false);
18192364 } else
1820
- if (event.getSource() == pasteLinkItem)
2365
+ if (source == pasteIntoItem)
18212366 {
1822
- pasteInto(false);
2367
+ pasteInto(true, false);
18232368 } else
1824
- if (event.getSource() == pasteCloneItem)
2369
+ if (source == pasteLinkItem)
18252370 {
1826
- pasteInto(true);
2371
+ pasteInto(false, false);
18272372 } else
1828
- if (event.getSource() == pasteExpandItem)
2373
+ if (source == pasteCloneItem)
2374
+ {
2375
+ pasteInto(true, true);
2376
+ } else
2377
+ if (source == pasteExpandItem)
18292378 {
18302379 paste(true);
18312380 } else
1832
- if (event.getSource() == synchronizeItem)
2381
+ if (source == synchronizeItem)
18332382 {
18342383 Overwrite(Object3D.TRANSFORM);
18352384 } else
1836
- if (event.getSource() == overwriteNameItem)
2385
+ if (source == overwriteNameItem)
18372386 {
18382387 Overwrite(Object3D.NAME);
18392388 } else
1840
- if (event.getSource() == overwriteUVItem)
2389
+ if (source == overwriteUVItem)
18412390 {
18422391 Overwrite(Object3D.UV);
18432392 } else
1844
- if (event.getSource() == overwriteMatItem)
2393
+ if (source == overwriteMatItem)
18452394 {
2395
+ /* july 2015
18462396 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2397
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482398 else
18492399 {
18502400 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2406,16 @@
18562406 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572407 }
18582408 }
2409
+ */
2410
+
2411
+ Overwrite(dropAttributes);
18592412 }
1860
- if (event.getSource() == overwriteGeoItem)
2413
+ if (source == overwriteGeoItem)
18612414 {
18622415 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2416
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642417 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2418
+// Object3D content = GrafreeD.clipboard.get(0);
18662419 //
18672420 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682421 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2427,7 @@
18742427 // refreshContents();
18752428 // }
18762429 } else
1877
- if (event.getSource() == generateMeshItem)
2430
+ if (source == generateMeshItem)
18782431 {
18792432 //if (group.selection.size() == 1)
18802433 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2438,7 @@
18852438 ResetModel();
18862439 refreshContents();
18872440 } else
1888
- if (event.getSource() == extractGeometriesItem)
2441
+ if (source == extractGeometriesItem)
18892442 {
18902443 boolean one = false;
18912444
....@@ -1912,7 +2465,7 @@
19122465 ResetModel();
19132466 refreshContents();
19142467 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2468
+ if (source == cloneGeometriesItem)
19162469 {
19172470 boolean one = false;
19182471
....@@ -1938,32 +2491,37 @@
19382491 ResetModel();
19392492 refreshContents();
19402493 } else
1941
- if (event.getSource() == shareGeometriesItem)
2494
+ if (source == shareGeometriesItem)
19422495 {
19432496 boolean one = false;
19442497
19452498 if (group.selection.size() == 1)
19462499 one = true;
19472500
2501
+ Object3D merge = null;
2502
+
19482503 Object3D content = new cGroup();
19492504
19502505 for (int i=0; i<group.selection.size(); i++)
19512506 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2507
+ merge = new Merge(group.selection.get(i));
19532508
19542509 if (one)
1955
- makeSomething(sel, false);
2510
+ makeSomething(merge, false);
19562511 else
1957
- content.addChild(sel);
2512
+ content.addChild(merge);
19582513 }
19592514
19602515 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2516
+ makeSomething(content, true);
2517
+ else
2518
+ {
2519
+ ResetModel();
2520
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2521
+ refreshContents();
2522
+ }
19652523 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2524
+ if (source == mergeGeometriesItem)
19672525 {
19682526 boolean one = false;
19692527
....@@ -1993,11 +2551,11 @@
19932551 ResetModel();
19942552 refreshContents();
19952553 } else
1996
- if (event.getSource() == linkverticesItem)
2554
+ if (source == linkverticesItem)
19972555 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2556
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992557 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2558
+// Object3D content = GrafreeD.clipboard.get(0);
20012559 //
20022560 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032561 // content = ((cGroup)content).get(0);
....@@ -2006,39 +2564,48 @@
20062564 // group.selection.get(0).setMasterThis(content); // should be identity
20072565 // refreshContents();
20082566 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2567
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20102568 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2569
+ Object3D content = Grafreed.clipboard.get(0);
20122570
20132571 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142572 content = ((cGroup)content).get(0);
20152573
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2574
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172575 for (int i=0; i<group.selection.size(); i++)
20182576 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
2577
+ boolean random = CameraPane.SWITCH;
2578
+ CameraPane.SWITCH = false; // parse all random nodes
20212579 group.selection.get(i).linkVerticesThis(content);
20222580 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
2581
+ CameraPane.SWITCH = random;
20242582 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2583
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262584 refreshContents();
20272585 }
20282586 } else
2029
- if (event.getSource() == resetsupportItem)
2587
+ if (source == resetsupportItem)
20302588 {
20312589 for (int i=0; i<group.selection.size(); i++)
20322590 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
2591
+ boolean random = CameraPane.SWITCH;
2592
+ CameraPane.SWITCH = false; // parse all random nodes
20352593 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
2594
+ CameraPane.SWITCH = random;
20372595 }
20382596
20392597 refreshContents();
20402598 } else
2041
- if (event.getSource() == resetreferencesItem)
2599
+ if (source == relinkverticesItem)
2600
+ {
2601
+ boolean random = CameraPane.SWITCH;
2602
+ CameraPane.SWITCH = false; // parse all random nodes
2603
+ group.selection.RelinkToSupport();
2604
+ CameraPane.SWITCH = random;
2605
+
2606
+ refreshContents();
2607
+ } else
2608
+ if (source == resetreferencesItem)
20422609 {
20432610 for (int i=0; i<group.selection.size(); i++)
20442611 {
....@@ -2047,11 +2614,11 @@
20472614
20482615 refreshContents();
20492616 } else
2050
- if (event.getSource() == setMasterItem)
2617
+ if (source == setMasterItem)
20512618 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2619
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20532620 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2621
+ Object3D content = Grafreed.clipboard.get(0);
20552622
20562623 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572624 content = ((cGroup)content).get(0);
....@@ -2060,13 +2627,13 @@
20602627 refreshContents();
20612628 }
20622629 } else
2063
- if (event.getSource() == poseMeshItem)
2630
+ if (source == poseMeshItem)
20642631 {
20652632 if (group.selection.size() == 1)
20662633 {
2067
- if (GraphreeD.clipboard.size() == 1)
2634
+ if (Grafreed.clipboard.size() == 1)
20682635 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2636
+ Object3D content = Grafreed.clipboard.get(0);
20702637
20712638 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722639 content = ((cGroup)content).get(0);
....@@ -2079,19 +2646,19 @@
20792646 }
20802647
20812648 } else
2082
- if (event.getSource() == revertMeshItem)
2649
+ if (source == revertMeshItem)
20832650 {
20842651 RevertMeshes();
20852652 } else
2086
- if (event.getSource() == resetMeshItem)
2653
+ if (source == resetAllItem)
20872654 {
20882655 ResetAll();
20892656 } else
2090
- if (event.getSource() == stepAllItem)
2657
+ if (source == stepAllItem)
20912658 {
20922659 StepAll();
20932660 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2661
+ if (source == clearItem) // || event.getSource() == clearButton)
20952662 {
20962663 //int indices[] = jList.getSelectedIndices();
20972664 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2666,46 @@
20992666
21002667 ClearSelection(false);
21012668 } else
2102
- if (event.getSource() == clearAllItem)
2669
+ if (source == clearAllItem)
21032670 {
21042671 ClearSelection(true);
21052672 } else
2106
- if (event.getSource() == grabItem)
2673
+ if (source == grabItem || source == groupButton)
21072674 {
2108
- group(new cGroup(), true);
2675
+ group(new cGroup(), false); // true);
21092676 } else
2110
- if (event.getSource() == frontItem)
2677
+ if (source == hideItem)
2678
+ {
2679
+ group(new HiddenObject());
2680
+ } else
2681
+ if (source == frontItem)
21112682 {
21122683 front();
21132684 } else
2114
- if (event.getSource() == backItem)
2685
+ if (source == backItem)
21152686 {
21162687 back();
21172688 } else
2118
- if (event.getSource() == cameraItem)
2689
+ if (source == cameraItem)
21192690 {
21202691 makeSomething(new Camera());
21212692 } else
2122
- if (event.getSource() == compositeItem)
2693
+ if (source == compositeItem || source == compositeButton)
21232694 {
21242695 group(new Composite());
21252696 } else
2126
- if (event.getSource() == randomItem)
2697
+ if (source == switchItem || source == switchButton)
21272698 {
21282699 RandomNode random = new RandomNode();
21292700 group(random);
21302701 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
2702
+ random.name = random.get(0).name + "Switch";
21322703 } else
2133
- if (event.getSource() == physicsItem)
2704
+ if (source == physicsItem)
21342705 {
21352706 group(new PhysicsNode());
21362707 } else
2137
- if (event.getSource() == frameselectorItem)
2708
+ if (source == frameselectorItem)
21382709 {
21392710 for (int i=0; i<group.selection.size(); i++)
21402711 {
....@@ -2146,7 +2717,7 @@
21462717 ResetModel();
21472718 refreshContents();
21482719 } else
2149
- if (event.getSource() == switchGeoItem)
2720
+ if (source == switchGeoItem)
21502721 {
21512722 for (int i=0; i<group.selection.size(); i++)
21522723 {
....@@ -2158,7 +2729,7 @@
21582729 ResetModel();
21592730 refreshContents();
21602731 } else
2161
- if (event.getSource() == switchTransfoItem)
2732
+ if (source == switchTransfoItem)
21622733 {
21632734 for (int i=0; i<group.selection.size(); i++)
21642735 {
....@@ -2170,7 +2741,7 @@
21702741 ResetModel();
21712742 refreshContents();
21722743 } else
2173
- if (event.getSource() == morphItem)
2744
+ if (source == morphItem)
21742745 {
21752746 for (int i=0; i<group.selection.size(); i++)
21762747 {
....@@ -2182,7 +2753,7 @@
21822753 ResetModel();
21832754 refreshContents();
21842755 } else
2185
- if (event.getSource() == scriptNodeItem)
2756
+ if (source == scriptNodeItem)
21862757 {
21872758 boolean atleastone = false;
21882759
....@@ -2221,191 +2792,252 @@
22212792 }
22222793 }
22232794 } else
2224
- if (event.getSource() == linkerItem)
2795
+ if (source == linkerItem)
22252796 {
22262797 group(new cLinker());
22272798 } else
2228
- if (event.getSource() == textureItem)
2799
+ if (source == textureItem || source == textureButton)
22292800 {
22302801 group(new TextureNode());
22312802 } else
2232
- if (event.getSource() == shadowXItem)
2803
+ if (source == billboardItem)
2804
+ {
2805
+ group(new BillboardNode());
2806
+ } else
2807
+ if (source == shadowXItem)
22332808 {
22342809 CastShadow(0);
22352810 } else
2236
- if (event.getSource() == shadowYItem)
2811
+ if (source == shadowYItem)
22372812 {
22382813 CastShadow(1);
22392814 } else
2240
- if (event.getSource() == shadowZItem)
2815
+ if (source == shadowZItem)
22412816 {
22422817 CastShadow(2);
22432818 } else
2244
- if (event.getSource() == ungroupItem)
2819
+ if (source == ungroupItem || source == ungroupButton)
22452820 {
2246
- ungroup();
2821
+ boolean hasRoot = false;
2822
+
2823
+ for (int i=0; i<group.selection.size(); i++)
2824
+ {
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
2830
+ }
2831
+
2832
+ if (!hasRoot)
2833
+ {
2834
+ for (int i=0; i<group.selection.size(); i++)
2835
+ {
2836
+ Ungroup(group.selection.get(i));
2837
+ }
2838
+
2839
+ ClearSelection(false);
2840
+
2841
+ refreshContents();
2842
+ }
22472843 } else
2248
- if (event.getSource() == genUVItem)
2844
+ if (source == genUVItem)
22492845 {
22502846 GenUV();
22512847 } else
2252
- if (event.getSource() == genNormalsCADItem)
2848
+ if (source == genNormalsCADItem)
22532849 {
22542850 GenNormals(true);
22552851 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2852
+ if (source == genNormalsMESHItem)
2853
+ {
2854
+ GenNormalsMESH();
2855
+ } else
2856
+ if (source == genNormalsORGANItem)
22572857 {
22582858 GenNormals(false);
22592859 } else
2260
- if (event.getSource() == stripifyItem)
2860
+ if (source == genNormalsMINEItem)
2861
+ {
2862
+ GenNormalsMINE();
2863
+ } else
2864
+ if (source == stripifyItem)
22612865 {
22622866 Stripify();
22632867 } else
2264
- if (event.getSource() == unstripifyItem)
2868
+ if (source == unstripifyItem)
22652869 {
22662870 Unstripify();
22672871 } else
2268
- if (event.getSource() == trimItem)
2872
+ if (source == trimItem)
22692873 {
22702874 Trim();
22712875 } else
2272
- if (event.getSource() == untrimItem)
2876
+ if (source == untrimItem)
22732877 {
22742878 Untrim();
22752879 } else
2276
- if (event.getSource() == clearColorsItem)
2880
+ if (source == clearColorsItem)
22772881 {
22782882 ClearColors();
22792883 } else
2280
- if (event.getSource() == clearMaterialsItem)
2884
+ if (source == clearMaterialsItem)
22812885 {
22822886 ClearMaterials();
22832887 } else
2284
- if (event.getSource() == liveleavesItem)
2888
+ if (source == liveleavesItem)
22852889 {
22862890 LiveLeaves(true);
22872891 } else
2288
- if (event.getSource() == unliveleavesItem)
2892
+ if (source == unliveleavesItem)
22892893 {
22902894 LiveLeaves(false);
22912895 } else
2292
- if (event.getSource() == supportleavesItem)
2896
+ if (source == supportleavesItem)
22932897 {
22942898 SupportLeaves(true);
22952899 } else
2296
- if (event.getSource() == unsupportleavesItem)
2900
+ if (source == unsupportleavesItem)
22972901 {
22982902 SupportLeaves(false);
22992903 } else
2300
- if (event.getSource() == hideleavesItem)
2904
+ if (source == hideleavesItem)
23012905 {
23022906 HideLeaves(true);
23032907 } else
2304
- if (event.getSource() == showleavesItem)
2908
+ if (source == showleavesItem)
23052909 {
23062910 HideLeaves(false);
23072911 } else
2308
- if (event.getSource() == markleavesItem)
2912
+ if (source == markleavesItem)
23092913 {
23102914 MarkLeaves(true);
23112915 } else
2312
- if (event.getSource() == unmarkleavesItem)
2916
+ if (source == unmarkleavesItem)
23132917 {
23142918 MarkLeaves(false);
23152919 } else
2316
- if (event.getSource() == flipVItem)
2920
+ if (source == rewindleavesItem)
2921
+ {
2922
+ RewindLeaves(true);
2923
+ } else
2924
+ if (source == unrewindleavesItem)
2925
+ {
2926
+ RewindLeaves(false);
2927
+ } else
2928
+ if (source == randomleavesItem)
2929
+ {
2930
+ RandomLeaves(true);
2931
+ } else
2932
+ if (source == unrandomleavesItem)
2933
+ {
2934
+ RandomLeaves(false);
2935
+ } else
2936
+ if (source == flipVItem)
23172937 {
23182938 FlipV(true);
23192939 } else
2320
- if (event.getSource() == unflipVItem)
2940
+ if (source == unflipVItem)
23212941 {
23222942 FlipV(false);
23232943 } else
2324
- if (event.getSource() == lowTexturesItem)
2944
+ if (source == lowTexturesItem)
23252945 {
23262946 SetTexRes(0);
23272947 } else
2328
- if (event.getSource() == normalTexturesItem)
2948
+ if (source == normalTexturesItem)
23292949 {
23302950 SetTexRes(1);
23312951 } else
2332
- if (event.getSource() == highTexturesItem)
2952
+ if (source == highTexturesItem)
23332953 {
23342954 SetTexRes(2);
23352955 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2956
+ if (source == veryhighTexturesItem)
23372957 {
23382958 SetTexRes(3);
23392959 } else
2340
- if (event.getSource() == maxTexturesItem)
2960
+ if (source == maxTexturesItem)
23412961 {
23422962 SetTexRes(4);
23432963 } else
2344
- if (event.getSource() == panoTexturesItem)
2964
+ if (source == panoTexturesItem)
23452965 {
23462966 SetTexRes(5);
23472967 } else
2348
- if (event.getSource() == reverseNormalsItem)
2968
+ if (source == reverseNormalsItem)
23492969 {
23502970 ReverseNormals();
23512971 } else
2352
- if (event.getSource() == parseverticesItem)
2972
+ if (source == parseverticesItem)
23532973 {
23542974 ParseVertices();
23552975 } else
2356
- if (event.getSource() == alignItem)
2976
+ if (source == textureFieldItem)
2977
+ {
2978
+ TextureVertices();
2979
+ } else
2980
+ if (source == alignItem)
23572981 {
23582982 Align();
23592983 } else
2360
- if (event.getSource() == mirrorItem)
2984
+ if (source == mirrorItem)
23612985 {
23622986 MirrorPoses();
23632987 } else
2364
- if (event.getSource() == reduceMorphItem)
2988
+ if (source == reduceMorphItem)
23652989 {
23662990 MeshReduction(false);
23672991 } else
2368
- if (event.getSource() == reduce34MorphItem)
2992
+ if (source == reduce34MorphItem)
23692993 {
23702994 MeshReduction(true);
23712995 } else
2372
- if (event.getSource() == reverseTrianglesItem)
2996
+ if (source == reverseTrianglesItem)
23732997 {
23742998 ReverseTriangles();
23752999 } else
2376
- if (event.getSource() == reduceMeshItem)
3000
+ if (source == reduceMeshItem)
23773001 {
23783002 ReduceMesh(false);
23793003 } else
2380
- if (event.getSource() == reduce34MeshItem)
3004
+ if (source == reduce34MeshItem)
23813005 {
23823006 ReduceMesh(true);
23833007 } else
2384
- if (event.getSource() == increaseMeshItem)
3008
+ if (source == increaseMeshItem)
23853009 {
23863010 IncreaseMesh();
23873011 } else
2388
- if (event.getSource() == clipMeshItem)
3012
+ if (source == clipMeshItem)
23893013 {
23903014 ClipMesh();
23913015 } else
2392
- if (event.getSource() == smoothMeshItem)
3016
+ if (source == smoothMeshItem)
23933017 {
23943018 SmoothMesh();
23953019 } else
2396
- if (event.getSource() == transformgeometryItem)
3020
+ if (source == transformGeometryItem)
23973021 {
23983022 TransformGeometry();
23993023 } else
2400
- if (event.getSource() == resetTransformItem)
3024
+ if (source == transformChildrenItem)
3025
+ {
3026
+ TransformChildren();
3027
+ } else
3028
+ if (source == resetTransformItem)
24013029 {
24023030 ResetTransform();
24033031 } else
2404
- if (event.getSource() == resetCentroidItem)
3032
+ if (source == resetCentroidItem)
24053033 {
2406
- ResetCentroid();
3034
+ ResetCentroid(true);
24073035 } else
2408
- if (event.getSource() == resetParentItem)
3036
+ if (source == resetCentroidXZItem)
3037
+ {
3038
+ ResetCentroid(false);
3039
+ } else
3040
+ if (source == resetParentItem)
24093041 {
24103042 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24113043 {
....@@ -2415,7 +3047,7 @@
24153047
24163048 refreshContents();
24173049 } else
2418
- if (event.getSource() == repairParentItem)
3050
+ if (source == repairParentItem)
24193051 {
24203052 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24213053 {
....@@ -2429,7 +3061,21 @@
24293061
24303062 refreshContents();
24313063 } else
2432
- if (event.getSource() == sortbysizeItem)
3064
+ if (source == repairShadowItem)
3065
+ {
3066
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3067
+ {
3068
+ Object3D obj = (Object3D)e.nextElement();
3069
+ obj.RepairShadow();
3070
+// for (int i=0; i<obj.size(); i++)
3071
+// {
3072
+// obj.get(i).parent = obj;
3073
+// }
3074
+ }
3075
+
3076
+ refreshContents();
3077
+ } else
3078
+ if (source == sortbysizeItem)
24333079 {
24343080 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353081 {
....@@ -2441,7 +3087,7 @@
24413087 ResetModel();
24423088 refreshContents();
24433089 } else
2444
- if (event.getSource() == sortbynameItem)
3090
+ if (source == sortbynameItem)
24453091 {
24463092 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473093 {
....@@ -2453,7 +3099,7 @@
24533099 ResetModel();
24543100 refreshContents();
24553101 } else
2456
- if (event.getSource() == attachPigmentItem)
3102
+ if (source == attachPigmentItem)
24573103 {
24583104 String texture = GetFile("Attach pigment");
24593105 Object3D obj;
....@@ -2465,7 +3111,7 @@
24653111
24663112 refreshContents();
24673113 } else
2468
- if (event.getSource() == detachPigmentItem)
3114
+ if (source == detachPigmentItem)
24693115 {
24703116 Object3D obj;
24713117 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3122,7 @@
24763122
24773123 refreshContents();
24783124 } else
2479
- if (event.getSource() == attachBumpItem)
3125
+ if (source == attachBumpItem)
24803126 {
24813127 String texture = GetFile("Attach bump");
24823128 Object3D obj;
....@@ -2488,7 +3134,7 @@
24883134
24893135 refreshContents();
24903136 } else
2491
- if (event.getSource() == detachBumpItem)
3137
+ if (source == detachBumpItem)
24923138 {
24933139 Object3D obj;
24943140 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +3145,7 @@
24993145
25003146 refreshContents();
25013147 } else
2502
- if (event.getSource() == pigmentBumpItem)
3148
+ if (source == pigmentBumpItem)
25033149 {
25043150 Object3D obj;
25053151 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +3156,237 @@
25103156
25113157 refreshContents();
25123158 } else
2513
- if (event.getSource() == flashSelectionButton)
3159
+ if (source == flashSelectionButton)
25143160 {
25153161 CameraPane.flash = true;
25163162 refreshContents();
25173163 } else
2518
- if (event.getSource() == oneButton)
3164
+ if (source == oneButton)
25193165 {
25203166 } else
2521
- if (event.getSource() == twoButton)
3167
+ if (source == twoButton)
25223168 {
25233169 radio.layout = twoButton;
3170
+
3171
+ if (CameraPane.FULLSCREEN)
3172
+ fullscreenLayout = radio.layout;
3173
+
25243174 // bug
25253175 //gridPanel.setDividerLocation(1.0);
25263176 //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();
3177
+// bigThree.remove(scenePanel);
3178
+// bigThree.remove(centralPanel);
3179
+// bigThree.remove(XYZPanel);
3180
+// aWindowConstraints.gridx = 0;
3181
+// aWindowConstraints.gridy = 0;
3182
+// aWindowConstraints.gridwidth = 1;
3183
+// // aConstraints.gridheight = 3;
3184
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3185
+// aWindowConstraints.weightx = 0;
3186
+// aWindowConstraints.weighty = 1;
3187
+// //bigThree.add(jtp, aWindowConstraints);
3188
+// aWindowConstraints.weightx = 1;
3189
+// aWindowConstraints.gridwidth = 3;
3190
+// // aConstraints.gridheight = 3;
3191
+// aWindowConstraints.gridx = 1;
3192
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3193
+// bigThree.add(centralPanel, aWindowConstraints);
3194
+// aWindowConstraints.weightx = 0;
3195
+// aWindowConstraints.gridx = 4;
3196
+// aWindowConstraints.gridwidth = 1;
3197
+// // aConstraints.gridheight = 3;
3198
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3199
+// //bigThree.add(XYZPanel, aWindowConstraints);
3200
+// scenePanel.setVisible(false);
3201
+// centralPanel.setVisible(true);
3202
+// XYZPanel.setVisible(false);
3203
+ bigThree.ClearUI();
3204
+ bigThree.add(centralPanel);
3205
+ bigThree.FlushUI();
3206
+
3207
+ cameraView.requestFocusInWindow();
3208
+
3209
+// refreshContents(true);
3210
+//
3211
+// try
3212
+// {
3213
+// java.awt.Robot bot = new java.awt.Robot();
3214
+// int mask = InputEvent.BUTTON1_MASK;
3215
+// bot.mouseMove(100, 100);
3216
+// bot.mousePress(mask);
3217
+// bot.mouseRelease(mask);
3218
+// }
3219
+// catch (Exception e)
3220
+// {
3221
+//
3222
+// }
3223
+
25513224 } else
2552
- if (event.getSource() == threeButton)
3225
+ if (source == threeButton)
25533226 {
25543227 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();
3228
+
3229
+ if (CameraPane.FULLSCREEN)
3230
+ fullscreenLayout = radio.layout;
3231
+
3232
+// bigThree.remove(scenePanel);
3233
+// bigThree.remove(centralPanel);
3234
+// bigThree.remove(XYZPanel);
3235
+// aWindowConstraints.gridx = 0;
3236
+// aWindowConstraints.gridy = 0;
3237
+// aWindowConstraints.gridwidth = 1;
3238
+// // aConstraints.gridheight = 3;
3239
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3240
+// aWindowConstraints.weightx = 0;
3241
+// aWindowConstraints.weighty = 1;
3242
+// //bigThree.add(jtp, aWindowConstraints);
3243
+// aWindowConstraints.weightx = 1;
3244
+// aWindowConstraints.gridwidth = 3;
3245
+// // aConstraints.gridheight = 3;
3246
+// aWindowConstraints.gridx = 1;
3247
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3248
+// bigThree.add(centralPanel, aWindowConstraints);
3249
+// aWindowConstraints.weightx = 0;
3250
+// aWindowConstraints.gridx = 4;
3251
+// aWindowConstraints.gridwidth = 1;
3252
+// // aConstraints.gridheight = 3;
3253
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3254
+// bigThree.add(XYZPanel, aWindowConstraints);
3255
+// bigThree.validate();
3256
+// scenePanel.setVisible(false);
3257
+// centralPanel.setVisible(true);
3258
+// XYZPanel.setVisible(true);
3259
+ bigThree.ClearUI();
3260
+ bigThree.add(centralPanel);
3261
+ bigThree.add(XYZPanel);
3262
+ bigThree.FlushUI();
3263
+
3264
+ cameraView.requestFocusInWindow();
25793265 } else
2580
- if (event.getSource() == fourButton)
3266
+ if (source == fourButton)
25813267 {
25823268 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();
3269
+
3270
+ if (CameraPane.FULLSCREEN)
3271
+ fullscreenLayout = radio.layout;
3272
+
3273
+// bigThree.remove(scenePanel);
3274
+// bigThree.remove(centralPanel);
3275
+// bigThree.remove(XYZPanel);
3276
+// aWindowConstraints.gridx = 0;
3277
+// aWindowConstraints.gridy = 0;
3278
+// aWindowConstraints.gridwidth = 1;
3279
+// // aWindowConstraints.gridheight = 3;
3280
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3281
+// aWindowConstraints.weightx = 1;
3282
+// aWindowConstraints.weighty = 1;
3283
+// bigThree.add(scenePanel, aWindowConstraints);
3284
+// aWindowConstraints.weightx = 1;
3285
+// aWindowConstraints.gridwidth = 3;
3286
+// // aConstraints.gridheight = 3;
3287
+// aWindowConstraints.gridx = 1;
3288
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3289
+// //bigThree.add(cameraPanel, aWindowConstraints);
3290
+// aWindowConstraints.weightx = 0;
3291
+// aWindowConstraints.gridx = 4;
3292
+// aWindowConstraints.gridwidth = 1;
3293
+// // aWindowConstraints.gridheight = 3;
3294
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3295
+// //bigThree.add(XYZPanel, aWindowConstraints);
3296
+// bigThree.validate();
3297
+// scenePanel.setVisible(true);
3298
+// centralPanel.setVisible(false);
3299
+// XYZPanel.setVisible(false);
3300
+ bigThree.ClearUI();
3301
+ bigThree.add(scenePanel);
3302
+ bigThree.FlushUI();
3303
+
3304
+ cameraView.requestFocusInWindow();
26073305 } else
2608
- if (event.getSource() == sixButton)
3306
+ if (source == sixButton)
26093307 {
26103308 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();
3309
+
3310
+ if (CameraPane.FULLSCREEN)
3311
+ fullscreenLayout = radio.layout;
3312
+
3313
+// bigThree.remove(scenePanel);
3314
+// bigThree.remove(centralPanel);
3315
+// bigThree.remove(XYZPanel);
3316
+// aWindowConstraints.gridx = 0;
3317
+// aWindowConstraints.gridy = 0;
3318
+// aWindowConstraints.gridwidth = 1;
3319
+// // aConstraints.gridheight = 3;
3320
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3321
+// aWindowConstraints.weightx = 0;
3322
+// aWindowConstraints.weighty = 1;
3323
+// bigThree.add(scenePanel, aWindowConstraints);
3324
+// aWindowConstraints.weightx = 1;
3325
+// aWindowConstraints.gridwidth = 3;
3326
+// // aWindowConstraints.gridheight = 3;
3327
+// aWindowConstraints.gridx = 1;
3328
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3329
+// bigThree.add(centralPanel, aWindowConstraints);
3330
+// aWindowConstraints.weightx = 0;
3331
+// aWindowConstraints.gridx = 4;
3332
+// aWindowConstraints.gridwidth = 1;
3333
+// // aWindowConstraints.gridheight = 3;
3334
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3335
+// //bigThree.add(XYZPanel, aConstraints);
3336
+// bigThree.validate();
3337
+// scenePanel.setVisible(true);
3338
+// centralPanel.setVisible(true);
3339
+// XYZPanel.setVisible(false);
3340
+ bigThree.ClearUI();
3341
+ bigThree.add(scenePanel);
3342
+ bigThree.add(centralPanel);
3343
+ bigThree.FlushUI();
3344
+
3345
+ cameraView.requestFocusInWindow();
26353346 } else
2636
- if (event.getSource() == sevenButton)
3347
+ if (source == sevenButton)
26373348 {
26383349 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();
3350
+
3351
+ if (CameraPane.FULLSCREEN)
3352
+ fullscreenLayout = radio.layout;
3353
+
3354
+// bigThree.remove(scenePanel);
3355
+// bigThree.remove(centralPanel);
3356
+// bigThree.remove(XYZPanel);
3357
+// aWindowConstraints.gridx = 0;
3358
+// aWindowConstraints.gridy = 0;
3359
+// aWindowConstraints.gridwidth = 1;
3360
+// // aWindowConstraints.gridheight = 3;
3361
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3362
+// aWindowConstraints.weightx = 0;
3363
+// aWindowConstraints.weighty = 1;
3364
+// bigThree.add(scenePanel, aWindowConstraints);
3365
+// aWindowConstraints.weightx = 1;
3366
+// aWindowConstraints.gridwidth = 3;
3367
+// // aWindowConstraints.gridheight = 3;
3368
+// aWindowConstraints.gridx = 1;
3369
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3370
+// bigThree.add(centralPanel, aWindowConstraints);
3371
+// aWindowConstraints.weightx = 0;
3372
+// aWindowConstraints.gridx = 4;
3373
+// aWindowConstraints.gridwidth = 1;
3374
+// // aConstraints.gridheight = 3;
3375
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3376
+// bigThree.add(XYZPanel, aWindowConstraints);
3377
+// bigThree.validate();
3378
+// scenePanel.setVisible(true);
3379
+// centralPanel.setVisible(true);
3380
+// XYZPanel.setVisible(true);
3381
+ bigThree.ClearUI();
3382
+ bigThree.add(scenePanel);
3383
+ bigThree.add(centralPanel);
3384
+ bigThree.add(XYZPanel);
3385
+ bigThree.FlushUI();
3386
+
3387
+ cameraView.requestFocusInWindow();
26633388 } else
2664
- if (event.getSource() == rootButton)
3389
+ if (source == rootButton)
26653390 {
26663391 Object3D obj;
26673392 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2671,66 +3396,84 @@
26713396 EditObject(obj);
26723397 }
26733398
3399
+ cameraView.requestFocusInWindow();
26743400 refreshContents(true);
26753401 } else
2676
- if (event.getSource() == closeButton)
3402
+ if (source == closeButton)
26773403 {
26783404 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793405 cRadio ab;
26803406 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813407 {
26823408 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3409
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843410 {
3411
+ // Patch to avoid bug with transparency.
3412
+ if (!ab.hadMaterial)
3413
+ {
3414
+ ab.object.material = null;
3415
+ }
3416
+
26853417 buttonGroup.remove(ab);
26863418 radioPanel.remove(ab);
26873419
2688
- ab.GetObject().editWindow = null;
3420
+ //ab.GetObject().editWindow = null;
3421
+ ab.GetObject().manipWindow = null;
26893422 // ab.GetObject().objectUI = null; // ?????????
26903423
26913424 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923425 break;
26933426 }
26943427 }
3428
+
3429
+ cameraView.requestFocusInWindow();
26953430 refreshContents(true);
26963431 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3432
+ if (source == editItem || source == editButton)
26983433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
26993440 EditSelection(false);
27003441 } else
2701
- if (event.getSource() == uneditButton)
3442
+ if (source == uneditButton)
27023443 {
27033444 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043445 {
27053446 Object3D child = (Object3D)e.nextElement();
27063447 if(child.editWindow != null)
27073448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
27083450 child.CloseUI();
27093451 listUI.remove(child);
27103452
2711
- child.editWindow = null; // ???????????
3453
+ //child.editWindow = null; // ???????????
27123454 }
2713
- objEditor.ctrlPanel.revalidate();
3455
+ objEditor.ctrlPanel.FlushUI();
27143456 //objEditor.jTree.clearSelection();
27153457 //objEditor.ResetSliders();
27163458 refreshContents(true);
27173459 } else
2718
- if (event.getSource() == clearPanelButton)
3460
+ if (source == clearPanelButton)
27193461 {
27203462 assert(copy == group);
27213463 //copy.ClearUI();
27223464 for (Object3D obj : listUI)
27233465 {
3466
+ obj.pinned = false;
27243467 obj.CloseUI();
27253468 }
27263469 listUI.clear();
27273470 refreshContents(true);
27283471 } else
2729
- if (event.getSource() == allParamsButton)
3472
+ if (source == allParamsButton)
27303473 {
27313474 assert(copy == group);
27323475
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27343477
27353478 for (Object3D obj : listUI)
27363479 {
....@@ -2747,19 +3490,19 @@
27473490
27483491 refreshContents(true);
27493492 } else
2750
- if (event.getSource() == unselectButton)
3493
+ if (source == unselectButton)
27513494 {
27523495 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3496
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543497 objEditor.ResetSliders();
27553498 refreshContents(true);
27563499 } else
2757
- if(event.getSource() instanceof cRadio)
3500
+ if(source instanceof cRadio)
27583501 {
27593502 group.parent = keepparent;
27603503 group.attributes = 0;
27613504 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3505
+ /*cRadio*/ radio = (cRadio)source;
27633506 Object3D obj = radio.GetObject();
27643507 System.out.println("Edit " + obj);
27653508 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +3522,10 @@
27793522 }
27803523
27813524 copy = group;
2782
- //CameraPane.theRenderer.object = group;
3525
+
3526
+ SetUndoStates();
3527
+
3528
+ //Globals.theRenderer.object = group;
27833529 if(!useclient)
27843530 {
27853531 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +3534,52 @@
27883534 cameraView.cameras[cameraView.cameracount] = radio.camera;
27893535 cameraView.targetLookAt.set(radio.camera.lookAt);
27903536 cameraView.object = group;
2791
- cameraView.lighttouched = true;
3537
+ //cameraView.lighttouched = true;
3538
+ Globals.lighttouched = true;
27923539 topView.object = group;
27933540 frontView.object = group;
27943541 sideView.object = group;
27953542 }
2796
- group.editWindow = this;
3543
+
3544
+// fix "+" issue
3545
+ //group.editWindow = this;
3546
+ group.manipWindow = this;
3547
+
27973548 /*
27983549 currentLayout = radio.layout;
27993550 if (currentLayout == null)
28003551 currentLayout = sevenButton;
28013552 */
28023553 radio.layout.doClick();
3554
+
3555
+ ClearUnpinned();
3556
+ Grafreed.Assert(group != null);
3557
+ Grafreed.Assert(group.selection != null);
3558
+ SetPinStates(group.selection.size() > 0);
3559
+ if (group.selection.size() == 1)
3560
+ EditSelection(false);
28033561 keepparent = group.parent;
28043562 // PARENT = NULL or not???
28053563 //group.parent = null; // ROOT
28063564 //group.attributes = -1;
28073565 ResetModel();
3566
+
3567
+ cameraView.requestFocusInWindow();
28083568 refreshContents(true);
2809
- }
3569
+ } else if (event.getSource() == editCameraItem)
3570
+ {
3571
+ cameraView.ProtectCamera();
3572
+ cameraView.repaint();
3573
+ return;
3574
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3575
+ {
3576
+ cameraView.RevertCamera();
3577
+ cameraView.repaint();
3578
+ return;
3579
+ // } else if (event.getSource() == textureButton)
3580
+ // {
3581
+ // return; // true;
3582
+ }
28103583 else
28113584 {
28123585 //return super.action(event, arg);
....@@ -2815,7 +3588,6 @@
28153588 }
28163589
28173590 boolean useclient = false;
2818
- cRadio radio;
28193591
28203592 void ToggleRoot()
28213593 {
....@@ -2824,7 +3596,7 @@
28243596 if (useclient)
28253597 {
28263598 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3599
+ Globals.lighttouched = true;
28283600 //topView.object = client;
28293601 //frontView.object = client;
28303602 //sideView.object = client;
....@@ -2832,7 +3604,7 @@
28323604 else
28333605 {
28343606 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3607
+ Globals.lighttouched = true;
28363608 //topView.object = group;
28373609 //frontView.object = group;
28383610 //sideView.object = group;
....@@ -2867,6 +3639,28 @@
28673639 refreshContents();
28683640 }
28693641
3642
+ void TransformChildren()
3643
+ {
3644
+ Object3D obj;
3645
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3646
+ {
3647
+ obj = (Object3D)e.nextElement();
3648
+ obj.KeepTextureMatrices();
3649
+ obj.TransformChildren();
3650
+ obj.RestoreTextureMatrices();
3651
+
3652
+// if (obj.parent == null)
3653
+// {
3654
+// System.out.println("NULL PARENT!");
3655
+// new Exception().printStackTrace();
3656
+// }
3657
+// else
3658
+// TouchTransform(obj);
3659
+// //obj.parent.Touch();
3660
+ }
3661
+
3662
+ refreshContents();
3663
+ }
28703664
28713665 void ResetTransform()
28723666 {
....@@ -2979,7 +3773,7 @@
29793773 refreshContents();
29803774 }
29813775
2982
- void ResetCentroid()
3776
+ void ResetCentroid(boolean full)
29833777 {
29843778 Object3D obj;
29853779 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +3788,16 @@
29943788 LA.matIdentity(Object3D.mat);
29953789 obj.getBounds(minima, maxima, false);
29963790 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3791
+ if (full)
3792
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29983793 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29993794 obj.TransformMesh(Object3D.mat);
3795
+
30003796 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3797
+ if (full)
3798
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30023799 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3800
+
30033801 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30043802 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30053803 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +3826,8 @@
30283826
30293827 int size = obj.MemorySize();
30303828
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
3829
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3830
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30323831 }
30333832 }
30343833 catch (Exception e)
....@@ -3065,9 +3864,9 @@
30653864 obj = (Object3D)e.nextElement();
30663865
30673866 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3867
+ Grafreed.AnalyzeObject(obj);
30693868 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3869
+ Grafreed.AnalyzeObject(obj.bRep);
30713870
30723871 // System.err.println((size/1024) + " KB is the size of " + obj);
30733872 }
....@@ -3109,6 +3908,20 @@
31093908 void GenNormals(boolean crease)
31103909 {
31113910 group.GenNormalsS(crease);
3911
+
3912
+ refreshContents();
3913
+ }
3914
+
3915
+ void GenNormalsMESH()
3916
+ {
3917
+ group.GenNormalsMeshS();
3918
+
3919
+ refreshContents();
3920
+ }
3921
+
3922
+ void GenNormalsMINE()
3923
+ {
3924
+ group.selection.GenNormalsMINE();
31123925
31133926 refreshContents();
31143927 }
....@@ -3157,104 +3970,259 @@
31573970
31583971 //Object3D buffer;
31593972 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
-
3973
+// BoundaryRep temprep;
3974
+// Object3D nodes;
3975
+// Vector<Vertex> vertices;
3976
+//
3977
+// cGroup buffer;
3978
+//
3979
+// public void Vertex(Object3D node, Vertex v)
3980
+// {
3981
+//// vertices.add(v);
3982
+//// nodes.addElement(node);
3983
+////
3984
+//// if (temprep.GetCache(v) != null)
3985
+//// {
3986
+//// temprep.Remove(v);
3987
+//// } else
3988
+//// {
3989
+//// temprep.Remember(v);
3990
+//// }
3991
+//
3992
+// //Object3D node = nodes.get(index);
3993
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
3994
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3995
+//
3996
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3997
+//
3998
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3999
+//
4000
+// cGroup g = new cGroup();
4001
+//
4002
+// if (g.toParent == null)
4003
+// {
4004
+// g.toParent = LA.newMatrix();
4005
+// g.fromParent = LA.newMatrix();
4006
+// }
4007
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4008
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4009
+//
4010
+// g.add(GrafreeD.clipboard);
4011
+//
4012
+// buffer.add(g);
4013
+// }
4014
+//
4015
+// public void Face(Object3D node, Face f)
4016
+// {
4017
+//
4018
+// }
4019
+//
4020
+// void ParseVerticesOld() // ??
4021
+// {
4022
+// //if (group.selection.size() != 1)
4023
+// // return;
4024
+//
4025
+// temprep = new BoundaryRep();
4026
+// nodes = new Object3D();
4027
+// vertices = new Vector<Vertex>();
4028
+//
4029
+// boolean epsequal = GrafreeD.epsequal;
4030
+// GrafreeD.epsequal = true;
4031
+//
4032
+// for (int i=0; i<group.selection.size(); i++)
4033
+// {
4034
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4035
+//
4036
+// group.selection.get(i).Parse(
4037
+//this );
4038
+//
4039
+// int repsize = temprep.VertexCount();
4040
+// int tablesize = temprep.vertextable.size();
4041
+// int nodesize = nodes.size();
4042
+//
4043
+// assert(vertices.size() == nodes.size());
4044
+//
4045
+// temprep.vertextable.elements();
4046
+//
4047
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4048
+//
4049
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
4050
+// {
4051
+// cGroup g = new cGroup();
4052
+//
4053
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
4054
+//
4055
+// Object3D node = nodes.get(index);
4056
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
4057
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4058
+//
4059
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4060
+//
4061
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4062
+//
4063
+// if (g.toParent == null)
4064
+// {
4065
+// g.toParent = LA.newMatrix();
4066
+// g.fromParent = LA.newMatrix();
4067
+// }
4068
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4069
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4070
+//
4071
+// g.add(GrafreeD.clipboard);
4072
+//
4073
+// buffer.add(g);
4074
+// }
4075
+//
4076
+// makeSomething(buffer, i==group.selection.size()-1);
4077
+// }
4078
+//
4079
+// GrafreeD.epsequal = epsequal;
4080
+//
4081
+// //buffer = null;
4082
+// temprep = null;
4083
+// nodes = null;
4084
+//
4085
+// refreshContents();
4086
+// }
4087
+
31844088 void ParseVertices()
31854089 {
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;
4090
+ boolean epsequal = Grafreed.epsequal;
4091
+ Grafreed.epsequal = true;
31954092
31964093 for (int i=0; i<group.selection.size(); i++)
31974094 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4095
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994096
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4097
+ group.selection.get(i).Parse(
4098
+
4099
+ new iParse()
4100
+ {
4101
+ public void Vertex(Object3D node, Vertex v)
4102
+ {
4103
+ temp.set(v);
4104
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054105
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();
4106
+ cGroup g = new cGroup();
32114107
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4108
+ if (g.toParent == null)
4109
+ {
4110
+ g.toParent = LA.newMatrix();
4111
+ g.fromParent = LA.newMatrix();
4112
+ }
4113
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4114
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154115
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);
4116
+ g.add(Grafreed.clipboard);
32204117
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);
4118
+ buffer.add(g);
4119
+ }
32324120
3233
- g.add(GraphreeD.clipboard);
4121
+ public void Face(Object3D node, Face f)
4122
+ {
32344123
3235
- buffer.add(g);
3236
- }
4124
+ }
4125
+ }
4126
+ );
32374127
32384128 makeSomething(buffer, i==group.selection.size()-1);
32394129 }
32404130
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4131
+ Grafreed.epsequal = epsequal;
32464132
32474133 refreshContents();
32484134 }
3249
-
4135
+
4136
+ void TextureVertices()
4137
+ {
4138
+ for (int i=0; i<group.selection.size(); i++)
4139
+ {
4140
+ group.selection.get(i).Parse(
4141
+ new iParse()
4142
+ {
4143
+ public void Vertex(Object3D node, Vertex v)
4144
+ {
4145
+ cTexture tex = node.GetTextures();
4146
+ String pigment = Object3D.GetPigment(tex);
4147
+ //String bump = Object3D.GetBump(tex);
4148
+
4149
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4150
+
4151
+ try
4152
+ {
4153
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4154
+ }
4155
+ catch (Exception e)
4156
+ {
4157
+ System.err.println("FAIL: " + node);
4158
+ }
4159
+
4160
+ double s = v.s;
4161
+
4162
+ if (s == 1)
4163
+ s = 0;
4164
+
4165
+ double t = v.t;
4166
+
4167
+ if (t == 1)
4168
+ t = 0;
4169
+
4170
+ int indexs = (int) (texturedata.getWidth() * s);
4171
+ int indext = (int) (texturedata.getHeight() * t);
4172
+
4173
+ int index = indext * texturedata.getWidth() + indexs;
4174
+
4175
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4176
+
4177
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4178
+
4179
+ float scale = bytebuf.get(index*slide) & 0xFF;
4180
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4181
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4182
+ scale /= 3;
4183
+
4184
+ scale /= 0xFF;
4185
+ // c'est quoi ca? scale /= 4;
4186
+
4187
+ //v.AO = scale;
4188
+
4189
+ v.x += v.norm.x * scale;
4190
+ v.y += v.norm.y * scale;
4191
+ v.z += v.norm.z * scale;
4192
+ }
4193
+
4194
+ public void Face(Object3D node, Face f)
4195
+ {
4196
+ }
4197
+ }
4198
+ );
4199
+ }
4200
+
4201
+ refreshContents();
4202
+ }
4203
+
32504204 void Align()
32514205 {
4206
+ if (group.selection.size() == 0)
4207
+ return;
4208
+
4209
+ cVector bbmin = new cVector();
4210
+ cVector bbmax = new cVector();
4211
+
4212
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4213
+
4214
+ double dx = bbmax.x - bbmin.x;
4215
+ double dy = bbmax.y - bbmin.y;
4216
+ double dz = bbmax.z - bbmin.z;
4217
+
4218
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4219
+
32524220 for (int i=0; i<group.selection.size(); i++)
32534221 {
32544222 Object3D obj = group.selection.get(i);
32554223
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4224
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4225
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584226 }
32594227
32604228 refreshContents();
....@@ -3267,7 +4235,7 @@
32674235 // ref.SaveSupports();
32684236 // Object3D par = ref.parent;
32694237 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4238
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714239 // ref.parent = par;
32724240 // ref.RestoreSupports();
32734241
....@@ -3275,11 +4243,11 @@
32754243
32764244 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774245
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4246
+ boolean random = CameraPane.SWITCH;
4247
+ CameraPane.SWITCH = false; // parse all random nodes
32804248 lowres.linkVerticesThis(null);
32814249 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4250
+ CameraPane.SWITCH = random;
32834251
32844252 System.err.flush();
32854253
....@@ -3297,7 +4265,7 @@
32974265 // lowres.SaveSupports();
32984266 // par = lowres.parent;
32994267 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4268
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014269 Object3D newlow = CloneObject(lowres, false);
33024270 newlow.name = sn.switchobject.get(i).name;
33034271 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4287,7 @@
33194287 return;
33204288
33214289 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4290
+ Object3D ref = Grafreed.clipboard.get(0);
33234291
33244292 Object3D newgroup = new Object3D("Po:" + poses.name);
33254293
....@@ -3488,7 +4456,7 @@
34884456 group.selection.RelinkToSupport(); // july 2014
34894457 System.out.println("DONE.");
34904458 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4459
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34924460 }
34934461
34944462 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +4481,20 @@
35134481
35144482 void ClipMesh()
35154483 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4484
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35174485 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
4486
+ Object3D content = Grafreed.clipboard.get(0);
35194487
35204488 if (content instanceof cGroup && ((cGroup)content).transientlink )
35214489 content = ((cGroup)content).get(0);
35224490
35234491 // for (int i=0; i<group.selection.size(); i++)
35244492 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4493
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264494 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4495
+ group.selection.ClipMesh(Grafreed.clipboard);
35284496 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4497
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304498 System.out.println("DONE.");
35314499 refreshContents();
35324500 }
....@@ -3571,6 +4539,18 @@
35714539 void MarkLeaves(boolean hide)
35724540 {
35734541 group.selection.MarkLeaves(hide);
4542
+ refreshContents();
4543
+ }
4544
+
4545
+ void RewindLeaves(boolean hide)
4546
+ {
4547
+ group.selection.RewindLeaves(hide);
4548
+ refreshContents();
4549
+ }
4550
+
4551
+ void RandomLeaves(boolean hide)
4552
+ {
4553
+ group.selection.RandomLeaves(hide);
35744554 refreshContents();
35754555 }
35764556
....@@ -3645,10 +4625,6 @@
36454625 // }
36464626 // }
36474627
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36524628 void EditSelection(boolean newWindow)
36534629 {
36544630 // aConstraints.gridy = 0;
....@@ -3656,10 +4632,10 @@
36564632 {
36574633 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36584634 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4635
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36604636
36614637 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
4638
+ if(elem != group || !newWindow)
36634639 {
36644640 // if (!(elem instanceof Composite))
36654641 // newWindow = false;
....@@ -3741,7 +4717,8 @@
37414717 //new Exception().printStackTrace();
37424718
37434719 freezemodel = true;
3744
-
4720
+ ClearUnpinned();
4721
+
37454722 /**/
37464723 //switch (event.id)
37474724 {
....@@ -3749,7 +4726,6 @@
37494726 //case 702: // Event.LIST_DESELECT
37504727 group.deselectAll();
37514728 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37534729 if (tps != null)
37544730 {
37554731 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +4734,39 @@
37584734
37594735 //if (child.parent != null)
37604736 //child.parent.addSelectee(child);
4737
+ objEditor.SetMaterial(child);
37614738 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37654739 }
37664740 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
4741
+// else
4742
+// {
4743
+// objEditor.SetMaterial(group); // .GetMaterial());
4744
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4745
+// System.err.println("info : " + group.GetPath());
4746
+// }
37734747
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4748
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37774749 CameraPane.flash = true;
37784750
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4751
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37804752 // a camera
37814753 {
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;
4754
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4755
+ {
4756
+ CameraPane.camerachangeframe = 0; // don't refuse it
4757
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4758
+ }
4759
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4760
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864761 }
37874762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
37884770 refreshContents();
37894771 //return true;
37904772 }
....@@ -3793,6 +4775,35 @@
37934775
37944776 freezemodel = false;
37954777 }
4778
+
4779
+ void SetPinStates(boolean enabled)
4780
+ {
4781
+ editButton.setEnabled(enabled);
4782
+ uneditButton.setEnabled(enabled);
4783
+ unselectButton.setEnabled(enabled);
4784
+ flashSelectionButton.setEnabled(enabled);
4785
+ }
4786
+
4787
+ void refreshContents(boolean cp)
4788
+ {
4789
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4790
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4791
+ {
4792
+ objEditor.ClearInfo(); // .GetMaterial());
4793
+
4794
+ for (int i=0; i < group.selection.Size(); i++)
4795
+ {
4796
+ Object3D child = (Object3D) group.selection.get(i);
4797
+
4798
+ objEditor.AddInfo(child, this, true);
4799
+ System.err.println("info : " + child.GetPath());
4800
+ }
4801
+
4802
+ objEditor.SetText(); // jan 2014
4803
+ }
4804
+
4805
+ super.refreshContents(cp);
4806
+ }
37964807
37974808 void linkSomething(Object3D thing)
37984809 {
....@@ -3864,16 +4875,19 @@
38644875 {
38654876 if (group.selection.isEmpty())
38664877 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4878
+
4879
+ Grafreed.clipboardIsTempGroup = false;
38684880 Composite tGroup = null;
38694881 if (group.selection.size() > 0) // 1)
38704882 {
38714883 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4884
+ Grafreed.clipboardIsTempGroup = true;
38734885 }
38744886
38754887 if (cut)
38764888 {
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
38774891 //int indices[] = jList.getSelectedIndices();
38784892 //for (int i = indices.length - 1; i >= 0; i--)
38794893 //jList.remove(indices[i]);
....@@ -3909,16 +4923,16 @@
39094923 //System.out.println("cut " + child);
39104924 //System.out.println("parent = " + child.parent);
39114925 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4926
+ if (Grafreed.clipboardIsTempGroup)
39134927 tGroup.add/*Child*/(tmp);
39144928 else
3915
- GraphreeD.clipboard = tmp;
4929
+ Grafreed.clipboard = tmp;
39164930 }
39174931 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4932
+ if (Grafreed.clipboardIsTempGroup)
39194933 tGroup.add/*Child*/(child);
39204934 else
3921
- GraphreeD.clipboard = child;
4935
+ Grafreed.clipboard = child;
39224936 }
39234937
39244938 //ResetModel();
....@@ -3950,21 +4964,23 @@
39504964 //System.out.println("cut " + elem);
39514965 //System.out.println("parent = " + elem.parent);
39524966 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4967
+ if (Grafreed.clipboardIsTempGroup)
39544968 tGroup.add/*Child*/(tmp);
39554969 else
3956
- GraphreeD.clipboard = tmp;
4970
+ Grafreed.clipboard = tmp;
39574971 }
39584972 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4973
+ if (Grafreed.clipboardIsTempGroup)
39604974 tGroup.add/*Child*/(child);
39614975 else
3962
- GraphreeD.clipboard = child;
4976
+ Grafreed.clipboard = child;
39634977 }
39644978
39654979 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4980
+
4981
+ if (Grafreed.clipboardIsTempGroup)
4982
+ Grafreed.clipboard = tGroup;
4983
+
39684984 if (cut)
39694985 {
39704986 ResetModel();
....@@ -3974,11 +4990,15 @@
39744990
39754991 void paste(boolean expand)
39764992 {
3977
- // if (GraphreeD.clipboard == null)
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
4997
+ // if (GrafreeD.clipboard == null)
39784998 // return;
39794999 boolean first = true;
39805000
3981
- if (GraphreeD.clipboardIsTempGroup)
5001
+ if (Grafreed.clipboardIsTempGroup)
39825002 {
39835003 Composite temp;
39845004
....@@ -3989,7 +5009,7 @@
39895009 temp = (Composite)Applet3D.clipboard.deepCopy();
39905010 */
39915011 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5012
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39935013 {
39945014 Object3D child = (Object3D)e.nextElement();
39955015
....@@ -4003,7 +5023,7 @@
40035023 else
40045024 elem = child.deepCopy(); // ?
40055025 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
5026
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40075027 // elem = elem.get(0);
40085028 makeSomething(elem, true); // ?? first);
40095029 //group.addChild(elem);
....@@ -4023,23 +5043,24 @@
40235043 //Object3D cb = Applet3D.clipboard;
40245044 //temp.addChild(cb);
40255045 //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());
5046
+ assert(Grafreed.clipboard.parent == null);
5047
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5048
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5049
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5050
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40315051 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
5052
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5053
+ Grafreed.clipboard.get(0).parent = keepparent;
40345054 }
40355055
5056
+ Globals.REPLACEONMAKE = keep;
40365057 ResetModel();
40375058 refreshContents();
40385059 }
40395060
4040
- void pasteInto(boolean copyit)
5061
+ void pasteInto(boolean copyit, boolean clone)
40415062 {
4042
-// if (GraphreeD.clipboard == null)
5063
+// if (GrafreeD.clipboard == null)
40435064 // return;
40445065
40455066 if (group.selection.size() != 1)
....@@ -4066,15 +5087,22 @@
40665087 if (copyit)
40675088 {
40685089 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5090
+ if (clone)
5091
+ {
5092
+ CloneClipboard(false); // sept 2014
5093
+ }
5094
+ else
5095
+ {
5096
+ paste(false);
5097
+ }
40705098 }
40715099 else
40725100 {
40735101 boolean first = true;
40745102
4075
- if (GraphreeD.clipboardIsTempGroup)
5103
+ if (Grafreed.clipboardIsTempGroup)
40765104 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5105
+ Composite temp = (Composite)Grafreed.clipboard;
40785106 Object3D copy;
40795107 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805108 {
....@@ -4084,7 +5112,7 @@
40845112 }
40855113 } else
40865114 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5115
+ linkSomething(Grafreed.clipboard); //.get(0));
40885116 }
40895117 }
40905118 }
....@@ -4161,6 +5189,10 @@
41615189
41625190 void group(Object3D csg, boolean grab)
41635191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
41645196 if (//false) // why??
41655197 !group.selection.isEmpty())
41665198 {
....@@ -4274,8 +5306,34 @@
42745306 //node.add(csg);
42755307 //makeSomething(node);
42765308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
42775310 }
42785311
5312
+ void Ungroup(Object3D g)
5313
+ {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
5318
+ if (g instanceof HiddenObject)
5319
+ {
5320
+ HiddenObject h = (HiddenObject) g;
5321
+
5322
+ for (int i=0; i<h.ActualSize(); i++)
5323
+ {
5324
+ objEditor.makeSomething(h.get(i), false);
5325
+ }
5326
+ }
5327
+ else
5328
+ {
5329
+ for (int i=0; i<g.Size(); i++)
5330
+ {
5331
+ objEditor.makeSomething(g.get(i), false);
5332
+ }
5333
+ }
5334
+ Globals.REPLACEONMAKE = keep;
5335
+ }
5336
+
42795337 void ungroup()
42805338 {
42815339 /*
....@@ -4469,21 +5527,6 @@
44695527 }
44705528 */
44715529
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
-
44875530 /*
44885531 public void Callback(Object obj)
44895532 {
....@@ -4507,26 +5550,9 @@
45075550 }
45085551 */
45095552
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
-
45275553 String GetFile(String dialogName)
45285554 {
4529
- if (GraphreeD.standAlone)
5555
+ if (Grafreed.standAlone)
45305556 {
45315557 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45325558 browser.show();
....@@ -4590,10 +5616,33 @@
45905616 cButton flashSelectionButton;
45915617 cButton editButton;
45925618 cButton uneditButton;
5619
+ JCheckBox allParamsButton;
45935620 cButton clearpanelButton;
4594
- cButton allParamsButton;
45955621 cButton unselectButton;
45965622
5623
+ cButton restoreCameraButton;
5624
+
5625
+ cButton saveButton;
5626
+ cButton oneStepButton;
5627
+
5628
+ cButton groupButton;
5629
+ cButton ungroupButton;
5630
+ cButton compositeButton;
5631
+ cButton switchButton;
5632
+ cButton loopButton;
5633
+ cButton textureButton;
5634
+
5635
+ cButton gridButton;
5636
+ cButton boxButton;
5637
+ cButton sphereButton;
5638
+ cButton coneButton;
5639
+ cButton torusButton;
5640
+ cButton superButton;
5641
+ cButton kleinButton;
5642
+ cButton particlesButton;
5643
+ cButton overlayButton;
5644
+ cButton lightButton;
5645
+
45975646 cButton screenfitButton;
45985647 cButton screenfitpointButton;
45995648 cButton snapobjectButton;
....@@ -4605,14 +5654,6 @@
46055654
46065655 cButton setsupportButton;
46075656
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
-
46165657 //
46175658 //Composite
46185659 Object3D // to do !!
....@@ -4622,9 +5663,11 @@
46225663 //JTree jTree;
46235664 private MenuItem lookAtItem;
46245665 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
5666
+ private MenuItem switchViewItem;
46265667 private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
5668
+ private MenuItem undoItem;
5669
+ private MenuItem redoItem;
5670
+ private JMenuItem duplicateItem;
46285671 private MenuItem cloneItem;
46295672 private MenuItem cloneSupportItem;
46305673 private MenuItem overwriteGeoItem;
....@@ -4635,8 +5678,9 @@
46355678 private MenuItem resetsupportItem;
46365679 private MenuItem resetreferencesItem;
46375680 private MenuItem linkverticesItem;
5681
+ private MenuItem relinkverticesItem;
46385682 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
5683
+ private MenuItem resetAllItem;
46405684 private MenuItem stepAllItem;
46415685 private MenuItem revertMeshItem;
46425686 private MenuItem poseMeshItem;
....@@ -4647,14 +5691,17 @@
46475691 private MenuItem mergeGeometriesItem;
46485692 private MenuItem copyItem;
46495693 private MenuItem pasteItem;
5694
+ private MenuItem pasteIntoItem;
46505695 private MenuItem pasteLinkItem;
46515696 private MenuItem pasteCloneItem;
46525697 private MenuItem pasteExpandItem;
46535698 private MenuItem clearItem;
46545699 private MenuItem clearAllItem;
46555700 private MenuItem genUVItem;
5701
+ private MenuItem genNormalsMESHItem;
46565702 private MenuItem genNormalsCADItem;
46575703 private MenuItem genNormalsORGANItem;
5704
+ private MenuItem genNormalsMINEItem;
46585705 private MenuItem stripifyItem;
46595706 private MenuItem unstripifyItem;
46605707 private MenuItem trimItem;
....@@ -4683,6 +5730,10 @@
46835730 private MenuItem showleavesItem;
46845731 private MenuItem markleavesItem;
46855732 private MenuItem unmarkleavesItem;
5733
+ private MenuItem rewindleavesItem;
5734
+ private MenuItem unrewindleavesItem;
5735
+ private MenuItem randomleavesItem;
5736
+ private MenuItem unrandomleavesItem;
46865737
46875738 private MenuItem flipVItem;
46885739 private MenuItem unflipVItem;
....@@ -4694,14 +5745,17 @@
46945745 private MenuItem panoTexturesItem;
46955746
46965747 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
5748
+ private MenuItem resetCentroidXZItem;
46985749 private MenuItem resetTransformItem;
5750
+ private MenuItem transformGeometryItem;
5751
+ private MenuItem transformChildrenItem;
5752
+ private MenuItem hideItem;
46995753 private MenuItem grabItem;
47005754 private MenuItem backItem;
47015755 private MenuItem frontItem;
47025756 private MenuItem cameraItem;
47035757 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
5758
+ private MenuItem switchItem;
47055759 private MenuItem physicsItem;
47065760 private MenuItem frameselectorItem;
47075761 private MenuItem scriptNodeItem;
....@@ -4716,6 +5770,7 @@
47165770
47175771 private MenuItem resetParentItem;
47185772 private MenuItem repairParentItem;
5773
+ private MenuItem repairShadowItem;
47195774 private MenuItem sortbysizeItem;
47205775 private MenuItem sortbynameItem;
47215776
....@@ -4728,16 +5783,19 @@
47285783 private MenuItem particleItem;
47295784 private MenuItem ragdollItem;
47305785 private MenuItem ragdoll2Item;
5786
+ private MenuItem heightFieldItem;
5787
+ private MenuItem textureFieldItem;
47315788 private MenuItem gridItem;
47325789 private MenuItem rectoidItem;
47335790 private MenuItem ellipsoidItem;
47345791 private MenuItem coneItem;
47355792 private MenuItem torusItem;
47365793 private MenuItem superItem;
5794
+ private MenuItem kleinItem;
47375795 private MenuItem blobItem;
47385796 private MenuItem latheItem;
47395797 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
5798
+ private MenuItem overlayItem;
47415799 private MenuItem meshItem;
47425800 // private MenuItem meshGroupItem;
47435801 private MenuItem springItem;
....@@ -4746,6 +5804,7 @@
47465804 private MenuItem csgItem;
47475805 private MenuItem templateItem;
47485806 private MenuItem textureItem;
5807
+ private MenuItem billboardItem;
47495808 private MenuItem shadowXItem;
47505809 private MenuItem shadowYItem;
47515810 private MenuItem shadowZItem;
....@@ -4758,11 +5817,6 @@
47585817 private MenuItem doubleItem;
47595818 private MenuItem tripleItem;
47605819
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47665820 private MenuItem computeAOItem;
47675821 private MenuItem recompileItem;
47685822 private MenuItem editScriptItem;
....@@ -4772,4 +5826,8 @@
47725826 private MenuItem analyzeItem;
47735827 private MenuItem dumpItem;
47745828 //boolean freezemodel = false;
5829
+
5830
+ Menu cameraMenu;
5831
+ MenuItem editCameraItem;
5832
+ MenuItem restoreCameraItem;
47755833 }