Normand Briere
2019-07-21 76522bc3ee92bd50dbd946d7f865666be4ad7bac
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,17 +80,29 @@
7380 this.copy = this.group = copy;
7481 //selectees = this.group.selectees;
7582
76
- SetupMenu2(objEditor);
83
+ SetupMenu2(this); //objEditor);
7784 SetupUI2(objEditor);
7885 objEditor.SetupUI(true);
7986 SetupViews(objEditor);
8087
8188 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
89
+
90
+ if (copy.versions == null)
91
+ {
92
+ copy.versions = new byte[100][];
93
+ copy.versionindex = -1;
94
+
95
+ Save(true);
96
+ }
8297 }
8398
8499 void CloneSelection(boolean supports)
85100 {
86
- // Object3D keep = GraphreeD.clipboard;
101
+ if (Globals.REPLACEONMAKE)
102
+ Save();
103
+ boolean keep = Globals.REPLACEONMAKE;
104
+ Globals.REPLACEONMAKE = false;
105
+ // Object3D keep = GrafreeD.clipboard;
87106 //Object3D obj;
88107 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
89108 {
....@@ -93,18 +112,19 @@
93112
94113 makeSomething(clone, i==group.selection.size()-1);
95114 }
115
+ Globals.REPLACEONMAKE = keep;
96116 }
97117
98118 void CloneClipboard(boolean supports)
99119 {
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));
120
+ assert(Grafreed.clipboard.parent == null);
121
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
122
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
123
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
124
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105125 else
106
- makeSomething(CloneObject(GraphreeD.clipboard, false));
107
- GraphreeD.clipboard.get(0).parent = keepparent;
126
+ makeSomething(CloneObject(Grafreed.clipboard, false));
127
+ Grafreed.clipboard.get(0).parent = keepparent;
108128 }
109129
110130 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +138,7 @@
118138 // obj.support = null;
119139 if (!supports)
120140 obj.SaveSupports();
121
- Object3D clone = (Object3D)GraphreeD.clone(obj);
141
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122142 obj.parent = parent;
123143 // obj.support = support;
124144 // clone.support = support; // aout 2013
....@@ -147,30 +167,29 @@
147167
148168 //JTextField nameField;
149169
150
- void SetupMenu2(ObjEditor oe)
170
+ void SetupMenu2(GroupEditor oe)
151171 {
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);
172
+ oe.jTree = new cTree();
173
+
163174 Menu menu;
164175 oe.menuBar.add(menu = new Menu("Edit"));
165176 //editItem = menu.add(new MenuItem("Edit"));
166177 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
178
+
179
+// undoItem = menu.add(new MenuItem("Undo"));
180
+// undoItem.addActionListener(this);
181
+// redoItem = menu.add(new MenuItem("Redo"));
182
+// redoItem.addActionListener(this);
183
+// menu.add("-");
184
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168185 duplicateItem.addActionListener(this);
169
- menu.add("-");
170186 cloneItem = menu.add(new MenuItem("Clone"));
171187 cloneItem.addActionListener(this);
188
+ if (Globals.ADVANCED)
189
+ {
172190 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173191 cloneSupportItem.addActionListener(this);
192
+ }
174193 menu.add("-");
175194 cutItem = menu.add(new MenuItem("Cut"));
176195 cutItem.addActionListener(this);
....@@ -178,26 +197,123 @@
178197 copyItem.addActionListener(this);
179198 pasteItem = menu.add(new MenuItem("Paste"));
180199 pasteItem.addActionListener(this);
200
+
201
+ menu.add("-");
202
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
203
+ pasteIntoItem.addActionListener(this);
181204 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182205 pasteLinkItem.addActionListener(this);
183206 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184207 pasteCloneItem.addActionListener(this);
185208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186209 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
210
+ menu.add("-");
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
213
+
214
+ if (Globals.ADVANCED)
215
+ {
216
+ // Deletes the cameras...
189217 clearAllItem = menu.add(new MenuItem("Clear All"));
190218 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);
219
+ }
220
+
221
+ menuBar.add(cameraMenu = new Menu("View"));
222
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
223
+ //zBufferItem.addActionListener(this);
224
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
225
+ //normalLensItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
228
+
229
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
230
+// toggleFullScreenItem.addItemListener(this);
231
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
232
+// cameraMenu.add("-");
233
+//
234
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
235
+// toggleTextureItem.addItemListener(this);
236
+// toggleTextureItem.setState(CameraPane.textureon);
237
+//
238
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
239
+// toggleSwitchItem.addItemListener(this);
240
+// toggleSwitchItem.setState(CameraPane.SWITCH);
241
+
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
243
+ toggleHandleItem.addItemListener(this);
244
+ toggleHandleItem.setState(CameraPane.HANDLES);
245
+
246
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
247
+ togglePaintItem.addItemListener(this);
248
+ togglePaintItem.setState(CameraPane.PAINTMODE);
249
+
250
+ if (Globals.ADVANCED)
251
+ {
252
+ cameraMenu.add("-");
253
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
254
+ toggleLiveItem.addItemListener(this);
255
+ toggleLiveItem.setState(Globals.isLIVE());
256
+
257
+ cameraMenu.add(stepItem = new MenuItem("Step"));
258
+ stepItem.addActionListener(this);
259
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
260
+ // toggleDLItem.addItemListener(this);
261
+ // toggleDLItem.setState(false);
262
+
263
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
264
+ toggleRenderItem.addItemListener(this);
265
+ toggleRenderItem.setState(!CameraPane.frozen);
266
+
267
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
268
+ toggleDebugItem.addItemListener(this);
269
+ toggleDebugItem.setState(Globals.DEBUG);
270
+
271
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
272
+ toggleFrustumItem.addItemListener(this);
273
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
274
+
275
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
276
+ toggleFootContactItem.addItemListener(this);
277
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
278
+
279
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
280
+ toggleTimelineItem.addItemListener(this);
281
+ }
282
+
283
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
284
+// toggleRootItem.addItemListener(this);
285
+// toggleRootItem.setState(false);
286
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
287
+// animationItem.addItemListener(this);
288
+// animationItem.setState(CameraPane.ANIMATION);
289
+ cameraMenu.add("-");
290
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
291
+ editCameraItem.addActionListener(this);
292
+
293
+ if (Globals.ADVANCED)
294
+ {
295
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
296
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
298
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
299
+ oe.cameraMenu.add("-");
300
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
301
+ openWindowItem.addActionListener(this);
302
+ editLeafItem.addActionListener(this);
303
+ lookAtItem.addActionListener(this);
304
+ //lookFromItem.addActinoListener(this);
305
+ //switchViewItem.addActionListener(this);
306
+ }
307
+
308
+ oe.menuBar.add(menu = new Menu("Setting"));
309
+ if (Globals.ADVANCED)
310
+ {
196311 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
197312 revertMeshItem.addActionListener(this);
198313 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
199314 resetreferencesItem.addActionListener(this);
200315 menu.add("-");
316
+ }
201317 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
202318 overwriteGeoItem.addActionListener(this);
203319 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -209,72 +325,104 @@
209325 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
210326 overwriteUVItem.addActionListener(this);
211327 menu.add("-");
328
+ if (Globals.ADVANCED)
329
+ {
212330 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
213331 generateMeshItem.addActionListener(this);
214332 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
215333 poseMeshItem.addActionListener(this);
216334 menu.add("-");
335
+ }
217336 resetsupportItem = menu.add(new MenuItem("Reset support"));
218337 resetsupportItem.addActionListener(this);
219338 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220339 linkverticesItem.addActionListener(this);
340
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
341
+ relinkverticesItem.addActionListener(this);
342
+
343
+ if (Globals.ADVANCED)
344
+ {
221345 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222346 setMasterItem.addActionListener(this);
347
+ }
223348
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);
349
+ oe.menuBar.add(menu = new Menu("Group"));
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
229352 backItem = menu.add(new MenuItem("Back"));
230353 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);
354
+ frontItem = menu.add(new MenuItem("Front"));
355
+ frontItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
361
+ hideItem = menu.add(new MenuItem("Hidden Group"));
362
+ hideItem.addActionListener(this);
363
+ }
364
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
365
+ ungroupItem.addActionListener(this);
366
+
367
+// menu.add("-");
368
+//
369
+// switchItem = menu.add(new MenuItem("Switch node"));
370
+// switchItem.addActionListener(this);
371
+ if (Globals.ADVANCED)
372
+ {
240373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
241374 switchGeoItem.addActionListener(this);
242375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
243376 switchTransfoItem.addActionListener(this);
244
- morphItem = menu.add(new MenuItem("Morph"));
377
+ morphItem = menu.add(new MenuItem("Morph Group"));
245378 morphItem.addActionListener(this);
379
+
380
+ menu.add("-");
381
+ physicsItem = menu.add(new MenuItem("Physics"));
382
+ physicsItem.addActionListener(this);
383
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
384
+ frameselectorItem.addActionListener(this);
246385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
247386 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);
387
+ }
388
+
389
+ oe.menuBar.add(menu = new Menu("Object"));
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
392
+ billboardItem = menu.add(new MenuItem("Billboard"));
393
+ billboardItem.addActionListener(this);
253394 csgItem = menu.add(new MenuItem("CSG"));
254395 csgItem.addActionListener(this);
255
- shadowXItem = menu.add(new MenuItem("Shadow X"));
396
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
256397 shadowXItem.addActionListener(this);
257
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
398
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
258399 shadowYItem.addActionListener(this);
259
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
400
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
260401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
405
+ if (Globals.ADVANCED)
406
+ {
407
+ menu.add("-");
261408 linkerItem = menu.add(new MenuItem("Linker"));
262409 linkerItem.addActionListener(this);
263410 templateItem = menu.add(new MenuItem("Template"));
264411 templateItem.addActionListener(this);
265
- attributeItem = menu.add(new MenuItem("Attribute"));
266
- attributeItem.addActionListener(this);
267412 pointflowItem = menu.add(new MenuItem("Point Flow"));
268413 pointflowItem.addActionListener(this);
414
+ }
269415 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272416 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273417 resetTransformItem.addActionListener(this);
274418 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275419 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
420
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
421
+ resetCentroidXZItem.addActionListener(this);
422
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
423
+ transformGeometryItem.addActionListener(this);
424
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
425
+ transformChildrenItem.addActionListener(this);
278426
279427 oe.menuBar.add(menu = new Menu("Geometry"));
280428 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +431,13 @@
283431 genNormalsORGANItem.addActionListener(this);
284432 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285433 genNormalsCADItem.addActionListener(this);
434
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
435
+ genNormalsMESHItem.addActionListener(this);
436
+ if (Globals.ADVANCED)
437
+ {
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
439
+ genNormalsMINEItem.addActionListener(this);
440
+ }
286441 stripifyItem = menu.add(new MenuItem("Stripify"));
287442 stripifyItem.addActionListener(this);
288443 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +447,6 @@
292447 untrimItem = menu.add(new MenuItem("Untrim"));
293448 untrimItem.addActionListener(this);
294449 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297450 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298451 clearColorsItem.addActionListener(this);
299452 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -306,19 +459,34 @@
306459 reduce34MeshItem.addActionListener(this);
307460 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308461 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311462 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312463 clipMeshItem.addActionListener(this);
464
+
465
+ if (Globals.ADVANCED)
466
+ {
467
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
468
+ smoothMeshItem.addActionListener(this);
469
+ }
470
+
471
+ oe.menuBar.add(menu = new Menu("Attributes"));
472
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
473
+ clearMaterialsItem.addActionListener(this);
474
+ resetAllItem = menu.add(new MenuItem("Reset All"));
475
+ resetAllItem.addActionListener(this);
476
+ stepAllItem = menu.add(new MenuItem("Step All"));
477
+ stepAllItem.addActionListener(this);
313478 menu.add("-");
314479 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315480 liveleavesItem.addActionListener(this);
316481 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
317482 unliveleavesItem.addActionListener(this);
483
+ if (Globals.ADVANCED)
484
+ {
318485 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
319486 supportleavesItem.addActionListener(this);
320487 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
321488 unsupportleavesItem.addActionListener(this);
489
+ }
322490 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
323491 hideleavesItem.addActionListener(this);
324492 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -327,32 +495,31 @@
327495 markleavesItem.addActionListener(this);
328496 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
329497 unmarkleavesItem.addActionListener(this);
498
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
499
+ rewindleavesItem.addActionListener(this);
500
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
501
+ unrewindleavesItem.addActionListener(this);
502
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
503
+ randomleavesItem.addActionListener(this);
504
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
505
+ unrandomleavesItem.addActionListener(this);
330506 menu.add("-");
331507 flipVItem = menu.add(new MenuItem("Flip V"));
332508 flipVItem.addActionListener(this);
333509 unflipVItem = menu.add(new MenuItem("Unflip V"));
334510 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
511
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336512 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
513
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338514 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
515
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340516 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
517
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342518 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
519
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344520 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
521
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346522 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);
356523
357524 oe.menuBar.add(menu = new Menu("Selection"));
358525 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -370,14 +537,42 @@
370537 sortbysizeItem.addActionListener(this);
371538 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372539 sortbynameItem.addActionListener(this);
540
+ menu.add("-");
541
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
542
+ shareGeometriesItem.addActionListener(this);
543
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
544
+ mergeGeometriesItem.addActionListener(this);
545
+ if (Globals.ADVANCED)
546
+ {
547
+ // Pretty much the same as duplicate and clone.
548
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
549
+ extractGeometriesItem.addActionListener(this);
550
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
551
+ cloneGeometriesItem.addActionListener(this);
552
+ }
553
+
373554 oe.menuBar.add(menu = new Menu("Insert"));
374555 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
556
+
557
+ oe.menuBar.add(menu = new Menu("Tools"));
376558 buildToolsMenu(menu);
377559 }
378560
561
+
379562 void SetupUI2(ObjEditor oe)
380563 {
564
+ // June 2019
565
+ if (oe == null)
566
+ {
567
+ //super.SetupUI2(this);
568
+ //return;
569
+ }
570
+
571
+ if (copy != group)
572
+ {
573
+ //super.SetupUI2(this);
574
+ }
575
+
381576 //new Exception().printStackTrace();
382577
383578 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -406,150 +601,231 @@
406601 oe.radioPanel.add(dummyButton);
407602 oe.buttonGroup.add(dummyButton);
408603 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
604
+ cGridBag copyOptionsPanel = new cGridBag();
605
+
606
+ copyOptionsPanel.preferredHeight = 1;
412607
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
608
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
609
+
610
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ //minButton.setToolTipText("Minimize window");
612
+ //minButton.addActionListener(this);
613
+
614
+ if (Globals.ADVANCED)
615
+ {
616
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617
+ maxButton.setToolTipText("Maximize window");
618
+ maxButton.addActionListener(this);
619
+ }
620
+
621
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
622
+ fullButton.setToolTipText("Full-screen window");
623
+ fullButton.addActionListener(this);
624
+
625
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
+ screenfitButton.setToolTipText("Screen fit");
627
+ screenfitButton.addActionListener(this);
628
+
629
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreCameraButton.setToolTipText("Restore viewpoint");
631
+ restoreCameraButton.addActionListener(this);
632
+
633
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ saveButton.setToolTipText("New version");
635
+ saveButton.addActionListener(this);
636
+
637
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
+ undoButton.setToolTipText("Previous version");
639
+ undoButton.addActionListener(this);
640
+ undoButton.setEnabled(false);
641
+
642
+ cGridBag updown = new cGridBag().setVertical(true);
643
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ restoreButton.setToolTipText("Restore current");
645
+ restoreButton.addActionListener(this);
646
+ restoreButton.setEnabled(false);
647
+
648
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ replaceButton.setToolTipText("Replace current");
650
+ replaceButton.addActionListener(this);
651
+ replaceButton.setEnabled(false);
652
+
653
+ copyOptionsPanel.add(updown);
654
+
655
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ redoButton.setToolTipText("Next version");
657
+ redoButton.addActionListener(this);
658
+ redoButton.setEnabled(false);
659
+
660
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
661
+ liveCB.setToolTipText("Enable animation");
414662 liveCB.addItemListener(this);
415663
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);
664
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
+ oneStepButton.setToolTipText("Animate one step forward");
666
+ oneStepButton.addActionListener(this);
667
+
668
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
669
+ fastCB.setToolTipText("Fast mode");
434670 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);
671
+
672
+ //oe.toolboxPanel.Return();
673
+
674
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
675
+// trackCB.setToolTipText("Enable tracking");
676
+// trackCB.addItemListener(this);
441677
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;
482678 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
483679 // 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;
488680
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;
681
+ if (Globals.ADVANCED)
682
+ {
683
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ snapobjectButton.addActionListener(this);
685
+ snapobjectButton.setToolTipText("Snap Object");
686
+ }
687
+
688
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
499689
500
- //
501
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
502
- twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504691 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
692
+ fourButton.setToolTipText("Show left panel only");
693
+
694
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ twoButton.setToolTipText("Show right view only");
696
+ twoButton.addActionListener(this);
697
+ this.fullscreenLayout = twoButton;
698
+
699
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ sixButton.setToolTipText("Show left and right");
506701 sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
508
- threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
510
- sevenButton.addActionListener(this);
702
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+// threeButton.setToolTipText("2-column layout right");
704
+// threeButton.addActionListener(this);
705
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
706
+// sevenButton.setToolTipText("3-column layout");
707
+// sevenButton.addActionListener(this);
511708 //
512709
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
710
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ rootButton.setToolTipText("Open selection in new tab");
514712 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
713
+
714
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ closeButton.setToolTipText("Close tab");
517716 closeButton.addActionListener(this);
518717 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
519718 //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;
528719
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
720
+ // INSERT
721
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
722
+ gridButton.setToolTipText("Create grid");
723
+ gridButton.addActionListener(this);
724
+
725
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
726
+ boxButton.setToolTipText("Create box");
727
+ boxButton.addActionListener(this);
728
+
729
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ sphereButton.setToolTipText("Create sphere");
731
+ sphereButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ coneButton.setToolTipText("Create cone");
735
+ coneButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ torusButton.setToolTipText("Create torus");
739
+ torusButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ superButton.setToolTipText("Create superellipsoid");
743
+ superButton.addActionListener(this);
744
+
745
+ if (Globals.ADVANCED)
746
+ {
747
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ kleinButton.setToolTipText("Create Klein bottle");
749
+ kleinButton.addActionListener(this);
750
+ }
751
+
752
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ particlesButton.setToolTipText("Create particle system");
754
+ particlesButton.addActionListener(this);
755
+
756
+ oe.toolboxPanel.Return();
757
+
758
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
759
+ groupButton.setToolTipText("Create group");
760
+ groupButton.addActionListener(this);
761
+
762
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
763
+ compositeButton.setToolTipText("Create composite");
764
+ compositeButton.addActionListener(this);
765
+
766
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
767
+ switchButton.setToolTipText("Create item switcher");
768
+ switchButton.addActionListener(this);
769
+
770
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ loopButton.setToolTipText("Create loop");
772
+ loopButton.addActionListener(this);
773
+
774
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ textureButton.setToolTipText("Create texture");
776
+ textureButton.addActionListener(this);
777
+
778
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
779
+ overlayButton.setToolTipText("Create overlay");
780
+ overlayButton.addActionListener(this);
781
+
782
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
783
+ lightButton.setToolTipText("Create light");
784
+ lightButton.addActionListener(this);
785
+
786
+ for (int i=6; --i>=0;)
787
+ {
788
+ oe.toolboxPanel.Return();
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ oe.toolboxPanel.add(new cGridBag());
794
+ oe.toolboxPanel.add(new cGridBag());
795
+ oe.toolboxPanel.add(new cGridBag());
796
+ }
797
+
798
+ // EDIT panel
799
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editButton.setToolTipText("Pin selection controls");
801
+ editButton.addActionListener(this);
802
+
803
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ uneditButton.setToolTipText("Remove selection controls");
530805 uneditButton.addActionListener(this);
531806
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);
807
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
808
+ allParamsButton.setToolTipText("Show all controle");
544809 allParamsButton.addActionListener(this);
545810
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);
811
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
812
+ clearPanelButton.setToolTipText("Clear edit panel");
813
+ clearPanelButton.addActionListener(this);
814
+
815
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
816
+ unselectButton.setToolTipText("Unselect");
551817 unselectButton.addActionListener(this);
552818
819
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
820
+ flashSelectionButton.setToolTipText("Highlight selection");
821
+ flashSelectionButton.addActionListener(this);
822
+
823
+ editCommandsPanel.preferredHeight = 1;
824
+
825
+ SetPinStates(false);
826
+// oe.treePanel.add(commandsPanel);
827
+// oe.treePanel.Return();
828
+
553829 // oe.aConstraints.gridx += 1;
554830 // oe.aConstraints.weighty = 0;
555831 // oe.aConstraints.gridwidth = 1;
....@@ -561,40 +837,25 @@
561837 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
562838 // gcButton.addActionListener(this);
563839
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;
840
+ cGridBag jSPPanel = new cGridBag();
841
+
842
+ JScrollPane jSP;
575843 //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);
844
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
577845 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;
597846
847
+ oe.treePanel.add(jSPPanel);
848
+ oe.treePanel.Return();
849
+
850
+ oe.treePanel.add(copyOptionsPanel);
851
+ oe.treePanel.Return();
852
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
853
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
854
+ sliderPane.preferredHeight = 1;
855
+
856
+// mainPanel.setDividerLocation(0.5); //1.0);
857
+// mainPanel.setResizeWeight(0.5);
858
+
598859 //jList.addListSelectionListener(this);
599860 oe.jTree.addTreeSelectionListener(this);
600861 //jTree.setRootVisible(false);
....@@ -613,23 +874,160 @@
613874 dgr.addDragGestureListener(this);
614875 }catch(Exception e) {}
615876 */
616
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
617878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
618879 }
880
+
881
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
882
+ {
883
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
884
+ colorCB.setToolTipText("Copy color when dropped");
885
+ colorCB.addItemListener(this);
886
+
887
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
888
+ materialCB.setToolTipText("Copy material when dropped");
889
+ materialCB.addItemListener(this);
890
+
891
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
892
+ textureCB.setToolTipText("Copy texture when dropped");
893
+ textureCB.addItemListener(this);
894
+
895
+ panel.Return();
896
+
897
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
898
+ boxCB.setToolTipText("Display bounding boxes");
899
+ boxCB.addItemListener(this);
900
+
901
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
902
+ zoomBoxCB.setToolTipText("Display only for wheel");
903
+ zoomBoxCB.addItemListener(this);
904
+
905
+ if (true) // Globals.ADVANCED)
906
+ {
907
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
908
+// supportCB.setToolTipText("Enable rigging");
909
+// supportCB.addItemListener(this);
910
+
911
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
912
+ freezeCB.setToolTipText("Fast moving camera");
913
+ freezeCB.addItemListener(this);
914
+
915
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
916
+ // localCB.addItemListener(this);
917
+
918
+ panel.Return();
919
+
920
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
921
+ crowdCB.setToolTipText("Used for crowds");
922
+ crowdCB.addItemListener(this);
923
+
924
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
925
+ smoothCB.setToolTipText("Snapping delay");
926
+ smoothCB.addItemListener(this);
927
+
928
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
929
+ slowCB.setToolTipText("Smooth interpolation");
930
+ slowCB.addItemListener(this);
931
+
932
+// constraints.gridy += 1;
933
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
934
+// speakerMocapCB.addItemListener(this);
935
+
936
+ panel.Return();
937
+
938
+ if (false)
939
+ {
940
+ // handled in scripts
941
+ //constraints.gridy += 1;
942
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
943
+ speakerCameraCB.addItemListener(this);
944
+
945
+ //constraints.gridy += 1;
946
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
947
+ speakerFocusCB.addItemListener(this);
948
+
949
+ //constraints.gridy += 1;
950
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
951
+ smoothfocusCB.addItemListener(this);
952
+ panel.Return();
953
+ }
954
+
955
+//constraints.gridx += 1;
956
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
957
+// debugCB.addItemListener(this);
958
+
959
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
960
+ trackCB.setToolTipText("Enable tracking target");
961
+ trackCB.addItemListener(this);
962
+
963
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
964
+ oeilCB.setToolTipText("Move camera when tracking");
965
+ oeilCB.addItemListener(this);
966
+
967
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
968
+ shadowCB.setToolTipText("When live compute shadows");
969
+ shadowCB.addItemListener(this);
970
+
971
+ panel.Return();
972
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
973
+ toggleTextureCB.setToolTipText("Load textures");
974
+ toggleTextureCB.addItemListener(this);
975
+
976
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
977
+ toggleSwitchCB.setToolTipText("Choose a single item");
978
+ toggleSwitchCB.addItemListener(this);
979
+
980
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
981
+ autokeepCB.setToolTipText("On structure change");
982
+ autokeepCB.addItemListener(this);
983
+
984
+ panel.Return();
985
+ if (Globals.ADVANCED)
986
+ {
987
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
988
+ lookAtCB.setToolTipText("Look-at target");
989
+ lookAtCB.addItemListener(this);
990
+ }
991
+
992
+ }
993
+
994
+ cGridBag fill = new cGridBag();
995
+ fill.preferredHeight = 200;
996
+ cGridBag fill2 = new cGridBag();
997
+ fill2.preferredHeight = 200;
998
+ cGridBag fill3 = new cGridBag();
999
+ fill3.preferredHeight = 200;
1000
+
1001
+ panel.add(fill);
1002
+ panel.add(fill2);
1003
+ panel.add(fill3);
1004
+
1005
+ }
6191006
6201007 void EditObject(Object3D obj)
6211008 {
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();
1009
+ cRadio radioButton = new cRadio(obj.name);
1010
+
1011
+ // June 2019. Patch to avoid bug with transparency.
1012
+ radioButton.hadMaterial = obj.material != null;
1013
+ if (!radioButton.hadMaterial)
1014
+ {
1015
+ obj.material = new cMaterial();
1016
+ }
1017
+
1018
+ radioButton.SetObject(obj);
1019
+ radioButton.layout = sixButton; // sevenButton;
1020
+ radioButton.SetCamera(cameraView.renderCamera, false);
1021
+ radioButton.addActionListener(this);
1022
+ radioPanel.add(radioButton);
1023
+ buttonGroup.add(radioButton);
1024
+ radioButton.doClick();
6301025 }
1026
+
6311027 void SetupViews(ObjEditor oe)
6321028 {
1029
+ theFrame = this;
1030
+
6331031 oe.SetupViews();
6341032
6351033 System.out.println("SetupViews");
....@@ -638,22 +1036,28 @@
6381036 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6391037 }
6401038
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;
1039
+ cToggleButton liveCB;
1040
+ cCheckBox supportCB;
1041
+ cCheckBox localCB;
1042
+ cCheckBox crowdCB;
1043
+ cCheckBox smoothCB;
1044
+ cToggleButton fastCB;
1045
+ cCheckBox slowCB;
1046
+ cCheckBox boxCB;
1047
+ cCheckBox zoomBoxCB;
1048
+ cCheckBox freezeCB;
1049
+ //cToggleButton trackCB;
1050
+ cCheckBox trackCB;
1051
+ cCheckBox smoothfocusCB;
6511052 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
1053
+ cCheckBox speakerCameraCB;
1054
+ cCheckBox speakerFocusCB;
1055
+ cCheckBox debugCB;
1056
+
1057
+ cCheckBox oeilCB;
1058
+ cCheckBox shadowCB;
1059
+ cCheckBox autokeepCB;
1060
+ cCheckBox lookAtCB;
6571061
6581062 // static int COLOR = 1;
6591063 // static int MATERIAL = 2;
....@@ -661,9 +1065,9 @@
6611065
6621066 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6631067
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
1068
+ cCheckBox colorCB;
1069
+ cCheckBox materialCB;
1070
+ cCheckBox textureCB;
6671071
6681072 public void itemStateChanged(ItemEvent e)
6691073 {
....@@ -688,10 +1092,10 @@
6881092 dropAttributes |= Object3D.TEXTURE;
6891093 else
6901094 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
1095
+ } else if(e.getSource() == liveCB)
6931096 {
6941097 cameraView.ToggleLive();
1098
+ refreshContents(false);
6951099 }
6961100 else if(e.getSource() == supportCB)
6971101 {
....@@ -727,6 +1131,10 @@
7271131 cameraView.repaint();
7281132 // refreshContents();
7291133 }
1134
+ else if(e.getSource() == zoomBoxCB)
1135
+ {
1136
+ cameraView.ToggleZoomBoxMode();
1137
+ }
7301138 else if(e.getSource() == smoothfocusCB)
7311139 {
7321140 cameraView.ToggleSmoothFocus();
....@@ -752,6 +1160,18 @@
7521160 {
7531161 cameraView.ToggleOeil();
7541162 }
1163
+ else if(e.getSource() == shadowCB)
1164
+ {
1165
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1166
+ }
1167
+ else if(e.getSource() == freezeCB)
1168
+ {
1169
+ Globals.FREEZEONMOVE ^= true;
1170
+ }
1171
+ else if(e.getSource() == autokeepCB)
1172
+ {
1173
+ Globals.REPLACEONMAKE ^= true;
1174
+ }
7551175 else if(e.getSource() == lookAtCB)
7561176 {
7571177 cameraView.ToggleLookAt();
....@@ -768,7 +1188,8 @@
7681188
7691189 /**/
7701190 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
771
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1191
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1192
+ TreePath path = objEditor.jTree.getSelectionPath();
7721193 if ((path == null) || (path.getPathCount() <= 1)) {
7731194 // We can't move the root node or an empty selection
7741195 return;
....@@ -831,8 +1252,6 @@
8311252 }
8321253 }
8331254
834
- String string = (String) object;
835
-
8361255 System.out.println("Transfer = " + object + "; drop : " + target);
8371256 // if( object instanceof java.io.File[])
8381257 // {
....@@ -840,7 +1259,11 @@
8401259 // objEditor.DropFile((java.io.File[]) object, true);
8411260 // return;
8421261 // }
843
- if (string.charAt(0) == '/')
1262
+
1263
+ String string = object.toString();
1264
+
1265
+ // File path for Mac and Windows
1266
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441267 {
8451268 // file(s)
8461269 String[] names = string.split("\n");
....@@ -867,7 +1290,7 @@
8671290
8681291 flashIt = false;
8691292 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1293
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711294 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721295
8731296 if (group.selection.size() == 1)
....@@ -883,23 +1306,33 @@
8831306
8841307 assert target == objEditor.jTree;
8851308 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1309
+ Object3D destinationLeaf;
8861310 try {
887
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1311
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
8881312 } catch (Exception e) {
8891313 System.out.println("destinationPath : " + destinationPath);
8901314 return;
8911315 }
8921316
893
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1317
+ for (int i=group.selection.size(); --i>=0;)
8941318 {
1319
+ Object3D child = (Object3D)group.selection.elementAt(i);
1320
+
1321
+ // Cannot move into itself
1322
+ if (child == destinationLeaf)
1323
+ return;
1324
+ }
1325
+
1326
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1327
+// {
8951328 loadClipboard(true);
8961329 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
898
- } else {
899
- loadClipboard(false);
900
- objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
902
- }
1330
+ pasteInto(false, false);
1331
+// } else {
1332
+// loadClipboard(false);
1333
+// objEditor.jTree.setSelectionPath(destinationPath);
1334
+// pasteInto(false, false); // true); // ???
1335
+// }
9031336 }
9041337 public void dropActionChanged(DropTargetDragEvent dtde)
9051338 // Called if the user has modified the current drop gesture
....@@ -1002,90 +1435,109 @@
10021435
10031436 void buildCreateMenu(Menu menu)
10041437 {
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);
1438
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1439
+ //heightFieldItem.addActionListener(this);
1440
+// gridItem = menu.add(new MenuItem("Grid"));
1441
+// gridItem.addActionListener(this);
1442
+// rectoidItem = menu.add(new MenuItem("Box"));
1443
+// rectoidItem.addActionListener(this);
1444
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1445
+// ellipsoidItem.addActionListener(this);
1446
+// coneItem = menu.add(new MenuItem("Cone"));
1447
+// coneItem.addActionListener(this);
1448
+// torusItem = menu.add(new MenuItem("Torus"));
1449
+// torusItem.addActionListener(this);
1450
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1451
+// superItem.addActionListener(this);
1452
+
1453
+ cameraItem = menu.add(new MenuItem("Camera"));
1454
+ cameraItem.addActionListener(this);
1455
+
1456
+ if (!Globals.ADVANCED)
1457
+ {
1458
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1459
+ kleinItem.addActionListener(this);
1460
+ }
1461
+
1462
+// particleItem = menu.add(new MenuItem("Particle system"));
1463
+// particleItem.addActionListener(this);
1464
+ if (Globals.ADVANCED)
1465
+ {
10191466 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201467 ragdollItem.addActionListener(this);
10211468 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221469 ragdoll2Item.addActionListener(this);
1470
+ }
10231471 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1472
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251473 meshItem.addActionListener(this);
10261474 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271475 // meshGroupItem.addActionListener(this);
1476
+ if (Globals.ADVANCED)
1477
+ {
10281478 springItem = menu.add(new MenuItem("Spring"));
10291479 springItem.addActionListener(this);
10301480 flagItem = menu.add(new MenuItem("Flag"));
10311481 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);
10361482 blobItem = menu.add(new MenuItem("Blob"));
10371483 blobItem.addActionListener(this);
10381484 latheItem = menu.add(new MenuItem("Lathe"));
10391485 latheItem.addActionListener(this);
1040
- lightItem = menu.add(new MenuItem("Light"));
1041
- lightItem.addActionListener(this);
1486
+ }
1487
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1488
+ bezierItem.addActionListener(this);
1489
+// overlayItem = menu.add(new MenuItem("Overlay"));
1490
+// overlayItem.addActionListener(this);
1491
+// lightItem = menu.add(new MenuItem("Light"));
1492
+// lightItem.addActionListener(this);
10421493 menu.add("-");
10431494 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10441495 //superLoopItem.addActionListener(this);
1045
- loopItem = menu.add(new MenuItem("Loop"));
1046
- loopItem.addActionListener(this);
1496
+// loopItem = menu.add(new MenuItem("Loop"));
1497
+// loopItem.addActionListener(this);
10471498 doubleItem = menu.add(new MenuItem("Fork"));
10481499 doubleItem.addActionListener(this);
1500
+ if (Globals.ADVANCED)
1501
+ {
10491502 tripleItem = menu.add(new MenuItem("Trident"));
10501503 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);
1504
+ }
10601505 }
10611506
10621507 void buildToolsMenu(Menu menu)
10631508 {
10641509 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651510 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1511
+ animationItem.setState(Globals.ANIMATION);
1512
+
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
10671515
10681516 menu.add("-");
10691517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701518 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1519
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1520
+ textureFieldItem.addActionListener(this);
1521
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721522 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751523 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761524 reduceMorphItem.addActionListener(this);
10771525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781526 reduce34MorphItem.addActionListener(this);
1079
-
1080
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1081
- computeAOItem.addActionListener(this);
10821527 menu.add("-");
1083
-
10841528 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851529 memoryItem.addActionListener(this);
1530
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1531
+ computeAOItem.addActionListener(this);
1532
+
1533
+ if (Globals.ADVANCED)
1534
+ {
1535
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1536
+ mirrorItem.addActionListener(this);
1537
+ menu.add("-");
10861538 menu.add(analyzeItem = new MenuItem("Analyze"));
10871539 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
1540
+ menu.add(dumpItem = new MenuItem("Print"));
10891541 dumpItem.addActionListener(this);
10901542 // menu.add(pathItem = new MenuItem("From-to path"));
10911543 // pathItem.addActionListener(this);
....@@ -1094,6 +1546,8 @@
10941546 resetParentItem.addActionListener(this);
10951547 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961548 repairParentItem.addActionListener(this);
1549
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1550
+ repairShadowItem.addActionListener(this);
10971551 menu.add(invariantsItem = new MenuItem("Invariants"));
10981552 invariantsItem.addActionListener(this);
10991553 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1555,7 @@
11011555 menu.add("-");
11021556 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031557 editScriptItem.addActionListener(this);
1558
+ }
11041559 }
11051560
11061561 void ScreenFit()
....@@ -1223,9 +1678,34 @@
12231678 shadow.material = new cMaterial(obj.material);
12241679 shadow.material.diffuse = 0.0001f;
12251680 shadow.material.specular = 0.0001f;
1681
+ //shadow.projectedVertices[1].x = 300;
12261682
12271683 makeSomething(shadow);
12281684 }
1685
+
1686
+ private void ClearUnpinned()
1687
+ {
1688
+ //for (Object3D obj : listUI)
1689
+ for (int i=listUI.size(); --i>=0;)
1690
+ {
1691
+ Object3D obj = listUI.elementAt(i);
1692
+ if (!obj.pinned)
1693
+ {
1694
+ obj.CloseUI();
1695
+ listUI.remove(i);
1696
+ }
1697
+ }
1698
+ }
1699
+
1700
+ private void EditElement(Object3D elem, boolean newWindow)
1701
+ {
1702
+ // if (!(elem instanceof Composite))
1703
+ // newWindow = false;
1704
+ listUI.add(elem);
1705
+ elem.openEditWindow(this, newWindow); //, false);
1706
+ System.out.println("edit : " + elem);
1707
+ elem.editWindow.refreshContents(true); // ? new
1708
+ }
12291709
12301710 /**
12311711 * applyExample
....@@ -1429,9 +1909,9 @@
14291909
14301910 void Overwrite(int mask)
14311911 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1912
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14331913 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1914
+ Object3D content = Grafreed.clipboard.get(0);
14351915
14361916 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371917 content = ((cGroup)content).get(0);
....@@ -1454,6 +1934,7 @@
14541934 //
14551935 public void actionPerformed(ActionEvent event) // , Object arg)
14561936 {
1937
+ Object source = event.getSource();
14571938 /*
14581939 if (event.getSource() == nameField)
14591940 {
....@@ -1465,11 +1946,11 @@
14651946 }
14661947 else
14671948 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1949
+ if (source == lookAtItem || source == lookFromItem)
14691950 {
14701951 ScreenFit();
14711952 } else
1472
- if (event.getSource() == switchItem)
1953
+ if (source == switchViewItem)
14731954 {
14741955 cVector v1 = new cVector();
14751956 cVector v2 = new cVector();
....@@ -1478,11 +1959,11 @@
14781959 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791960 objEditor.cameraView.repaint();
14801961 } else
1481
- if (event.getSource() == rectoidItem)
1962
+ if (source == rectoidItem || source == boxButton)
14821963 {
14831964 makeSomething(new Box());
14841965 } else
1485
- if (event.getSource() == particleItem)
1966
+ if (source == particleItem || source == particlesButton)
14861967 {
14871968 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881969 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1984,9 @@
15031984 applyExample(particleGeom, "SMOKE");
15041985 makeSomething(particleGeom);
15051986 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1987
+ if (source == ragdollItem || source == ragdoll2Item)
15071988 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1989
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091990
15101991 ragdoll.toParent = LA.newMatrix();
15111992 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +2002,71 @@
15212002 makeSomething(ragdoll);
15222003 //makeSomething(new VehicleDemo());
15232004 } else
1524
- if (event.getSource() == gridItem)
2005
+ /*
2006
+ */
2007
+ if (source == heightFieldItem)
2008
+ {
2009
+ Object3D obj = new Object3D();
2010
+
2011
+ obj.CreateMaterial();
2012
+ obj.bRep = new BoundaryRep();
2013
+
2014
+ obj.bRep.CreateMesh(new iHeightField()
2015
+ {
2016
+ public double f(double x, double y)
2017
+ {
2018
+ // The Mandelbrot set is represented by coloring
2019
+ // each point (x,y) according to the number of
2020
+ // iterations it takes before the while loop in
2021
+ // this method ends. For points that are actually
2022
+ // in the Mandelbrot set, or very close to it, the
2023
+ // count will reach the maximum value, 80. These
2024
+ // points will be colored purple. All other colors
2025
+ // represent points that are definitely NOT in the set.
2026
+ x -= 600;
2027
+ y -= 500;
2028
+ x /= 200;
2029
+ y /= 200;
2030
+ int count = 0;
2031
+ double zx = x;
2032
+ double zy = y;
2033
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
2034
+ double new_zx = zx*zx - zy*zy + x;
2035
+ zy = 2*zx*zy + y;
2036
+ zx = new_zx;
2037
+ count++;
2038
+ }
2039
+ return count; // Math.sqrt(count);
2040
+ }
2041
+ }, 1000,1000);
2042
+
2043
+ makeSomething(obj);
2044
+ } else
2045
+ if (source == gridItem || source == gridButton)
15252046 {
15262047 makeSomething(new Grid());
15272048 } else
1528
- if (event.getSource() == ellipsoidItem)
2049
+ if (source == ellipsoidItem || source == sphereButton)
15292050 {
15302051 makeSomething(new Sphere());
15312052 } else
1532
- if (event.getSource() == coneItem)
2053
+ if (source == coneItem || source == coneButton)
15332054 {
15342055 makeSomething(new Cone());
15352056 } else
1536
- if (event.getSource() == torusItem)
2057
+ if (source == torusItem || source == torusButton)
15372058 {
15382059 makeSomething(new Torus());
15392060 } else
1540
- if (event.getSource() == superItem)
2061
+ if (source == superItem || source == superButton)
15412062 {
15422063 makeSomething(new Superellipsoid());
15432064 } else
1544
- if (event.getSource() == blobItem)
2065
+ if (source == kleinItem || source == kleinButton)
2066
+ {
2067
+ makeSomething(new Klein());
2068
+ } else
2069
+ if (source == blobItem)
15452070 {
15462071 Blob blob = new Blob();
15472072 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2074,15 @@
15492074 //blob.retile();
15502075 makeSomething(blob);
15512076 } else
1552
- if (event.getSource() == latheItem)
2077
+ if (source == latheItem)
15532078 {
15542079 makeSomething(new Lathe());
15552080 } else
1556
- if (event.getSource() == bezierItem)
2081
+ if (source == bezierItem)
15572082 {
15582083 makeSomething(new BezierSurface());
15592084 } else
1560
- if (event.getSource() == checkerItem)
2085
+ if (source == overlayItem || source == overlayButton)
15612086 {
15622087 /*
15632088 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2095,9 @@
15702095 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712096 LA.matInvert(obj.toParent, obj.fromParent);
15722097 */
1573
- makeSomething(new CheckerIG());
2098
+ makeSomething(new Checker());
15742099 } else
1575
- if (event.getSource() == meshItem)
2100
+ if (source == meshItem)
15762101 {
15772102 Object3D itemtomake = new Object3D();
15782103 Object3D child;
....@@ -1593,35 +2118,35 @@
15932118 makeSomething(child);
15942119 }
15952120 } else
1596
- if (event.getSource() == springItem)
2121
+ if (source == springItem)
15972122 {
15982123 cSpring s = new cSpring();
15992124 s.setup();
16002125 makeSomething(s);
16012126 } else
1602
- if (event.getSource() == flagItem)
2127
+ if (source == flagItem)
16032128 {
16042129 cSpring s = new cFlag();
16052130 s.setup();
16062131 makeSomething(s);
16072132 } else
1608
- if (event.getSource() == lightItem)
2133
+ if (source == lightItem || source == lightButton)
16092134 {
16102135 makeSomething(new Light());
16112136 } else
1612
- if (event.getSource() == csgItem)
2137
+ if (source == csgItem)
16132138 {
16142139 group(new CSG());
16152140 } else
1616
- if (event.getSource() == templateItem)
2141
+ if (source == templateItem)
16172142 {
16182143 group(new cTemplate());
16192144 } else
1620
- if (event.getSource() == attributeItem)
2145
+ if (source == attributeItem)
16212146 {
16222147 makeSomething(new Attribute());
16232148 } else
1624
- if (event.getSource() == pointflowItem)
2149
+ if (source == pointflowItem)
16252150 {
16262151 makeSomething(new PointFlow());
16272152 } else
....@@ -1633,7 +2158,7 @@
16332158 } else
16342159 */
16352160
1636
- if (event.getSource() == superLoopItem)
2161
+ if (source == superLoopItem)
16372162 {
16382163 Composite g = new cGroup();
16392164 for (int i=0; i<15; i++)
....@@ -1655,30 +2180,30 @@
16552180
16562181 group(g);
16572182 } else
1658
- if (event.getSource() == loopItem)
2183
+ if (source == loopItem || source == loopButton)
16592184 {
16602185 Composite csg = new GroupLeaf();
16612186 csg.count = 5;
16622187 group(csg);
1663
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
16642189 csg.addChild(child);
16652190 child.addChild(csg);
16662191 } else
1667
- if (event.getSource() == doubleItem)
2192
+ if (source == doubleItem)
16682193 {
1669
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
16702195 csg.count = 5;
16712196 group(csg);
1672
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
16732198 csg.addChild(child);
16742199 child.addChild(csg);
1675
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
16762201 csg.addChild(child);
16772202 child.addChild(csg);
16782203 } else
1679
- if (event.getSource() == tripleItem)
2204
+ if (source == tripleItem)
16802205 {
1681
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
16822207 csg.count = 4;
16832208 group(csg);
16842209 Composite child = new cGroup();
....@@ -1691,73 +2216,98 @@
16912216 csg.addChild(child);
16922217 child.addChild(csg);
16932218 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2219
+ if (source == computeAOItem)
16962220 {
1697
- ImportGFD();
2221
+ Globals.drawMode = CameraPane.OCCLUSION;
2222
+ Globals.theRenderer.repaint();
16982223 } 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)
2224
+ if (source == recompileItem)
17172225 {
17182226 Recompile();
17192227 refreshContents();
17202228 } else
1721
- if (event.getSource() == editScriptItem)
2229
+ if (source == editScriptItem)
17222230 {
17232231 OpenDialog();
17242232 refreshContents();
17252233 } else
1726
- if (event.getSource() == invariantsItem)
2234
+ if (source == invariantsItem)
17272235 {
17282236 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2237
+ Grafreed.grafreeD.universe.invariants();
17302238 } else
1731
- if (event.getSource() == memoryItem)
2239
+ if (source == memoryItem)
17322240 {
17332241 //System.out.println("Invariants:");
17342242 PrintMemory();
17352243 } else
1736
- if (event.getSource() == pathItem)
2244
+ if (source == pathItem)
17372245 {
17382246 PrintPath();
17392247 } else
1740
- if (event.getSource() == analyzeItem)
2248
+ if (source == analyzeItem)
17412249 {
17422250 AnalyzeObject();
17432251 } else
1744
- if (event.getSource() == dumpItem)
2252
+ if (source == dumpItem)
17452253 {
17462254 DumpObject();
17472255 } else
1748
- if (event.getSource() == screenfitButton)
2256
+ if (source == minButton)
17492257 {
1750
- //Reload(lastConverter, lastFilename, true);
2258
+ Minimize();
2259
+ } else
2260
+ if (source == maxButton)
2261
+ {
2262
+ Maximize();
2263
+ } else
2264
+ if (source == fullButton)
2265
+ {
2266
+ ToggleFullScreen();
2267
+ } else
2268
+ if (source == undoButton)
2269
+ {
2270
+ // Go to previous version
2271
+ //if (!Undo())
2272
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2273
+ Undo();
2274
+ } else
2275
+ if (source == restoreButton)
2276
+ {
2277
+ // Restore current version
2278
+ Restore();
2279
+ } else
2280
+ if (source == replaceButton)
2281
+ {
2282
+ // Overwrite current version
2283
+ Replace();
2284
+ } else
2285
+ if (source == redoButton)
2286
+ {
2287
+ // Go to next version
2288
+ Redo();
2289
+ } else
2290
+ if (source == saveButton)
2291
+ {
2292
+ // Save a new version
2293
+ if (!Save(true))
2294
+ java.awt.Toolkit.getDefaultToolkit().beep();
2295
+ } else
2296
+ if (source == oneStepButton)
2297
+ {
2298
+ Globals.ONESTEP = true;
2299
+ cameraView.repaint();
2300
+ } else
2301
+ if (source == screenfitButton)
2302
+ {
17512303 ScreenFit();
17522304 } else
1753
- if (event.getSource() == screenfitpointButton)
2305
+ if (source == screenfitpointButton)
17542306 {
1755
- //Reload(lastConverter, lastFilename, true);
17562307 ScreenFitPoint();
17572308 } else
1758
- if (event.getSource() == snapobjectButton)
2309
+ if (source == snapobjectButton)
17592310 {
1760
- //Reload(lastConverter, lastFilename, true);
17612311 SnapObject();
17622312 } else
17632313 // if (event.getSource() == recompileButton)
....@@ -1766,13 +2316,13 @@
17662316 // Recompile();
17672317 // refreshContents();
17682318 // } else
1769
- if (event.getSource() == gcButton)
2319
+ if (source == gcButton)
17702320 {
17712321 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722322 System.gc();
17732323 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742324 } else
1775
- if (event.getSource() == editLeafItem)
2325
+ if (source == editLeafItem)
17762326 {
17772327 Object3D obj;
17782328 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2336,78 @@
17862336 }
17872337 refreshContents(true);
17882338 } else
1789
- if (event.getSource() == openWindowItem)
2339
+ if (source == openWindowItem)
17902340 {
17912341 EditSelection(true);
17922342 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2343
+ if (source == cutItem || source == clearButton)
17942344 {
17952345 loadClipboard(true);
17962346 } else
1797
- if (event.getSource() == duplicateItem)
2347
+ if (source == undoItem)
17982348 {
1799
- Object3D keep = GraphreeD.clipboard;
2349
+ Undo();
2350
+ } else
2351
+ if (source == redoItem)
2352
+ {
2353
+ Redo();
2354
+ } else
2355
+ if (source == duplicateItem)
2356
+ {
2357
+ Object3D keep = Grafreed.clipboard;
18002358 loadClipboard(false);
18012359 paste(false);
1802
- GraphreeD.clipboard = keep;
2360
+ Grafreed.clipboard = keep;
18032361 } else
1804
- if (event.getSource() == cloneItem)
2362
+ if (source == cloneItem)
18052363 {
18062364 CloneSelection(false);
18072365 } else
1808
- if (event.getSource() == cloneSupportItem)
2366
+ if (source == cloneSupportItem)
18092367 {
18102368 CloneSelection(true);
18112369 } else
1812
- if (event.getSource() == copyItem)
2370
+ if (source == copyItem)
18132371 {
18142372 loadClipboard(false);
18152373 } else
1816
- if (event.getSource() == pasteItem)
2374
+ if (source == pasteItem)
18172375 {
18182376 paste(false);
18192377 } else
1820
- if (event.getSource() == pasteLinkItem)
2378
+ if (source == pasteIntoItem)
18212379 {
1822
- pasteInto(false);
2380
+ pasteInto(true, false);
18232381 } else
1824
- if (event.getSource() == pasteCloneItem)
2382
+ if (source == pasteLinkItem)
18252383 {
1826
- pasteInto(true);
2384
+ pasteInto(false, false);
18272385 } else
1828
- if (event.getSource() == pasteExpandItem)
2386
+ if (source == pasteCloneItem)
2387
+ {
2388
+ pasteInto(true, true);
2389
+ } else
2390
+ if (source == pasteExpandItem)
18292391 {
18302392 paste(true);
18312393 } else
1832
- if (event.getSource() == synchronizeItem)
2394
+ if (source == synchronizeItem)
18332395 {
18342396 Overwrite(Object3D.TRANSFORM);
18352397 } else
1836
- if (event.getSource() == overwriteNameItem)
2398
+ if (source == overwriteNameItem)
18372399 {
18382400 Overwrite(Object3D.NAME);
18392401 } else
1840
- if (event.getSource() == overwriteUVItem)
2402
+ if (source == overwriteUVItem)
18412403 {
18422404 Overwrite(Object3D.UV);
18432405 } else
1844
- if (event.getSource() == overwriteMatItem)
2406
+ if (source == overwriteMatItem)
18452407 {
2408
+ /* july 2015
18462409 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2410
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482411 else
18492412 {
18502413 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2419,16 @@
18562419 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572420 }
18582421 }
2422
+ */
2423
+
2424
+ Overwrite(dropAttributes);
18592425 }
1860
- if (event.getSource() == overwriteGeoItem)
2426
+ if (source == overwriteGeoItem)
18612427 {
18622428 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2429
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642430 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2431
+// Object3D content = GrafreeD.clipboard.get(0);
18662432 //
18672433 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682434 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2440,7 @@
18742440 // refreshContents();
18752441 // }
18762442 } else
1877
- if (event.getSource() == generateMeshItem)
2443
+ if (source == generateMeshItem)
18782444 {
18792445 //if (group.selection.size() == 1)
18802446 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2451,7 @@
18852451 ResetModel();
18862452 refreshContents();
18872453 } else
1888
- if (event.getSource() == extractGeometriesItem)
2454
+ if (source == extractGeometriesItem)
18892455 {
18902456 boolean one = false;
18912457
....@@ -1912,7 +2478,7 @@
19122478 ResetModel();
19132479 refreshContents();
19142480 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2481
+ if (source == cloneGeometriesItem)
19162482 {
19172483 boolean one = false;
19182484
....@@ -1938,32 +2504,37 @@
19382504 ResetModel();
19392505 refreshContents();
19402506 } else
1941
- if (event.getSource() == shareGeometriesItem)
2507
+ if (source == shareGeometriesItem)
19422508 {
19432509 boolean one = false;
19442510
19452511 if (group.selection.size() == 1)
19462512 one = true;
19472513
2514
+ Object3D merge = null;
2515
+
19482516 Object3D content = new cGroup();
19492517
19502518 for (int i=0; i<group.selection.size(); i++)
19512519 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2520
+ merge = new Merge(group.selection.get(i));
19532521
19542522 if (one)
1955
- makeSomething(sel, false);
2523
+ makeSomething(merge, false);
19562524 else
1957
- content.addChild(sel);
2525
+ content.addChild(merge);
19582526 }
19592527
19602528 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2529
+ makeSomething(content, true);
2530
+ else
2531
+ {
2532
+ ResetModel();
2533
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2534
+ refreshContents();
2535
+ }
19652536 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2537
+ if (source == mergeGeometriesItem)
19672538 {
19682539 boolean one = false;
19692540
....@@ -1993,11 +2564,11 @@
19932564 ResetModel();
19942565 refreshContents();
19952566 } else
1996
- if (event.getSource() == linkverticesItem)
2567
+ if (source == linkverticesItem)
19972568 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2569
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992570 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2571
+// Object3D content = GrafreeD.clipboard.get(0);
20012572 //
20022573 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032574 // content = ((cGroup)content).get(0);
....@@ -2006,39 +2577,48 @@
20062577 // group.selection.get(0).setMasterThis(content); // should be identity
20072578 // refreshContents();
20082579 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2580
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20102581 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2582
+ Object3D content = Grafreed.clipboard.get(0);
20122583
20132584 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142585 content = ((cGroup)content).get(0);
20152586
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2587
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172588 for (int i=0; i<group.selection.size(); i++)
20182589 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
2590
+ boolean random = CameraPane.SWITCH;
2591
+ CameraPane.SWITCH = false; // parse all random nodes
20212592 group.selection.get(i).linkVerticesThis(content);
20222593 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
2594
+ CameraPane.SWITCH = random;
20242595 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2596
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262597 refreshContents();
20272598 }
20282599 } else
2029
- if (event.getSource() == resetsupportItem)
2600
+ if (source == resetsupportItem)
20302601 {
20312602 for (int i=0; i<group.selection.size(); i++)
20322603 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
2604
+ boolean random = CameraPane.SWITCH;
2605
+ CameraPane.SWITCH = false; // parse all random nodes
20352606 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
2607
+ CameraPane.SWITCH = random;
20372608 }
20382609
20392610 refreshContents();
20402611 } else
2041
- if (event.getSource() == resetreferencesItem)
2612
+ if (source == relinkverticesItem)
2613
+ {
2614
+ boolean random = CameraPane.SWITCH;
2615
+ CameraPane.SWITCH = false; // parse all random nodes
2616
+ group.selection.RelinkToSupport();
2617
+ CameraPane.SWITCH = random;
2618
+
2619
+ refreshContents();
2620
+ } else
2621
+ if (source == resetreferencesItem)
20422622 {
20432623 for (int i=0; i<group.selection.size(); i++)
20442624 {
....@@ -2047,11 +2627,11 @@
20472627
20482628 refreshContents();
20492629 } else
2050
- if (event.getSource() == setMasterItem)
2630
+ if (source == setMasterItem)
20512631 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2632
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20532633 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2634
+ Object3D content = Grafreed.clipboard.get(0);
20552635
20562636 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572637 content = ((cGroup)content).get(0);
....@@ -2060,13 +2640,13 @@
20602640 refreshContents();
20612641 }
20622642 } else
2063
- if (event.getSource() == poseMeshItem)
2643
+ if (source == poseMeshItem)
20642644 {
20652645 if (group.selection.size() == 1)
20662646 {
2067
- if (GraphreeD.clipboard.size() == 1)
2647
+ if (Grafreed.clipboard.size() == 1)
20682648 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2649
+ Object3D content = Grafreed.clipboard.get(0);
20702650
20712651 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722652 content = ((cGroup)content).get(0);
....@@ -2079,19 +2659,19 @@
20792659 }
20802660
20812661 } else
2082
- if (event.getSource() == revertMeshItem)
2662
+ if (source == revertMeshItem)
20832663 {
20842664 RevertMeshes();
20852665 } else
2086
- if (event.getSource() == resetMeshItem)
2666
+ if (source == resetAllItem)
20872667 {
20882668 ResetAll();
20892669 } else
2090
- if (event.getSource() == stepAllItem)
2670
+ if (source == stepAllItem)
20912671 {
20922672 StepAll();
20932673 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
20952675 {
20962676 //int indices[] = jList.getSelectedIndices();
20972677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2679,46 @@
20992679
21002680 ClearSelection(false);
21012681 } else
2102
- if (event.getSource() == clearAllItem)
2682
+ if (source == clearAllItem)
21032683 {
21042684 ClearSelection(true);
21052685 } else
2106
- if (event.getSource() == grabItem)
2686
+ if (source == grabItem || source == groupButton)
21072687 {
2108
- group(new cGroup(), true);
2688
+ group(new cGroup(), false); // true);
21092689 } else
2110
- if (event.getSource() == frontItem)
2690
+ if (source == hideItem)
2691
+ {
2692
+ group(new HiddenObject());
2693
+ } else
2694
+ if (source == frontItem)
21112695 {
21122696 front();
21132697 } else
2114
- if (event.getSource() == backItem)
2698
+ if (source == backItem)
21152699 {
21162700 back();
21172701 } else
2118
- if (event.getSource() == cameraItem)
2702
+ if (source == cameraItem)
21192703 {
21202704 makeSomething(new Camera());
21212705 } else
2122
- if (event.getSource() == compositeItem)
2706
+ if (source == compositeItem || source == compositeButton)
21232707 {
21242708 group(new Composite());
21252709 } else
2126
- if (event.getSource() == randomItem)
2710
+ if (source == switchItem || source == switchButton)
21272711 {
21282712 RandomNode random = new RandomNode();
21292713 group(random);
21302714 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
2715
+ random.name = random.get(0).name + "Switch";
21322716 } else
2133
- if (event.getSource() == physicsItem)
2717
+ if (source == physicsItem)
21342718 {
21352719 group(new PhysicsNode());
21362720 } else
2137
- if (event.getSource() == frameselectorItem)
2721
+ if (source == frameselectorItem)
21382722 {
21392723 for (int i=0; i<group.selection.size(); i++)
21402724 {
....@@ -2146,7 +2730,7 @@
21462730 ResetModel();
21472731 refreshContents();
21482732 } else
2149
- if (event.getSource() == switchGeoItem)
2733
+ if (source == switchGeoItem)
21502734 {
21512735 for (int i=0; i<group.selection.size(); i++)
21522736 {
....@@ -2158,7 +2742,7 @@
21582742 ResetModel();
21592743 refreshContents();
21602744 } else
2161
- if (event.getSource() == switchTransfoItem)
2745
+ if (source == switchTransfoItem)
21622746 {
21632747 for (int i=0; i<group.selection.size(); i++)
21642748 {
....@@ -2170,7 +2754,7 @@
21702754 ResetModel();
21712755 refreshContents();
21722756 } else
2173
- if (event.getSource() == morphItem)
2757
+ if (source == morphItem)
21742758 {
21752759 for (int i=0; i<group.selection.size(); i++)
21762760 {
....@@ -2182,7 +2766,7 @@
21822766 ResetModel();
21832767 refreshContents();
21842768 } else
2185
- if (event.getSource() == scriptNodeItem)
2769
+ if (source == scriptNodeItem)
21862770 {
21872771 boolean atleastone = false;
21882772
....@@ -2221,191 +2805,252 @@
22212805 }
22222806 }
22232807 } else
2224
- if (event.getSource() == linkerItem)
2808
+ if (source == linkerItem)
22252809 {
22262810 group(new cLinker());
22272811 } else
2228
- if (event.getSource() == textureItem)
2812
+ if (source == textureItem || source == textureButton)
22292813 {
22302814 group(new TextureNode());
22312815 } else
2232
- if (event.getSource() == shadowXItem)
2816
+ if (source == billboardItem)
2817
+ {
2818
+ group(new BillboardNode());
2819
+ } else
2820
+ if (source == shadowXItem)
22332821 {
22342822 CastShadow(0);
22352823 } else
2236
- if (event.getSource() == shadowYItem)
2824
+ if (source == shadowYItem)
22372825 {
22382826 CastShadow(1);
22392827 } else
2240
- if (event.getSource() == shadowZItem)
2828
+ if (source == shadowZItem)
22412829 {
22422830 CastShadow(2);
22432831 } else
2244
- if (event.getSource() == ungroupItem)
2832
+ if (source == ungroupItem || source == ungroupButton)
22452833 {
2246
- ungroup();
2834
+ boolean hasRoot = false;
2835
+
2836
+ for (int i=0; i<group.selection.size(); i++)
2837
+ {
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
2843
+ }
2844
+
2845
+ if (!hasRoot)
2846
+ {
2847
+ for (int i=0; i<group.selection.size(); i++)
2848
+ {
2849
+ Ungroup(group.selection.get(i));
2850
+ }
2851
+
2852
+ ClearSelection(false);
2853
+
2854
+ refreshContents();
2855
+ }
22472856 } else
2248
- if (event.getSource() == genUVItem)
2857
+ if (source == genUVItem)
22492858 {
22502859 GenUV();
22512860 } else
2252
- if (event.getSource() == genNormalsCADItem)
2861
+ if (source == genNormalsCADItem)
22532862 {
22542863 GenNormals(true);
22552864 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2865
+ if (source == genNormalsMESHItem)
2866
+ {
2867
+ GenNormalsMESH();
2868
+ } else
2869
+ if (source == genNormalsORGANItem)
22572870 {
22582871 GenNormals(false);
22592872 } else
2260
- if (event.getSource() == stripifyItem)
2873
+ if (source == genNormalsMINEItem)
2874
+ {
2875
+ GenNormalsMINE();
2876
+ } else
2877
+ if (source == stripifyItem)
22612878 {
22622879 Stripify();
22632880 } else
2264
- if (event.getSource() == unstripifyItem)
2881
+ if (source == unstripifyItem)
22652882 {
22662883 Unstripify();
22672884 } else
2268
- if (event.getSource() == trimItem)
2885
+ if (source == trimItem)
22692886 {
22702887 Trim();
22712888 } else
2272
- if (event.getSource() == untrimItem)
2889
+ if (source == untrimItem)
22732890 {
22742891 Untrim();
22752892 } else
2276
- if (event.getSource() == clearColorsItem)
2893
+ if (source == clearColorsItem)
22772894 {
22782895 ClearColors();
22792896 } else
2280
- if (event.getSource() == clearMaterialsItem)
2897
+ if (source == clearMaterialsItem)
22812898 {
22822899 ClearMaterials();
22832900 } else
2284
- if (event.getSource() == liveleavesItem)
2901
+ if (source == liveleavesItem)
22852902 {
22862903 LiveLeaves(true);
22872904 } else
2288
- if (event.getSource() == unliveleavesItem)
2905
+ if (source == unliveleavesItem)
22892906 {
22902907 LiveLeaves(false);
22912908 } else
2292
- if (event.getSource() == supportleavesItem)
2909
+ if (source == supportleavesItem)
22932910 {
22942911 SupportLeaves(true);
22952912 } else
2296
- if (event.getSource() == unsupportleavesItem)
2913
+ if (source == unsupportleavesItem)
22972914 {
22982915 SupportLeaves(false);
22992916 } else
2300
- if (event.getSource() == hideleavesItem)
2917
+ if (source == hideleavesItem)
23012918 {
23022919 HideLeaves(true);
23032920 } else
2304
- if (event.getSource() == showleavesItem)
2921
+ if (source == showleavesItem)
23052922 {
23062923 HideLeaves(false);
23072924 } else
2308
- if (event.getSource() == markleavesItem)
2925
+ if (source == markleavesItem)
23092926 {
23102927 MarkLeaves(true);
23112928 } else
2312
- if (event.getSource() == unmarkleavesItem)
2929
+ if (source == unmarkleavesItem)
23132930 {
23142931 MarkLeaves(false);
23152932 } else
2316
- if (event.getSource() == flipVItem)
2933
+ if (source == rewindleavesItem)
2934
+ {
2935
+ RewindLeaves(true);
2936
+ } else
2937
+ if (source == unrewindleavesItem)
2938
+ {
2939
+ RewindLeaves(false);
2940
+ } else
2941
+ if (source == randomleavesItem)
2942
+ {
2943
+ RandomLeaves(true);
2944
+ } else
2945
+ if (source == unrandomleavesItem)
2946
+ {
2947
+ RandomLeaves(false);
2948
+ } else
2949
+ if (source == flipVItem)
23172950 {
23182951 FlipV(true);
23192952 } else
2320
- if (event.getSource() == unflipVItem)
2953
+ if (source == unflipVItem)
23212954 {
23222955 FlipV(false);
23232956 } else
2324
- if (event.getSource() == lowTexturesItem)
2957
+ if (source == lowTexturesItem)
23252958 {
23262959 SetTexRes(0);
23272960 } else
2328
- if (event.getSource() == normalTexturesItem)
2961
+ if (source == normalTexturesItem)
23292962 {
23302963 SetTexRes(1);
23312964 } else
2332
- if (event.getSource() == highTexturesItem)
2965
+ if (source == highTexturesItem)
23332966 {
23342967 SetTexRes(2);
23352968 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2969
+ if (source == veryhighTexturesItem)
23372970 {
23382971 SetTexRes(3);
23392972 } else
2340
- if (event.getSource() == maxTexturesItem)
2973
+ if (source == maxTexturesItem)
23412974 {
23422975 SetTexRes(4);
23432976 } else
2344
- if (event.getSource() == panoTexturesItem)
2977
+ if (source == panoTexturesItem)
23452978 {
23462979 SetTexRes(5);
23472980 } else
2348
- if (event.getSource() == reverseNormalsItem)
2981
+ if (source == reverseNormalsItem)
23492982 {
23502983 ReverseNormals();
23512984 } else
2352
- if (event.getSource() == parseverticesItem)
2985
+ if (source == parseverticesItem)
23532986 {
23542987 ParseVertices();
23552988 } else
2356
- if (event.getSource() == alignItem)
2989
+ if (source == textureFieldItem)
2990
+ {
2991
+ TextureVertices();
2992
+ } else
2993
+ if (source == alignItem)
23572994 {
23582995 Align();
23592996 } else
2360
- if (event.getSource() == mirrorItem)
2997
+ if (source == mirrorItem)
23612998 {
23622999 MirrorPoses();
23633000 } else
2364
- if (event.getSource() == reduceMorphItem)
3001
+ if (source == reduceMorphItem)
23653002 {
23663003 MeshReduction(false);
23673004 } else
2368
- if (event.getSource() == reduce34MorphItem)
3005
+ if (source == reduce34MorphItem)
23693006 {
23703007 MeshReduction(true);
23713008 } else
2372
- if (event.getSource() == reverseTrianglesItem)
3009
+ if (source == reverseTrianglesItem)
23733010 {
23743011 ReverseTriangles();
23753012 } else
2376
- if (event.getSource() == reduceMeshItem)
3013
+ if (source == reduceMeshItem)
23773014 {
23783015 ReduceMesh(false);
23793016 } else
2380
- if (event.getSource() == reduce34MeshItem)
3017
+ if (source == reduce34MeshItem)
23813018 {
23823019 ReduceMesh(true);
23833020 } else
2384
- if (event.getSource() == increaseMeshItem)
3021
+ if (source == increaseMeshItem)
23853022 {
23863023 IncreaseMesh();
23873024 } else
2388
- if (event.getSource() == clipMeshItem)
3025
+ if (source == clipMeshItem)
23893026 {
23903027 ClipMesh();
23913028 } else
2392
- if (event.getSource() == smoothMeshItem)
3029
+ if (source == smoothMeshItem)
23933030 {
23943031 SmoothMesh();
23953032 } else
2396
- if (event.getSource() == transformgeometryItem)
3033
+ if (source == transformGeometryItem)
23973034 {
23983035 TransformGeometry();
23993036 } else
2400
- if (event.getSource() == resetTransformItem)
3037
+ if (source == transformChildrenItem)
3038
+ {
3039
+ TransformChildren();
3040
+ } else
3041
+ if (source == resetTransformItem)
24013042 {
24023043 ResetTransform();
24033044 } else
2404
- if (event.getSource() == resetCentroidItem)
3045
+ if (source == resetCentroidItem)
24053046 {
2406
- ResetCentroid();
3047
+ ResetCentroid(true);
24073048 } else
2408
- if (event.getSource() == resetParentItem)
3049
+ if (source == resetCentroidXZItem)
3050
+ {
3051
+ ResetCentroid(false);
3052
+ } else
3053
+ if (source == resetParentItem)
24093054 {
24103055 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24113056 {
....@@ -2415,7 +3060,7 @@
24153060
24163061 refreshContents();
24173062 } else
2418
- if (event.getSource() == repairParentItem)
3063
+ if (source == repairParentItem)
24193064 {
24203065 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24213066 {
....@@ -2429,7 +3074,21 @@
24293074
24303075 refreshContents();
24313076 } else
2432
- if (event.getSource() == sortbysizeItem)
3077
+ if (source == repairShadowItem)
3078
+ {
3079
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3080
+ {
3081
+ Object3D obj = (Object3D)e.nextElement();
3082
+ obj.RepairShadow();
3083
+// for (int i=0; i<obj.size(); i++)
3084
+// {
3085
+// obj.get(i).parent = obj;
3086
+// }
3087
+ }
3088
+
3089
+ refreshContents();
3090
+ } else
3091
+ if (source == sortbysizeItem)
24333092 {
24343093 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353094 {
....@@ -2441,7 +3100,7 @@
24413100 ResetModel();
24423101 refreshContents();
24433102 } else
2444
- if (event.getSource() == sortbynameItem)
3103
+ if (source == sortbynameItem)
24453104 {
24463105 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473106 {
....@@ -2453,7 +3112,7 @@
24533112 ResetModel();
24543113 refreshContents();
24553114 } else
2456
- if (event.getSource() == attachPigmentItem)
3115
+ if (source == attachPigmentItem)
24573116 {
24583117 String texture = GetFile("Attach pigment");
24593118 Object3D obj;
....@@ -2465,7 +3124,7 @@
24653124
24663125 refreshContents();
24673126 } else
2468
- if (event.getSource() == detachPigmentItem)
3127
+ if (source == detachPigmentItem)
24693128 {
24703129 Object3D obj;
24713130 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3135,7 @@
24763135
24773136 refreshContents();
24783137 } else
2479
- if (event.getSource() == attachBumpItem)
3138
+ if (source == attachBumpItem)
24803139 {
24813140 String texture = GetFile("Attach bump");
24823141 Object3D obj;
....@@ -2488,7 +3147,7 @@
24883147
24893148 refreshContents();
24903149 } else
2491
- if (event.getSource() == detachBumpItem)
3150
+ if (source == detachBumpItem)
24923151 {
24933152 Object3D obj;
24943153 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +3158,7 @@
24993158
25003159 refreshContents();
25013160 } else
2502
- if (event.getSource() == pigmentBumpItem)
3161
+ if (source == pigmentBumpItem)
25033162 {
25043163 Object3D obj;
25053164 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +3169,237 @@
25103169
25113170 refreshContents();
25123171 } else
2513
- if (event.getSource() == flashSelectionButton)
3172
+ if (source == flashSelectionButton)
25143173 {
25153174 CameraPane.flash = true;
25163175 refreshContents();
25173176 } else
2518
- if (event.getSource() == oneButton)
3177
+ if (source == oneButton)
25193178 {
25203179 } else
2521
- if (event.getSource() == twoButton)
3180
+ if (source == twoButton)
25223181 {
25233182 radio.layout = twoButton;
3183
+
3184
+ if (CameraPane.FULLSCREEN)
3185
+ fullscreenLayout = radio.layout;
3186
+
25243187 // bug
25253188 //gridPanel.setDividerLocation(1.0);
25263189 //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();
3190
+// bigThree.remove(scenePanel);
3191
+// bigThree.remove(centralPanel);
3192
+// bigThree.remove(XYZPanel);
3193
+// aWindowConstraints.gridx = 0;
3194
+// aWindowConstraints.gridy = 0;
3195
+// aWindowConstraints.gridwidth = 1;
3196
+// // aConstraints.gridheight = 3;
3197
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3198
+// aWindowConstraints.weightx = 0;
3199
+// aWindowConstraints.weighty = 1;
3200
+// //bigThree.add(jtp, aWindowConstraints);
3201
+// aWindowConstraints.weightx = 1;
3202
+// aWindowConstraints.gridwidth = 3;
3203
+// // aConstraints.gridheight = 3;
3204
+// aWindowConstraints.gridx = 1;
3205
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3206
+// bigThree.add(centralPanel, aWindowConstraints);
3207
+// aWindowConstraints.weightx = 0;
3208
+// aWindowConstraints.gridx = 4;
3209
+// aWindowConstraints.gridwidth = 1;
3210
+// // aConstraints.gridheight = 3;
3211
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3212
+// //bigThree.add(XYZPanel, aWindowConstraints);
3213
+// scenePanel.setVisible(false);
3214
+// centralPanel.setVisible(true);
3215
+// XYZPanel.setVisible(false);
3216
+ bigThree.ClearUI();
3217
+ bigThree.add(centralPanel);
3218
+ bigThree.FlushUI();
3219
+
3220
+ cameraView.requestFocusInWindow();
3221
+
3222
+// refreshContents(true);
3223
+//
3224
+// try
3225
+// {
3226
+// java.awt.Robot bot = new java.awt.Robot();
3227
+// int mask = InputEvent.BUTTON1_MASK;
3228
+// bot.mouseMove(100, 100);
3229
+// bot.mousePress(mask);
3230
+// bot.mouseRelease(mask);
3231
+// }
3232
+// catch (Exception e)
3233
+// {
3234
+//
3235
+// }
3236
+
25513237 } else
2552
- if (event.getSource() == threeButton)
3238
+ if (source == threeButton)
25533239 {
25543240 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();
3241
+
3242
+ if (CameraPane.FULLSCREEN)
3243
+ fullscreenLayout = radio.layout;
3244
+
3245
+// bigThree.remove(scenePanel);
3246
+// bigThree.remove(centralPanel);
3247
+// bigThree.remove(XYZPanel);
3248
+// aWindowConstraints.gridx = 0;
3249
+// aWindowConstraints.gridy = 0;
3250
+// aWindowConstraints.gridwidth = 1;
3251
+// // aConstraints.gridheight = 3;
3252
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3253
+// aWindowConstraints.weightx = 0;
3254
+// aWindowConstraints.weighty = 1;
3255
+// //bigThree.add(jtp, aWindowConstraints);
3256
+// aWindowConstraints.weightx = 1;
3257
+// aWindowConstraints.gridwidth = 3;
3258
+// // aConstraints.gridheight = 3;
3259
+// aWindowConstraints.gridx = 1;
3260
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3261
+// bigThree.add(centralPanel, aWindowConstraints);
3262
+// aWindowConstraints.weightx = 0;
3263
+// aWindowConstraints.gridx = 4;
3264
+// aWindowConstraints.gridwidth = 1;
3265
+// // aConstraints.gridheight = 3;
3266
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3267
+// bigThree.add(XYZPanel, aWindowConstraints);
3268
+// bigThree.validate();
3269
+// scenePanel.setVisible(false);
3270
+// centralPanel.setVisible(true);
3271
+// XYZPanel.setVisible(true);
3272
+ bigThree.ClearUI();
3273
+ bigThree.add(centralPanel);
3274
+ bigThree.add(XYZPanel);
3275
+ bigThree.FlushUI();
3276
+
3277
+ cameraView.requestFocusInWindow();
25793278 } else
2580
- if (event.getSource() == fourButton)
3279
+ if (source == fourButton)
25813280 {
25823281 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();
3282
+
3283
+ if (CameraPane.FULLSCREEN)
3284
+ fullscreenLayout = radio.layout;
3285
+
3286
+// bigThree.remove(scenePanel);
3287
+// bigThree.remove(centralPanel);
3288
+// bigThree.remove(XYZPanel);
3289
+// aWindowConstraints.gridx = 0;
3290
+// aWindowConstraints.gridy = 0;
3291
+// aWindowConstraints.gridwidth = 1;
3292
+// // aWindowConstraints.gridheight = 3;
3293
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3294
+// aWindowConstraints.weightx = 1;
3295
+// aWindowConstraints.weighty = 1;
3296
+// bigThree.add(scenePanel, aWindowConstraints);
3297
+// aWindowConstraints.weightx = 1;
3298
+// aWindowConstraints.gridwidth = 3;
3299
+// // aConstraints.gridheight = 3;
3300
+// aWindowConstraints.gridx = 1;
3301
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3302
+// //bigThree.add(cameraPanel, aWindowConstraints);
3303
+// aWindowConstraints.weightx = 0;
3304
+// aWindowConstraints.gridx = 4;
3305
+// aWindowConstraints.gridwidth = 1;
3306
+// // aWindowConstraints.gridheight = 3;
3307
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3308
+// //bigThree.add(XYZPanel, aWindowConstraints);
3309
+// bigThree.validate();
3310
+// scenePanel.setVisible(true);
3311
+// centralPanel.setVisible(false);
3312
+// XYZPanel.setVisible(false);
3313
+ bigThree.ClearUI();
3314
+ bigThree.add(scenePanel);
3315
+ bigThree.FlushUI();
3316
+
3317
+ cameraView.requestFocusInWindow();
26073318 } else
2608
- if (event.getSource() == sixButton)
3319
+ if (source == sixButton)
26093320 {
26103321 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();
3322
+
3323
+ if (CameraPane.FULLSCREEN)
3324
+ fullscreenLayout = radio.layout;
3325
+
3326
+// bigThree.remove(scenePanel);
3327
+// bigThree.remove(centralPanel);
3328
+// bigThree.remove(XYZPanel);
3329
+// aWindowConstraints.gridx = 0;
3330
+// aWindowConstraints.gridy = 0;
3331
+// aWindowConstraints.gridwidth = 1;
3332
+// // aConstraints.gridheight = 3;
3333
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3334
+// aWindowConstraints.weightx = 0;
3335
+// aWindowConstraints.weighty = 1;
3336
+// bigThree.add(scenePanel, aWindowConstraints);
3337
+// aWindowConstraints.weightx = 1;
3338
+// aWindowConstraints.gridwidth = 3;
3339
+// // aWindowConstraints.gridheight = 3;
3340
+// aWindowConstraints.gridx = 1;
3341
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3342
+// bigThree.add(centralPanel, aWindowConstraints);
3343
+// aWindowConstraints.weightx = 0;
3344
+// aWindowConstraints.gridx = 4;
3345
+// aWindowConstraints.gridwidth = 1;
3346
+// // aWindowConstraints.gridheight = 3;
3347
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3348
+// //bigThree.add(XYZPanel, aConstraints);
3349
+// bigThree.validate();
3350
+// scenePanel.setVisible(true);
3351
+// centralPanel.setVisible(true);
3352
+// XYZPanel.setVisible(false);
3353
+ bigThree.ClearUI();
3354
+ bigThree.add(scenePanel);
3355
+ bigThree.add(centralPanel);
3356
+ bigThree.FlushUI();
3357
+
3358
+ cameraView.requestFocusInWindow();
26353359 } else
2636
- if (event.getSource() == sevenButton)
3360
+ if (source == sevenButton)
26373361 {
26383362 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();
3363
+
3364
+ if (CameraPane.FULLSCREEN)
3365
+ fullscreenLayout = radio.layout;
3366
+
3367
+// bigThree.remove(scenePanel);
3368
+// bigThree.remove(centralPanel);
3369
+// bigThree.remove(XYZPanel);
3370
+// aWindowConstraints.gridx = 0;
3371
+// aWindowConstraints.gridy = 0;
3372
+// aWindowConstraints.gridwidth = 1;
3373
+// // aWindowConstraints.gridheight = 3;
3374
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3375
+// aWindowConstraints.weightx = 0;
3376
+// aWindowConstraints.weighty = 1;
3377
+// bigThree.add(scenePanel, aWindowConstraints);
3378
+// aWindowConstraints.weightx = 1;
3379
+// aWindowConstraints.gridwidth = 3;
3380
+// // aWindowConstraints.gridheight = 3;
3381
+// aWindowConstraints.gridx = 1;
3382
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3383
+// bigThree.add(centralPanel, aWindowConstraints);
3384
+// aWindowConstraints.weightx = 0;
3385
+// aWindowConstraints.gridx = 4;
3386
+// aWindowConstraints.gridwidth = 1;
3387
+// // aConstraints.gridheight = 3;
3388
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3389
+// bigThree.add(XYZPanel, aWindowConstraints);
3390
+// bigThree.validate();
3391
+// scenePanel.setVisible(true);
3392
+// centralPanel.setVisible(true);
3393
+// XYZPanel.setVisible(true);
3394
+ bigThree.ClearUI();
3395
+ bigThree.add(scenePanel);
3396
+ bigThree.add(centralPanel);
3397
+ bigThree.add(XYZPanel);
3398
+ bigThree.FlushUI();
3399
+
3400
+ cameraView.requestFocusInWindow();
26633401 } else
2664
- if (event.getSource() == rootButton)
3402
+ if (source == rootButton)
26653403 {
26663404 Object3D obj;
26673405 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2671,66 +3409,84 @@
26713409 EditObject(obj);
26723410 }
26733411
3412
+ cameraView.requestFocusInWindow();
26743413 refreshContents(true);
26753414 } else
2676
- if (event.getSource() == closeButton)
3415
+ if (source == closeButton)
26773416 {
26783417 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793418 cRadio ab;
26803419 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813420 {
26823421 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3422
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843423 {
3424
+ // Patch to avoid bug with transparency.
3425
+ if (!ab.hadMaterial)
3426
+ {
3427
+ ab.object.material = null;
3428
+ }
3429
+
26853430 buttonGroup.remove(ab);
26863431 radioPanel.remove(ab);
26873432
2688
- ab.GetObject().editWindow = null;
3433
+ //ab.GetObject().editWindow = null;
3434
+ ab.GetObject().manipWindow = null;
26893435 // ab.GetObject().objectUI = null; // ?????????
26903436
26913437 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923438 break;
26933439 }
26943440 }
3441
+
3442
+ cameraView.requestFocusInWindow();
26953443 refreshContents(true);
26963444 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3445
+ if (source == editItem || source == editButton)
26983446 {
3447
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3448
+ {
3449
+ Object3D child = (Object3D)e.nextElement();
3450
+ child.pinned = true;
3451
+ }
3452
+
26993453 EditSelection(false);
27003454 } else
2701
- if (event.getSource() == uneditButton)
3455
+ if (source == uneditButton)
27023456 {
27033457 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043458 {
27053459 Object3D child = (Object3D)e.nextElement();
27063460 if(child.editWindow != null)
27073461 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3462
+ child.pinned = false;
27083463 child.CloseUI();
27093464 listUI.remove(child);
27103465
2711
- child.editWindow = null; // ???????????
3466
+ //child.editWindow = null; // ???????????
27123467 }
2713
- objEditor.ctrlPanel.revalidate();
3468
+ objEditor.ctrlPanel.FlushUI();
27143469 //objEditor.jTree.clearSelection();
27153470 //objEditor.ResetSliders();
27163471 refreshContents(true);
27173472 } else
2718
- if (event.getSource() == clearPanelButton)
3473
+ if (source == clearPanelButton)
27193474 {
27203475 assert(copy == group);
27213476 //copy.ClearUI();
27223477 for (Object3D obj : listUI)
27233478 {
3479
+ obj.pinned = false;
27243480 obj.CloseUI();
27253481 }
27263482 listUI.clear();
27273483 refreshContents(true);
27283484 } else
2729
- if (event.getSource() == allParamsButton)
3485
+ if (source == allParamsButton)
27303486 {
27313487 assert(copy == group);
27323488
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3489
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27343490
27353491 for (Object3D obj : listUI)
27363492 {
....@@ -2747,19 +3503,19 @@
27473503
27483504 refreshContents(true);
27493505 } else
2750
- if (event.getSource() == unselectButton)
3506
+ if (source == unselectButton)
27513507 {
27523508 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3509
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543510 objEditor.ResetSliders();
27553511 refreshContents(true);
27563512 } else
2757
- if(event.getSource() instanceof cRadio)
3513
+ if(source instanceof cRadio)
27583514 {
27593515 group.parent = keepparent;
27603516 group.attributes = 0;
27613517 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3518
+ /*cRadio*/ radio = (cRadio)source;
27633519 Object3D obj = radio.GetObject();
27643520 System.out.println("Edit " + obj);
27653521 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +3535,10 @@
27793535 }
27803536
27813537 copy = group;
2782
- //CameraPane.theRenderer.object = group;
3538
+
3539
+ SetUndoStates();
3540
+
3541
+ //Globals.theRenderer.object = group;
27833542 if(!useclient)
27843543 {
27853544 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +3547,52 @@
27883547 cameraView.cameras[cameraView.cameracount] = radio.camera;
27893548 cameraView.targetLookAt.set(radio.camera.lookAt);
27903549 cameraView.object = group;
2791
- cameraView.lighttouched = true;
3550
+ //cameraView.lighttouched = true;
3551
+ Globals.lighttouched = true;
27923552 topView.object = group;
27933553 frontView.object = group;
27943554 sideView.object = group;
27953555 }
2796
- group.editWindow = this;
3556
+
3557
+// fix "+" issue
3558
+ //group.editWindow = this;
3559
+ group.manipWindow = this;
3560
+
27973561 /*
27983562 currentLayout = radio.layout;
27993563 if (currentLayout == null)
28003564 currentLayout = sevenButton;
28013565 */
28023566 radio.layout.doClick();
3567
+
3568
+ ClearUnpinned();
3569
+ //Grafreed.Assert(group != null);
3570
+ //Grafreed.Assert(group.selection != null);
3571
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3572
+ if (group.selection == null || group.selection.size() == 1)
3573
+ EditSelection(false);
28033574 keepparent = group.parent;
28043575 // PARENT = NULL or not???
28053576 //group.parent = null; // ROOT
28063577 //group.attributes = -1;
28073578 ResetModel();
3579
+
3580
+ cameraView.requestFocusInWindow();
28083581 refreshContents(true);
2809
- }
3582
+ } else if (event.getSource() == editCameraItem)
3583
+ {
3584
+ cameraView.ProtectCamera();
3585
+ cameraView.repaint();
3586
+ return;
3587
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3588
+ {
3589
+ cameraView.RevertCamera();
3590
+ cameraView.repaint();
3591
+ return;
3592
+ // } else if (event.getSource() == textureButton)
3593
+ // {
3594
+ // return; // true;
3595
+ }
28103596 else
28113597 {
28123598 //return super.action(event, arg);
....@@ -2815,7 +3601,6 @@
28153601 }
28163602
28173603 boolean useclient = false;
2818
- cRadio radio;
28193604
28203605 void ToggleRoot()
28213606 {
....@@ -2824,7 +3609,7 @@
28243609 if (useclient)
28253610 {
28263611 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3612
+ Globals.lighttouched = true;
28283613 //topView.object = client;
28293614 //frontView.object = client;
28303615 //sideView.object = client;
....@@ -2832,7 +3617,7 @@
28323617 else
28333618 {
28343619 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3620
+ Globals.lighttouched = true;
28363621 //topView.object = group;
28373622 //frontView.object = group;
28383623 //sideView.object = group;
....@@ -2867,6 +3652,28 @@
28673652 refreshContents();
28683653 }
28693654
3655
+ void TransformChildren()
3656
+ {
3657
+ Object3D obj;
3658
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3659
+ {
3660
+ obj = (Object3D)e.nextElement();
3661
+ obj.KeepTextureMatrices();
3662
+ obj.TransformChildren();
3663
+ obj.RestoreTextureMatrices();
3664
+
3665
+// if (obj.parent == null)
3666
+// {
3667
+// System.out.println("NULL PARENT!");
3668
+// new Exception().printStackTrace();
3669
+// }
3670
+// else
3671
+// TouchTransform(obj);
3672
+// //obj.parent.Touch();
3673
+ }
3674
+
3675
+ refreshContents();
3676
+ }
28703677
28713678 void ResetTransform()
28723679 {
....@@ -2979,7 +3786,7 @@
29793786 refreshContents();
29803787 }
29813788
2982
- void ResetCentroid()
3789
+ void ResetCentroid(boolean full)
29833790 {
29843791 Object3D obj;
29853792 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +3801,16 @@
29943801 LA.matIdentity(Object3D.mat);
29953802 obj.getBounds(minima, maxima, false);
29963803 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3804
+ if (full)
3805
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29983806 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29993807 obj.TransformMesh(Object3D.mat);
3808
+
30003809 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3810
+ if (full)
3811
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30023812 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3813
+
30033814 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30043815 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30053816 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +3839,8 @@
30283839
30293840 int size = obj.MemorySize();
30303841
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
3842
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3843
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30323844 }
30333845 }
30343846 catch (Exception e)
....@@ -3065,9 +3877,9 @@
30653877 obj = (Object3D)e.nextElement();
30663878
30673879 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3880
+ Grafreed.AnalyzeObject(obj);
30693881 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3882
+ Grafreed.AnalyzeObject(obj.bRep);
30713883
30723884 // System.err.println((size/1024) + " KB is the size of " + obj);
30733885 }
....@@ -3109,6 +3921,20 @@
31093921 void GenNormals(boolean crease)
31103922 {
31113923 group.GenNormalsS(crease);
3924
+
3925
+ refreshContents();
3926
+ }
3927
+
3928
+ void GenNormalsMESH()
3929
+ {
3930
+ group.GenNormalsMeshS();
3931
+
3932
+ refreshContents();
3933
+ }
3934
+
3935
+ void GenNormalsMINE()
3936
+ {
3937
+ group.selection.GenNormalsMINE();
31123938
31133939 refreshContents();
31143940 }
....@@ -3157,104 +3983,259 @@
31573983
31583984 //Object3D buffer;
31593985 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
-
3986
+// BoundaryRep temprep;
3987
+// Object3D nodes;
3988
+// Vector<Vertex> vertices;
3989
+//
3990
+// cGroup buffer;
3991
+//
3992
+// public void Vertex(Object3D node, Vertex v)
3993
+// {
3994
+//// vertices.add(v);
3995
+//// nodes.addElement(node);
3996
+////
3997
+//// if (temprep.GetCache(v) != null)
3998
+//// {
3999
+//// temprep.Remove(v);
4000
+//// } else
4001
+//// {
4002
+//// temprep.Remember(v);
4003
+//// }
4004
+//
4005
+// //Object3D node = nodes.get(index);
4006
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
4007
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4008
+//
4009
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4010
+//
4011
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4012
+//
4013
+// cGroup g = new cGroup();
4014
+//
4015
+// if (g.toParent == null)
4016
+// {
4017
+// g.toParent = LA.newMatrix();
4018
+// g.fromParent = LA.newMatrix();
4019
+// }
4020
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4021
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4022
+//
4023
+// g.add(GrafreeD.clipboard);
4024
+//
4025
+// buffer.add(g);
4026
+// }
4027
+//
4028
+// public void Face(Object3D node, Face f)
4029
+// {
4030
+//
4031
+// }
4032
+//
4033
+// void ParseVerticesOld() // ??
4034
+// {
4035
+// //if (group.selection.size() != 1)
4036
+// // return;
4037
+//
4038
+// temprep = new BoundaryRep();
4039
+// nodes = new Object3D();
4040
+// vertices = new Vector<Vertex>();
4041
+//
4042
+// boolean epsequal = GrafreeD.epsequal;
4043
+// GrafreeD.epsequal = true;
4044
+//
4045
+// for (int i=0; i<group.selection.size(); i++)
4046
+// {
4047
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4048
+//
4049
+// group.selection.get(i).Parse(
4050
+//this );
4051
+//
4052
+// int repsize = temprep.VertexCount();
4053
+// int tablesize = temprep.vertextable.size();
4054
+// int nodesize = nodes.size();
4055
+//
4056
+// assert(vertices.size() == nodes.size());
4057
+//
4058
+// temprep.vertextable.elements();
4059
+//
4060
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4061
+//
4062
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
4063
+// {
4064
+// cGroup g = new cGroup();
4065
+//
4066
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
4067
+//
4068
+// Object3D node = nodes.get(index);
4069
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
4070
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4071
+//
4072
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4073
+//
4074
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4075
+//
4076
+// if (g.toParent == null)
4077
+// {
4078
+// g.toParent = LA.newMatrix();
4079
+// g.fromParent = LA.newMatrix();
4080
+// }
4081
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4082
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4083
+//
4084
+// g.add(GrafreeD.clipboard);
4085
+//
4086
+// buffer.add(g);
4087
+// }
4088
+//
4089
+// makeSomething(buffer, i==group.selection.size()-1);
4090
+// }
4091
+//
4092
+// GrafreeD.epsequal = epsequal;
4093
+//
4094
+// //buffer = null;
4095
+// temprep = null;
4096
+// nodes = null;
4097
+//
4098
+// refreshContents();
4099
+// }
4100
+
31844101 void ParseVertices()
31854102 {
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;
4103
+ boolean epsequal = Grafreed.epsequal;
4104
+ Grafreed.epsequal = true;
31954105
31964106 for (int i=0; i<group.selection.size(); i++)
31974107 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4108
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994109
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4110
+ group.selection.get(i).Parse(
4111
+
4112
+ new iParse()
4113
+ {
4114
+ public void Vertex(Object3D node, Vertex v)
4115
+ {
4116
+ temp.set(v);
4117
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054118
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();
4119
+ cGroup g = new cGroup();
32114120
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4121
+ if (g.toParent == null)
4122
+ {
4123
+ g.toParent = LA.newMatrix();
4124
+ g.fromParent = LA.newMatrix();
4125
+ }
4126
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4127
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154128
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);
4129
+ g.add(Grafreed.clipboard);
32204130
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);
4131
+ buffer.add(g);
4132
+ }
32324133
3233
- g.add(GraphreeD.clipboard);
4134
+ public void Face(Object3D node, Face f)
4135
+ {
32344136
3235
- buffer.add(g);
3236
- }
4137
+ }
4138
+ }
4139
+ );
32374140
32384141 makeSomething(buffer, i==group.selection.size()-1);
32394142 }
32404143
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4144
+ Grafreed.epsequal = epsequal;
32464145
32474146 refreshContents();
32484147 }
3249
-
4148
+
4149
+ void TextureVertices()
4150
+ {
4151
+ for (int i=0; i<group.selection.size(); i++)
4152
+ {
4153
+ group.selection.get(i).Parse(
4154
+ new iParse()
4155
+ {
4156
+ public void Vertex(Object3D node, Vertex v)
4157
+ {
4158
+ cTexture tex = node.GetTextures();
4159
+ String pigment = Object3D.GetPigment(tex);
4160
+ //String bump = Object3D.GetBump(tex);
4161
+
4162
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4163
+
4164
+ try
4165
+ {
4166
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4167
+ }
4168
+ catch (Exception e)
4169
+ {
4170
+ System.err.println("FAIL: " + node);
4171
+ }
4172
+
4173
+ double s = v.s;
4174
+
4175
+ if (s == 1)
4176
+ s = 0;
4177
+
4178
+ double t = v.t;
4179
+
4180
+ if (t == 1)
4181
+ t = 0;
4182
+
4183
+ int indexs = (int) (texturedata.getWidth() * s);
4184
+ int indext = (int) (texturedata.getHeight() * t);
4185
+
4186
+ int index = indext * texturedata.getWidth() + indexs;
4187
+
4188
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4189
+
4190
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4191
+
4192
+ float scale = bytebuf.get(index*slide) & 0xFF;
4193
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4194
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4195
+ scale /= 3;
4196
+
4197
+ scale /= 0xFF;
4198
+ // c'est quoi ca? scale /= 4;
4199
+
4200
+ //v.AO = scale;
4201
+
4202
+ v.x += v.norm.x * scale;
4203
+ v.y += v.norm.y * scale;
4204
+ v.z += v.norm.z * scale;
4205
+ }
4206
+
4207
+ public void Face(Object3D node, Face f)
4208
+ {
4209
+ }
4210
+ }
4211
+ );
4212
+ }
4213
+
4214
+ refreshContents();
4215
+ }
4216
+
32504217 void Align()
32514218 {
4219
+ if (group.selection.size() == 0)
4220
+ return;
4221
+
4222
+ cVector bbmin = new cVector();
4223
+ cVector bbmax = new cVector();
4224
+
4225
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4226
+
4227
+ double dx = bbmax.x - bbmin.x;
4228
+ double dy = bbmax.y - bbmin.y;
4229
+ double dz = bbmax.z - bbmin.z;
4230
+
4231
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4232
+
32524233 for (int i=0; i<group.selection.size(); i++)
32534234 {
32544235 Object3D obj = group.selection.get(i);
32554236
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4237
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4238
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584239 }
32594240
32604241 refreshContents();
....@@ -3267,7 +4248,7 @@
32674248 // ref.SaveSupports();
32684249 // Object3D par = ref.parent;
32694250 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4251
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714252 // ref.parent = par;
32724253 // ref.RestoreSupports();
32734254
....@@ -3275,11 +4256,11 @@
32754256
32764257 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774258
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4259
+ boolean random = CameraPane.SWITCH;
4260
+ CameraPane.SWITCH = false; // parse all random nodes
32804261 lowres.linkVerticesThis(null);
32814262 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4263
+ CameraPane.SWITCH = random;
32834264
32844265 System.err.flush();
32854266
....@@ -3297,7 +4278,7 @@
32974278 // lowres.SaveSupports();
32984279 // par = lowres.parent;
32994280 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4281
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014282 Object3D newlow = CloneObject(lowres, false);
33024283 newlow.name = sn.switchobject.get(i).name;
33034284 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4300,7 @@
33194300 return;
33204301
33214302 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4303
+ Object3D ref = Grafreed.clipboard.get(0);
33234304
33244305 Object3D newgroup = new Object3D("Po:" + poses.name);
33254306
....@@ -3488,7 +4469,7 @@
34884469 group.selection.RelinkToSupport(); // july 2014
34894470 System.out.println("DONE.");
34904471 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4472
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34924473 }
34934474
34944475 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +4494,20 @@
35134494
35144495 void ClipMesh()
35154496 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4497
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35174498 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
4499
+ Object3D content = Grafreed.clipboard.get(0);
35194500
35204501 if (content instanceof cGroup && ((cGroup)content).transientlink )
35214502 content = ((cGroup)content).get(0);
35224503
35234504 // for (int i=0; i<group.selection.size(); i++)
35244505 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4506
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264507 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4508
+ group.selection.ClipMesh(Grafreed.clipboard);
35284509 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4510
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304511 System.out.println("DONE.");
35314512 refreshContents();
35324513 }
....@@ -3571,6 +4552,18 @@
35714552 void MarkLeaves(boolean hide)
35724553 {
35734554 group.selection.MarkLeaves(hide);
4555
+ refreshContents();
4556
+ }
4557
+
4558
+ void RewindLeaves(boolean hide)
4559
+ {
4560
+ group.selection.RewindLeaves(hide);
4561
+ refreshContents();
4562
+ }
4563
+
4564
+ void RandomLeaves(boolean hide)
4565
+ {
4566
+ group.selection.RandomLeaves(hide);
35744567 refreshContents();
35754568 }
35764569
....@@ -3645,28 +4638,25 @@
36454638 // }
36464639 // }
36474640
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36524641 void EditSelection(boolean newWindow)
36534642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
36544649 // aConstraints.gridy = 0;
36554650 for (int i=0; i<group.selection.size(); i++)
36564651 {
36574652 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36584653 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4654
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36604655
36614656 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
4657
+ if(elem != group || !newWindow)
36634658 {
3664
- // if (!(elem instanceof Composite))
3665
- // newWindow = false;
3666
- listUI.add(elem);
3667
- elem.openEditWindow(this, newWindow); //, false);
3668
- System.out.println("edit : " + elem);
3669
- elem.editWindow.refreshContents(true); // ? new
4659
+ EditElement(elem, newWindow); // ? new
36704660 }
36714661 }
36724662 }
....@@ -3741,7 +4731,8 @@
37414731 //new Exception().printStackTrace();
37424732
37434733 freezemodel = true;
3744
-
4734
+ ClearUnpinned();
4735
+
37454736 /**/
37464737 //switch (event.id)
37474738 {
....@@ -3749,7 +4740,6 @@
37494740 //case 702: // Event.LIST_DESELECT
37504741 group.deselectAll();
37514742 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37534743 if (tps != null)
37544744 {
37554745 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +4748,39 @@
37584748
37594749 //if (child.parent != null)
37604750 //child.parent.addSelectee(child);
4751
+ objEditor.SetMaterial(child);
37614752 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37654753 }
37664754 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
4755
+// else
4756
+// {
4757
+// objEditor.SetMaterial(group); // .GetMaterial());
4758
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4759
+// System.err.println("info : " + group.GetPath());
4760
+// }
37734761
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4762
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37774763 CameraPane.flash = true;
37784764
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4765
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37804766 // a camera
37814767 {
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;
4768
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4769
+ {
4770
+ CameraPane.camerachangeframe = 0; // don't refuse it
4771
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4772
+ }
4773
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4774
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864775 }
37874776
4777
+ if (tps != null && tps.length == 1)
4778
+ {
4779
+ EditSelection(false);
4780
+ }
4781
+
4782
+ SetPinStates(tps != null && tps.length > 0);
4783
+
37884784 refreshContents();
37894785 //return true;
37904786 }
....@@ -3793,6 +4789,35 @@
37934789
37944790 freezemodel = false;
37954791 }
4792
+
4793
+ void SetPinStates(boolean enabled)
4794
+ {
4795
+ editButton.setEnabled(enabled);
4796
+ uneditButton.setEnabled(enabled);
4797
+ unselectButton.setEnabled(enabled);
4798
+ flashSelectionButton.setEnabled(enabled);
4799
+ }
4800
+
4801
+ void refreshContents(boolean cp)
4802
+ {
4803
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4804
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4805
+ {
4806
+ objEditor.ClearInfo(); // .GetMaterial());
4807
+
4808
+ for (int i=0; i < group.selection.Size(); i++)
4809
+ {
4810
+ Object3D child = (Object3D) group.selection.get(i);
4811
+
4812
+ objEditor.AddInfo(child, this, true);
4813
+ System.err.println("info : " + child.GetPath());
4814
+ }
4815
+
4816
+ objEditor.SetText(); // jan 2014
4817
+ }
4818
+
4819
+ super.refreshContents(cp);
4820
+ }
37964821
37974822 void linkSomething(Object3D thing)
37984823 {
....@@ -3864,16 +4889,19 @@
38644889 {
38654890 if (group.selection.isEmpty())
38664891 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4892
+
4893
+ Grafreed.clipboardIsTempGroup = false;
38684894 Composite tGroup = null;
38694895 if (group.selection.size() > 0) // 1)
38704896 {
38714897 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4898
+ Grafreed.clipboardIsTempGroup = true;
38734899 }
38744900
38754901 if (cut)
38764902 {
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
38774905 //int indices[] = jList.getSelectedIndices();
38784906 //for (int i = indices.length - 1; i >= 0; i--)
38794907 //jList.remove(indices[i]);
....@@ -3909,16 +4937,16 @@
39094937 //System.out.println("cut " + child);
39104938 //System.out.println("parent = " + child.parent);
39114939 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4940
+ if (Grafreed.clipboardIsTempGroup)
39134941 tGroup.add/*Child*/(tmp);
39144942 else
3915
- GraphreeD.clipboard = tmp;
4943
+ Grafreed.clipboard = tmp;
39164944 }
39174945 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4946
+ if (Grafreed.clipboardIsTempGroup)
39194947 tGroup.add/*Child*/(child);
39204948 else
3921
- GraphreeD.clipboard = child;
4949
+ Grafreed.clipboard = child;
39224950 }
39234951
39244952 //ResetModel();
....@@ -3950,21 +4978,23 @@
39504978 //System.out.println("cut " + elem);
39514979 //System.out.println("parent = " + elem.parent);
39524980 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4981
+ if (Grafreed.clipboardIsTempGroup)
39544982 tGroup.add/*Child*/(tmp);
39554983 else
3956
- GraphreeD.clipboard = tmp;
4984
+ Grafreed.clipboard = tmp;
39574985 }
39584986 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4987
+ if (Grafreed.clipboardIsTempGroup)
39604988 tGroup.add/*Child*/(child);
39614989 else
3962
- GraphreeD.clipboard = child;
4990
+ Grafreed.clipboard = child;
39634991 }
39644992
39654993 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4994
+
4995
+ if (Grafreed.clipboardIsTempGroup)
4996
+ Grafreed.clipboard = tGroup;
4997
+
39684998 if (cut)
39694999 {
39705000 ResetModel();
....@@ -3974,11 +5004,15 @@
39745004
39755005 void paste(boolean expand)
39765006 {
3977
- // if (GraphreeD.clipboard == null)
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
5011
+ // if (GrafreeD.clipboard == null)
39785012 // return;
39795013 boolean first = true;
39805014
3981
- if (GraphreeD.clipboardIsTempGroup)
5015
+ if (Grafreed.clipboardIsTempGroup)
39825016 {
39835017 Composite temp;
39845018
....@@ -3989,7 +5023,7 @@
39895023 temp = (Composite)Applet3D.clipboard.deepCopy();
39905024 */
39915025 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5026
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39935027 {
39945028 Object3D child = (Object3D)e.nextElement();
39955029
....@@ -4003,7 +5037,7 @@
40035037 else
40045038 elem = child.deepCopy(); // ?
40055039 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
5040
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40075041 // elem = elem.get(0);
40085042 makeSomething(elem, true); // ?? first);
40095043 //group.addChild(elem);
....@@ -4023,23 +5057,24 @@
40235057 //Object3D cb = Applet3D.clipboard;
40245058 //temp.addChild(cb);
40255059 //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());
5060
+ assert(Grafreed.clipboard.parent == null);
5061
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5062
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5063
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5064
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40315065 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
5066
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5067
+ Grafreed.clipboard.get(0).parent = keepparent;
40345068 }
40355069
5070
+ Globals.REPLACEONMAKE = keep;
40365071 ResetModel();
40375072 refreshContents();
40385073 }
40395074
4040
- void pasteInto(boolean copyit)
5075
+ void pasteInto(boolean copyit, boolean clone)
40415076 {
4042
-// if (GraphreeD.clipboard == null)
5077
+// if (GrafreeD.clipboard == null)
40435078 // return;
40445079
40455080 if (group.selection.size() != 1)
....@@ -4066,15 +5101,22 @@
40665101 if (copyit)
40675102 {
40685103 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5104
+ if (clone)
5105
+ {
5106
+ CloneClipboard(false); // sept 2014
5107
+ }
5108
+ else
5109
+ {
5110
+ paste(false);
5111
+ }
40705112 }
40715113 else
40725114 {
40735115 boolean first = true;
40745116
4075
- if (GraphreeD.clipboardIsTempGroup)
5117
+ if (Grafreed.clipboardIsTempGroup)
40765118 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5119
+ Composite temp = (Composite)Grafreed.clipboard;
40785120 Object3D copy;
40795121 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805122 {
....@@ -4084,7 +5126,7 @@
40845126 }
40855127 } else
40865128 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5129
+ linkSomething(Grafreed.clipboard); //.get(0));
40885130 }
40895131 }
40905132 }
....@@ -4161,6 +5203,10 @@
41615203
41625204 void group(Object3D csg, boolean grab)
41635205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
41645210 if (//false) // why??
41655211 !group.selection.isEmpty())
41665212 {
....@@ -4274,8 +5320,34 @@
42745320 //node.add(csg);
42755321 //makeSomething(node);
42765322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
42775324 }
42785325
5326
+ void Ungroup(Object3D g)
5327
+ {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
5332
+ if (g instanceof HiddenObject)
5333
+ {
5334
+ HiddenObject h = (HiddenObject) g;
5335
+
5336
+ for (int i=0; i<h.ActualSize(); i++)
5337
+ {
5338
+ objEditor.makeSomething(h.get(i), false);
5339
+ }
5340
+ }
5341
+ else
5342
+ {
5343
+ for (int i=0; i<g.Size(); i++)
5344
+ {
5345
+ objEditor.makeSomething(g.get(i), false);
5346
+ }
5347
+ }
5348
+ Globals.REPLACEONMAKE = keep;
5349
+ }
5350
+
42795351 void ungroup()
42805352 {
42815353 /*
....@@ -4469,21 +5541,6 @@
44695541 }
44705542 */
44715543
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
-
44875544 /*
44885545 public void Callback(Object obj)
44895546 {
....@@ -4507,26 +5564,9 @@
45075564 }
45085565 */
45095566
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
-
45275567 String GetFile(String dialogName)
45285568 {
4529
- if (GraphreeD.standAlone)
5569
+ if (Grafreed.standAlone)
45305570 {
45315571 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45325572 browser.show();
....@@ -4590,10 +5630,33 @@
45905630 cButton flashSelectionButton;
45915631 cButton editButton;
45925632 cButton uneditButton;
5633
+ JCheckBox allParamsButton;
45935634 cButton clearpanelButton;
4594
- cButton allParamsButton;
45955635 cButton unselectButton;
45965636
5637
+ cButton restoreCameraButton;
5638
+
5639
+ cButton saveButton;
5640
+ cButton oneStepButton;
5641
+
5642
+ cButton groupButton;
5643
+ cButton ungroupButton;
5644
+ cButton compositeButton;
5645
+ cButton switchButton;
5646
+ cButton loopButton;
5647
+ cButton textureButton;
5648
+
5649
+ cButton gridButton;
5650
+ cButton boxButton;
5651
+ cButton sphereButton;
5652
+ cButton coneButton;
5653
+ cButton torusButton;
5654
+ cButton superButton;
5655
+ cButton kleinButton;
5656
+ cButton particlesButton;
5657
+ cButton overlayButton;
5658
+ cButton lightButton;
5659
+
45975660 cButton screenfitButton;
45985661 cButton screenfitpointButton;
45995662 cButton snapobjectButton;
....@@ -4605,14 +5668,6 @@
46055668
46065669 cButton setsupportButton;
46075670
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
-
46165671 //
46175672 //Composite
46185673 Object3D // to do !!
....@@ -4622,9 +5677,11 @@
46225677 //JTree jTree;
46235678 private MenuItem lookAtItem;
46245679 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
5680
+ private MenuItem switchViewItem;
46265681 private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
5682
+ private MenuItem undoItem;
5683
+ private MenuItem redoItem;
5684
+ private JMenuItem duplicateItem;
46285685 private MenuItem cloneItem;
46295686 private MenuItem cloneSupportItem;
46305687 private MenuItem overwriteGeoItem;
....@@ -4635,8 +5692,9 @@
46355692 private MenuItem resetsupportItem;
46365693 private MenuItem resetreferencesItem;
46375694 private MenuItem linkverticesItem;
5695
+ private MenuItem relinkverticesItem;
46385696 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
5697
+ private MenuItem resetAllItem;
46405698 private MenuItem stepAllItem;
46415699 private MenuItem revertMeshItem;
46425700 private MenuItem poseMeshItem;
....@@ -4647,14 +5705,17 @@
46475705 private MenuItem mergeGeometriesItem;
46485706 private MenuItem copyItem;
46495707 private MenuItem pasteItem;
5708
+ private MenuItem pasteIntoItem;
46505709 private MenuItem pasteLinkItem;
46515710 private MenuItem pasteCloneItem;
46525711 private MenuItem pasteExpandItem;
4653
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
46545713 private MenuItem clearAllItem;
46555714 private MenuItem genUVItem;
5715
+ private MenuItem genNormalsMESHItem;
46565716 private MenuItem genNormalsCADItem;
46575717 private MenuItem genNormalsORGANItem;
5718
+ private MenuItem genNormalsMINEItem;
46585719 private MenuItem stripifyItem;
46595720 private MenuItem unstripifyItem;
46605721 private MenuItem trimItem;
....@@ -4683,6 +5744,10 @@
46835744 private MenuItem showleavesItem;
46845745 private MenuItem markleavesItem;
46855746 private MenuItem unmarkleavesItem;
5747
+ private MenuItem rewindleavesItem;
5748
+ private MenuItem unrewindleavesItem;
5749
+ private MenuItem randomleavesItem;
5750
+ private MenuItem unrandomleavesItem;
46865751
46875752 private MenuItem flipVItem;
46885753 private MenuItem unflipVItem;
....@@ -4694,14 +5759,17 @@
46945759 private MenuItem panoTexturesItem;
46955760
46965761 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
5762
+ private MenuItem resetCentroidXZItem;
46985763 private MenuItem resetTransformItem;
5764
+ private MenuItem transformGeometryItem;
5765
+ private MenuItem transformChildrenItem;
5766
+ private MenuItem hideItem;
46995767 private MenuItem grabItem;
47005768 private MenuItem backItem;
47015769 private MenuItem frontItem;
47025770 private MenuItem cameraItem;
47035771 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
5772
+ private MenuItem switchItem;
47055773 private MenuItem physicsItem;
47065774 private MenuItem frameselectorItem;
47075775 private MenuItem scriptNodeItem;
....@@ -4716,6 +5784,7 @@
47165784
47175785 private MenuItem resetParentItem;
47185786 private MenuItem repairParentItem;
5787
+ private MenuItem repairShadowItem;
47195788 private MenuItem sortbysizeItem;
47205789 private MenuItem sortbynameItem;
47215790
....@@ -4728,16 +5797,19 @@
47285797 private MenuItem particleItem;
47295798 private MenuItem ragdollItem;
47305799 private MenuItem ragdoll2Item;
5800
+ private MenuItem heightFieldItem;
5801
+ private MenuItem textureFieldItem;
47315802 private MenuItem gridItem;
47325803 private MenuItem rectoidItem;
47335804 private MenuItem ellipsoidItem;
47345805 private MenuItem coneItem;
47355806 private MenuItem torusItem;
47365807 private MenuItem superItem;
5808
+ private MenuItem kleinItem;
47375809 private MenuItem blobItem;
47385810 private MenuItem latheItem;
47395811 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
5812
+ private MenuItem overlayItem;
47415813 private MenuItem meshItem;
47425814 // private MenuItem meshGroupItem;
47435815 private MenuItem springItem;
....@@ -4746,6 +5818,7 @@
47465818 private MenuItem csgItem;
47475819 private MenuItem templateItem;
47485820 private MenuItem textureItem;
5821
+ private MenuItem billboardItem;
47495822 private MenuItem shadowXItem;
47505823 private MenuItem shadowYItem;
47515824 private MenuItem shadowZItem;
....@@ -4758,11 +5831,6 @@
47585831 private MenuItem doubleItem;
47595832 private MenuItem tripleItem;
47605833
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47665834 private MenuItem computeAOItem;
47675835 private MenuItem recompileItem;
47685836 private MenuItem editScriptItem;
....@@ -4772,4 +5840,8 @@
47725840 private MenuItem analyzeItem;
47735841 private MenuItem dumpItem;
47745842 //boolean freezemodel = false;
5843
+
5844
+ Menu cameraMenu;
5845
+ MenuItem editCameraItem;
5846
+ MenuItem restoreCameraItem;
47755847 }