Normand Briere
2019-06-29 a69bb4474a3264a9a7a7f8b8d8154ea771f167c8
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,
....@@ -73,7 +74,7 @@
7374 this.copy = this.group = copy;
7475 //selectees = this.group.selectees;
7576
76
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7778 SetupUI2(objEditor);
7879 objEditor.SetupUI(true);
7980 SetupViews(objEditor);
....@@ -83,7 +84,7 @@
8384
8485 void CloneSelection(boolean supports)
8586 {
86
- // Object3D keep = GraphreeD.clipboard;
87
+ // Object3D keep = GrafreeD.clipboard;
8788 //Object3D obj;
8889 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
8990 {
....@@ -97,14 +98,14 @@
9798
9899 void CloneClipboard(boolean supports)
99100 {
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));
101
+ assert(Grafreed.clipboard.parent == null);
102
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
103
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
104
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
105
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105106 else
106
- makeSomething(CloneObject(GraphreeD.clipboard, false));
107
- GraphreeD.clipboard.get(0).parent = keepparent;
107
+ makeSomething(CloneObject(Grafreed.clipboard, false));
108
+ Grafreed.clipboard.get(0).parent = keepparent;
108109 }
109110
110111 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +119,7 @@
118119 // obj.support = null;
119120 if (!supports)
120121 obj.SaveSupports();
121
- Object3D clone = (Object3D)GraphreeD.clone(obj);
122
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122123 obj.parent = parent;
123124 // obj.support = support;
124125 // clone.support = support; // aout 2013
....@@ -147,30 +148,29 @@
147148
148149 //JTextField nameField;
149150
150
- void SetupMenu2(ObjEditor oe)
151
+ void SetupMenu2(GroupEditor oe)
151152 {
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);
153
+ oe.jTree = new cTree();
154
+
163155 Menu menu;
164156 oe.menuBar.add(menu = new Menu("Edit"));
165157 //editItem = menu.add(new MenuItem("Edit"));
166158 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
159
+
160
+// undoItem = menu.add(new MenuItem("Undo"));
161
+// undoItem.addActionListener(this);
162
+// redoItem = menu.add(new MenuItem("Redo"));
163
+// redoItem.addActionListener(this);
164
+// menu.add("-");
165
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168166 duplicateItem.addActionListener(this);
169
- menu.add("-");
170167 cloneItem = menu.add(new MenuItem("Clone"));
171168 cloneItem.addActionListener(this);
169
+ if (Globals.ADVANCED)
170
+ {
172171 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173172 cloneSupportItem.addActionListener(this);
173
+ }
174174 menu.add("-");
175175 cutItem = menu.add(new MenuItem("Cut"));
176176 cutItem.addActionListener(this);
....@@ -178,26 +178,123 @@
178178 copyItem.addActionListener(this);
179179 pasteItem = menu.add(new MenuItem("Paste"));
180180 pasteItem.addActionListener(this);
181
+
182
+ menu.add("-");
183
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
184
+ pasteIntoItem.addActionListener(this);
181185 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182186 pasteLinkItem.addActionListener(this);
183187 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184188 pasteCloneItem.addActionListener(this);
185189 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186190 // pasteExpandItem.addActionListener(this);
191
+ menu.add("-");
187192 clearItem = menu.add(new MenuItem("Clear"));
188193 clearItem.addActionListener(this);
194
+
195
+ if (Globals.ADVANCED)
196
+ {
197
+ // Deletes the cameras...
189198 clearAllItem = menu.add(new MenuItem("Clear All"));
190199 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);
200
+ }
201
+
202
+ menuBar.add(cameraMenu = new Menu("View"));
203
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
204
+ //zBufferItem.addActionListener(this);
205
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
206
+ //normalLensItem.addActionListener(this);
207
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
208
+ restoreCameraItem.addActionListener(this);
209
+
210
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
211
+// toggleFullScreenItem.addItemListener(this);
212
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
213
+// cameraMenu.add("-");
214
+//
215
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
216
+// toggleTextureItem.addItemListener(this);
217
+// toggleTextureItem.setState(CameraPane.textureon);
218
+//
219
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
220
+// toggleSwitchItem.addItemListener(this);
221
+// toggleSwitchItem.setState(CameraPane.SWITCH);
222
+
223
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
224
+ toggleHandleItem.addItemListener(this);
225
+ toggleHandleItem.setState(CameraPane.HANDLES);
226
+
227
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
228
+ togglePaintItem.addItemListener(this);
229
+ togglePaintItem.setState(CameraPane.PAINTMODE);
230
+
231
+ if (Globals.ADVANCED)
232
+ {
233
+ cameraMenu.add("-");
234
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
235
+ toggleLiveItem.addItemListener(this);
236
+ toggleLiveItem.setState(Globals.isLIVE());
237
+
238
+ cameraMenu.add(stepItem = new MenuItem("Step"));
239
+ stepItem.addActionListener(this);
240
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
241
+ // toggleDLItem.addItemListener(this);
242
+ // toggleDLItem.setState(false);
243
+
244
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
245
+ toggleRenderItem.addItemListener(this);
246
+ toggleRenderItem.setState(!CameraPane.frozen);
247
+
248
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
249
+ toggleDebugItem.addItemListener(this);
250
+ toggleDebugItem.setState(Globals.DEBUG);
251
+
252
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
253
+ toggleFrustumItem.addItemListener(this);
254
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
255
+
256
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
257
+ toggleFootContactItem.addItemListener(this);
258
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
259
+
260
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
261
+ toggleTimelineItem.addItemListener(this);
262
+ }
263
+
264
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
265
+// toggleRootItem.addItemListener(this);
266
+// toggleRootItem.setState(false);
267
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
268
+// animationItem.addItemListener(this);
269
+// animationItem.setState(CameraPane.ANIMATION);
270
+ cameraMenu.add("-");
271
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
272
+ editCameraItem.addActionListener(this);
273
+
274
+ if (Globals.ADVANCED)
275
+ {
276
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
277
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
278
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
279
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
280
+ oe.cameraMenu.add("-");
281
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
282
+ openWindowItem.addActionListener(this);
283
+ editLeafItem.addActionListener(this);
284
+ lookAtItem.addActionListener(this);
285
+ //lookFromItem.addActinoListener(this);
286
+ //switchViewItem.addActionListener(this);
287
+ }
288
+
289
+ oe.menuBar.add(menu = new Menu("Setting"));
290
+ if (Globals.ADVANCED)
291
+ {
196292 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
197293 revertMeshItem.addActionListener(this);
198294 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
199295 resetreferencesItem.addActionListener(this);
200296 menu.add("-");
297
+ }
201298 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
202299 overwriteGeoItem.addActionListener(this);
203300 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -209,72 +306,103 @@
209306 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
210307 overwriteUVItem.addActionListener(this);
211308 menu.add("-");
309
+ if (Globals.ADVANCED)
310
+ {
212311 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
213312 generateMeshItem.addActionListener(this);
214313 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
215314 poseMeshItem.addActionListener(this);
216315 menu.add("-");
316
+ }
217317 resetsupportItem = menu.add(new MenuItem("Reset support"));
218318 resetsupportItem.addActionListener(this);
219319 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220320 linkverticesItem.addActionListener(this);
321
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
322
+ relinkverticesItem.addActionListener(this);
323
+
324
+ if (Globals.ADVANCED)
325
+ {
221326 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222327 setMasterItem.addActionListener(this);
328
+ }
223329
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);
330
+ oe.menuBar.add(menu = new Menu("Group"));
331
+// grabItem = menu.add(new MenuItem("Grab"));
332
+// grabItem.addActionListener(this);
229333 backItem = menu.add(new MenuItem("Back"));
230334 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);
335
+ frontItem = menu.add(new MenuItem("Front"));
336
+ frontItem.addActionListener(this);
337
+// compositeItem = menu.add(new MenuItem("Composite"));
338
+// compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
342
+ hideItem = menu.add(new MenuItem("Hidden Group"));
343
+ hideItem.addActionListener(this);
344
+ }
345
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
346
+ ungroupItem.addActionListener(this);
347
+
348
+// menu.add("-");
349
+//
350
+// switchItem = menu.add(new MenuItem("Switch node"));
351
+// switchItem.addActionListener(this);
352
+ if (Globals.ADVANCED)
353
+ {
240354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
241355 switchGeoItem.addActionListener(this);
242356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
243357 switchTransfoItem.addActionListener(this);
244
- morphItem = menu.add(new MenuItem("Morph"));
358
+ morphItem = menu.add(new MenuItem("Morph Group"));
245359 morphItem.addActionListener(this);
360
+
361
+ menu.add("-");
362
+ physicsItem = menu.add(new MenuItem("Physics"));
363
+ physicsItem.addActionListener(this);
364
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
365
+ frameselectorItem.addActionListener(this);
246366 scriptNodeItem = menu.add(new MenuItem("Script Node"));
247367 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);
368
+ }
369
+
370
+ oe.menuBar.add(menu = new Menu("Object"));
371
+// textureItem = menu.add(new MenuItem("Texture"));
372
+// textureItem.addActionListener(this);
373
+ billboardItem = menu.add(new MenuItem("Billboard"));
374
+ billboardItem.addActionListener(this);
253375 csgItem = menu.add(new MenuItem("CSG"));
254376 csgItem.addActionListener(this);
255
- shadowXItem = menu.add(new MenuItem("Shadow X"));
377
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
256378 shadowXItem.addActionListener(this);
257
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
379
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
258380 shadowYItem.addActionListener(this);
259
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
381
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
260382 shadowZItem.addActionListener(this);
383
+ if (Globals.ADVANCED)
384
+ {
385
+ menu.add("-");
261386 linkerItem = menu.add(new MenuItem("Linker"));
262387 linkerItem.addActionListener(this);
263
- templateItem = menu.add(new MenuItem("Template"));
264
- templateItem.addActionListener(this);
265388 attributeItem = menu.add(new MenuItem("Attribute"));
266389 attributeItem.addActionListener(this);
390
+ templateItem = menu.add(new MenuItem("Template"));
391
+ templateItem.addActionListener(this);
267392 pointflowItem = menu.add(new MenuItem("Point Flow"));
268393 pointflowItem.addActionListener(this);
394
+ }
269395 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272396 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273397 resetTransformItem.addActionListener(this);
274398 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275399 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
400
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
401
+ resetCentroidXZItem.addActionListener(this);
402
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
403
+ transformGeometryItem.addActionListener(this);
404
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
405
+ transformChildrenItem.addActionListener(this);
278406
279407 oe.menuBar.add(menu = new Menu("Geometry"));
280408 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +411,13 @@
283411 genNormalsORGANItem.addActionListener(this);
284412 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285413 genNormalsCADItem.addActionListener(this);
414
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
415
+ genNormalsMESHItem.addActionListener(this);
416
+ if (Globals.ADVANCED)
417
+ {
418
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
419
+ genNormalsMINEItem.addActionListener(this);
420
+ }
286421 stripifyItem = menu.add(new MenuItem("Stripify"));
287422 stripifyItem.addActionListener(this);
288423 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +427,6 @@
292427 untrimItem = menu.add(new MenuItem("Untrim"));
293428 untrimItem.addActionListener(this);
294429 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297430 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298431 clearColorsItem.addActionListener(this);
299432 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -306,19 +439,34 @@
306439 reduce34MeshItem.addActionListener(this);
307440 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308441 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311442 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312443 clipMeshItem.addActionListener(this);
444
+
445
+ if (Globals.ADVANCED)
446
+ {
447
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
448
+ smoothMeshItem.addActionListener(this);
449
+ }
450
+
451
+ oe.menuBar.add(menu = new Menu("Attributes"));
452
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
453
+ clearMaterialsItem.addActionListener(this);
454
+ resetAllItem = menu.add(new MenuItem("Reset All"));
455
+ resetAllItem.addActionListener(this);
456
+ stepAllItem = menu.add(new MenuItem("Step All"));
457
+ stepAllItem.addActionListener(this);
313458 menu.add("-");
314459 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315460 liveleavesItem.addActionListener(this);
316461 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
317462 unliveleavesItem.addActionListener(this);
463
+ if (Globals.ADVANCED)
464
+ {
318465 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
319466 supportleavesItem.addActionListener(this);
320467 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
321468 unsupportleavesItem.addActionListener(this);
469
+ }
322470 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
323471 hideleavesItem.addActionListener(this);
324472 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -327,32 +475,31 @@
327475 markleavesItem.addActionListener(this);
328476 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
329477 unmarkleavesItem.addActionListener(this);
478
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
479
+ rewindleavesItem.addActionListener(this);
480
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
481
+ unrewindleavesItem.addActionListener(this);
482
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
483
+ randomleavesItem.addActionListener(this);
484
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
485
+ unrandomleavesItem.addActionListener(this);
330486 menu.add("-");
331487 flipVItem = menu.add(new MenuItem("Flip V"));
332488 flipVItem.addActionListener(this);
333489 unflipVItem = menu.add(new MenuItem("Unflip V"));
334490 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
491
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336492 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
493
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338494 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
495
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340496 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
497
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342498 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
499
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344500 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
501
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346502 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);
356503
357504 oe.menuBar.add(menu = new Menu("Selection"));
358505 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -370,14 +517,41 @@
370517 sortbysizeItem.addActionListener(this);
371518 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372519 sortbynameItem.addActionListener(this);
520
+ menu.add("-");
521
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
522
+ shareGeometriesItem.addActionListener(this);
523
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
524
+ mergeGeometriesItem.addActionListener(this);
525
+ if (Globals.ADVANCED)
526
+ {
527
+ // Pretty much the same as duplicate and clone.
528
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
529
+ extractGeometriesItem.addActionListener(this);
530
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
531
+ cloneGeometriesItem.addActionListener(this);
532
+ }
533
+
373534 oe.menuBar.add(menu = new Menu("Insert"));
374535 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
536
+
537
+ oe.menuBar.add(menu = new Menu("Tools"));
376538 buildToolsMenu(menu);
377539 }
378540
379541 void SetupUI2(ObjEditor oe)
380542 {
543
+ // June 2019
544
+ if (oe == null)
545
+ {
546
+ //super.SetupUI2(this);
547
+ //return;
548
+ }
549
+
550
+ if (copy != group)
551
+ {
552
+ //super.SetupUI2(this);
553
+ }
554
+
381555 //new Exception().printStackTrace();
382556
383557 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -406,150 +580,214 @@
406580 oe.radioPanel.add(dummyButton);
407581 oe.buttonGroup.add(dummyButton);
408582 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
583
+ cGridBag copyOptionsPanel = new cGridBag();
584
+
585
+ copyOptionsPanel.preferredHeight = 1;
412586
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
587
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
588
+
589
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
590
+ //minButton.setToolTipText("Minimize window");
591
+ //minButton.addActionListener(this);
592
+
593
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
+ maxButton.setToolTipText("Maximize window");
595
+ maxButton.addActionListener(this);
596
+
597
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598
+ fullButton.setToolTipText("Full-screen window");
599
+ fullButton.addActionListener(this);
600
+
601
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ restoreCameraButton.setToolTipText("Restore viewpoint");
603
+ restoreCameraButton.addActionListener(this);
604
+
605
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
+ undoButton.setToolTipText("Undo changes");
607
+ undoButton.addActionListener(this);
608
+ undoButton.setEnabled(false);
609
+
610
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ redoButton.setToolTipText("Redo changes");
612
+ redoButton.addActionListener(this);
613
+ redoButton.setEnabled(false);
614
+
615
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ saveButton.setToolTipText("Save changes");
617
+ saveButton.addActionListener(this);
618
+
619
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
620
+ liveCB.setToolTipText("Enable animation");
414621 liveCB.addItemListener(this);
415622
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);
623
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ oneStepButton.setToolTipText("Animate one step forward");
625
+ oneStepButton.addActionListener(this);
626
+
627
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
628
+ fastCB.setToolTipText("Fast mode");
434629 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);
441
-
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);
630
+
631
+ //oe.toolboxPanel.Return();
632
+
633
+ copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ screenfitButton.setToolTipText("Screen fit");
480635 screenfitButton.addActionListener(this);
481
- oe.aConstraints.gridx += 1;
636
+
637
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
638
+// trackCB.setToolTipText("Enable tracking");
639
+// trackCB.addItemListener(this);
640
+
482641 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
483642 // 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;
488643
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;
644
+ if (Globals.ADVANCED)
645
+ {
646
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ snapobjectButton.addActionListener(this);
648
+ snapobjectButton.setToolTipText("Snap Object");
649
+ }
650
+
651
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
499652
500
- //
501
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
653
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ twoButton.setToolTipText("Show center view only");
502655 twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
656
+ this.fullscreenLayout = twoButton;
657
+
658
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504659 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
660
+ fourButton.setToolTipText("Show left panel only");
661
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ sixButton.setToolTipText("2-column layout left");
506663 sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
+ threeButton.setToolTipText("2-column layout right");
508666 threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
667
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
+ sevenButton.setToolTipText("3-column layout");
510669 sevenButton.addActionListener(this);
511670 //
512671
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
672
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
673
+ rootButton.setToolTipText("Edit selection in new tab");
514674 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
675
+
676
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
677
+ closeButton.setToolTipText("Close tab");
517678 closeButton.addActionListener(this);
518679 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
519680 //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;
528681
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
682
+ // INSERT
683
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ gridButton.setToolTipText("Create grid");
685
+ gridButton.addActionListener(this);
686
+
687
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ boxButton.setToolTipText("Create box");
689
+ boxButton.addActionListener(this);
690
+
691
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
692
+ sphereButton.setToolTipText("Create sphere");
693
+ sphereButton.addActionListener(this);
694
+
695
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696
+ coneButton.setToolTipText("Create cone");
697
+ coneButton.addActionListener(this);
698
+
699
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ torusButton.setToolTipText("Create torus");
701
+ torusButton.addActionListener(this);
702
+
703
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+ superButton.setToolTipText("Create superellipsoid");
705
+ superButton.addActionListener(this);
706
+
707
+ if (Globals.ADVANCED)
708
+ {
709
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
710
+ kleinButton.setToolTipText("Create Klein bottle");
711
+ kleinButton.addActionListener(this);
712
+ }
713
+
714
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ particlesButton.setToolTipText("Create particle system");
716
+ particlesButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.Return();
719
+
720
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
721
+ groupButton.setToolTipText("Create group");
722
+ groupButton.addActionListener(this);
723
+
724
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ compositeButton.setToolTipText("Create composite");
726
+ compositeButton.addActionListener(this);
727
+
728
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
+ switchButton.setToolTipText("Create item switcher");
730
+ switchButton.addActionListener(this);
731
+
732
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ loopButton.setToolTipText("Create loop");
734
+ loopButton.addActionListener(this);
735
+
736
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
737
+ textureButton.setToolTipText("Create texture");
738
+ textureButton.addActionListener(this);
739
+
740
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ overlayButton.setToolTipText("Create overlay");
742
+ overlayButton.addActionListener(this);
743
+
744
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ lightButton.setToolTipText("Create light");
746
+ lightButton.addActionListener(this);
747
+
748
+ for (int i=6; --i>=0;)
749
+ {
750
+ oe.toolboxPanel.Return();
751
+ oe.toolboxPanel.add(new cGridBag());
752
+ oe.toolboxPanel.add(new cGridBag());
753
+ oe.toolboxPanel.add(new cGridBag());
754
+ oe.toolboxPanel.add(new cGridBag());
755
+ oe.toolboxPanel.add(new cGridBag());
756
+ oe.toolboxPanel.add(new cGridBag());
757
+ oe.toolboxPanel.add(new cGridBag());
758
+ }
759
+
760
+ // EDIT panel
761
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
762
+ editButton.setToolTipText("Pin selection controls");
763
+ editButton.addActionListener(this);
764
+
765
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
+ uneditButton.setToolTipText("Remove selection controls");
530767 uneditButton.addActionListener(this);
531768
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);
769
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
770
+ allParamsButton.setToolTipText("Show all controle");
544771 allParamsButton.addActionListener(this);
545772
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);
773
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
774
+ clearPanelButton.setToolTipText("Clear edit panel");
775
+ clearPanelButton.addActionListener(this);
776
+
777
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
778
+ unselectButton.setToolTipText("Unselect");
551779 unselectButton.addActionListener(this);
552780
781
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
782
+ flashSelectionButton.setToolTipText("Highlight selection");
783
+ flashSelectionButton.addActionListener(this);
784
+
785
+ editCommandsPanel.preferredHeight = 1;
786
+
787
+ SetPinStates(false);
788
+// oe.treePanel.add(commandsPanel);
789
+// oe.treePanel.Return();
790
+
553791 // oe.aConstraints.gridx += 1;
554792 // oe.aConstraints.weighty = 0;
555793 // oe.aConstraints.gridwidth = 1;
....@@ -561,40 +799,22 @@
561799 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
562800 // gcButton.addActionListener(this);
563801
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;
802
+ cGridBag jSPPanel = new cGridBag();
803
+
804
+ JScrollPane jSP;
575805 //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);
806
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
577807 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;
597808
809
+ oe.treePanel.add(jSPPanel);
810
+ oe.treePanel.Return();
811
+
812
+ oe.treePanel.add(copyOptionsPanel);
813
+ oe.treePanel.Return();
814
+
815
+// mainPanel.setDividerLocation(0.5); //1.0);
816
+// mainPanel.setResizeWeight(0.5);
817
+
598818 //jList.addListSelectionListener(this);
599819 oe.jTree.addTreeSelectionListener(this);
600820 //jTree.setRootVisible(false);
....@@ -616,20 +836,157 @@
616836 radio.layout = sevenButton;
617837 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
618838 }
839
+
840
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
841
+ {
842
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
843
+ colorCB.setToolTipText("Copy color when dropped");
844
+ colorCB.addItemListener(this);
845
+
846
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
847
+ materialCB.setToolTipText("Copy material when dropped");
848
+ materialCB.addItemListener(this);
849
+
850
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
851
+ textureCB.setToolTipText("Copy texture when dropped");
852
+ textureCB.addItemListener(this);
853
+
854
+ panel.Return();
855
+
856
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
857
+ boxCB.setToolTipText("Display bounding boxes");
858
+ boxCB.addItemListener(this);
859
+
860
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
861
+ zoomBoxCB.setToolTipText("Display only for wheel");
862
+ zoomBoxCB.addItemListener(this);
863
+
864
+ if (true) // Globals.ADVANCED)
865
+ {
866
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
867
+// supportCB.setToolTipText("Enable rigging");
868
+// supportCB.addItemListener(this);
869
+
870
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
871
+ freezeCB.setToolTipText("Fast moving camera");
872
+ freezeCB.addItemListener(this);
873
+
874
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
875
+ // localCB.addItemListener(this);
876
+
877
+ panel.Return();
878
+
879
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
880
+ crowdCB.setToolTipText("Used for crowds");
881
+ crowdCB.addItemListener(this);
882
+
883
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
884
+ smoothCB.setToolTipText("Snapping delay");
885
+ smoothCB.addItemListener(this);
886
+
887
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
888
+ slowCB.setToolTipText("Smooth interpolation");
889
+ slowCB.addItemListener(this);
890
+
891
+// constraints.gridy += 1;
892
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
893
+// speakerMocapCB.addItemListener(this);
894
+
895
+ panel.Return();
896
+
897
+ if (false)
898
+ {
899
+ // handled in scripts
900
+ //constraints.gridy += 1;
901
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
902
+ speakerCameraCB.addItemListener(this);
903
+
904
+ //constraints.gridy += 1;
905
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
906
+ speakerFocusCB.addItemListener(this);
907
+
908
+ //constraints.gridy += 1;
909
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
910
+ smoothfocusCB.addItemListener(this);
911
+ panel.Return();
912
+ }
913
+
914
+//constraints.gridx += 1;
915
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
916
+// debugCB.addItemListener(this);
917
+
918
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
919
+ trackCB.setToolTipText("Enable tracking target");
920
+ trackCB.addItemListener(this);
921
+
922
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
923
+ oeilCB.setToolTipText("Move camera when tracking");
924
+ oeilCB.addItemListener(this);
925
+
926
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
927
+ shadowCB.setToolTipText("When live compute shadows");
928
+ shadowCB.addItemListener(this);
929
+
930
+ panel.Return();
931
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
932
+ toggleTextureCB.setToolTipText("Load textures");
933
+ toggleTextureCB.addItemListener(this);
934
+
935
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
936
+ toggleSwitchCB.setToolTipText("Choose a single item");
937
+ toggleSwitchCB.addItemListener(this);
938
+
939
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
940
+ autosaveCB.setToolTipText("On structure change");
941
+ autosaveCB.addItemListener(this);
942
+
943
+ panel.Return();
944
+ if (Globals.ADVANCED)
945
+ {
946
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
947
+ lookAtCB.setToolTipText("Look-at target");
948
+ lookAtCB.addItemListener(this);
949
+ }
950
+
951
+ }
952
+
953
+ cGridBag fill = new cGridBag();
954
+ fill.preferredHeight = 200;
955
+ cGridBag fill2 = new cGridBag();
956
+ fill2.preferredHeight = 200;
957
+ cGridBag fill3 = new cGridBag();
958
+ fill3.preferredHeight = 200;
959
+
960
+ panel.add(fill);
961
+ panel.add(fill2);
962
+ panel.add(fill3);
963
+
964
+ }
619965
620966 void EditObject(Object3D obj)
621967 {
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();
968
+ cRadio radioButton = new cRadio(obj.name);
969
+
970
+ // Patch to avoid bug with transparency.
971
+ radioButton.hadMaterial = obj.material != null;
972
+ if (!radioButton.hadMaterial)
973
+ {
974
+ obj.material = new cMaterial();
975
+ }
976
+
977
+ radioButton.SetObject(obj);
978
+ radioButton.layout = sevenButton;
979
+ radioButton.SetCamera(cameraView.renderCamera, false);
980
+ radioButton.addActionListener(this);
981
+ radioPanel.add(radioButton);
982
+ buttonGroup.add(radioButton);
983
+ radioButton.doClick();
630984 }
985
+
631986 void SetupViews(ObjEditor oe)
632987 {
988
+ theFrame = this;
989
+
633990 oe.SetupViews();
634991
635992 System.out.println("SetupViews");
....@@ -638,22 +995,28 @@
638995 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
639996 }
640997
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;
998
+ cToggleButton liveCB;
999
+ cCheckBox supportCB;
1000
+ cCheckBox localCB;
1001
+ cCheckBox crowdCB;
1002
+ cCheckBox smoothCB;
1003
+ cToggleButton fastCB;
1004
+ cCheckBox slowCB;
1005
+ cCheckBox boxCB;
1006
+ cCheckBox zoomBoxCB;
1007
+ cCheckBox freezeCB;
1008
+ //cToggleButton trackCB;
1009
+ cCheckBox trackCB;
1010
+ cCheckBox smoothfocusCB;
6511011 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
1012
+ cCheckBox speakerCameraCB;
1013
+ cCheckBox speakerFocusCB;
1014
+ cCheckBox debugCB;
1015
+
1016
+ cCheckBox oeilCB;
1017
+ cCheckBox shadowCB;
1018
+ cCheckBox autosaveCB;
1019
+ cCheckBox lookAtCB;
6571020
6581021 // static int COLOR = 1;
6591022 // static int MATERIAL = 2;
....@@ -661,9 +1024,9 @@
6611024
6621025 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6631026
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
1027
+ cCheckBox colorCB;
1028
+ cCheckBox materialCB;
1029
+ cCheckBox textureCB;
6671030
6681031 public void itemStateChanged(ItemEvent e)
6691032 {
....@@ -688,10 +1051,10 @@
6881051 dropAttributes |= Object3D.TEXTURE;
6891052 else
6901053 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
1054
+ } else if(e.getSource() == liveCB)
6931055 {
6941056 cameraView.ToggleLive();
1057
+ refreshContents(false);
6951058 }
6961059 else if(e.getSource() == supportCB)
6971060 {
....@@ -727,6 +1090,10 @@
7271090 cameraView.repaint();
7281091 // refreshContents();
7291092 }
1093
+ else if(e.getSource() == zoomBoxCB)
1094
+ {
1095
+ cameraView.ToggleZoomBoxMode();
1096
+ }
7301097 else if(e.getSource() == smoothfocusCB)
7311098 {
7321099 cameraView.ToggleSmoothFocus();
....@@ -752,6 +1119,18 @@
7521119 {
7531120 cameraView.ToggleOeil();
7541121 }
1122
+ else if(e.getSource() == shadowCB)
1123
+ {
1124
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1125
+ }
1126
+ else if(e.getSource() == freezeCB)
1127
+ {
1128
+ Globals.FREEZEONMOVE ^= true;
1129
+ }
1130
+ else if(e.getSource() == autosaveCB)
1131
+ {
1132
+ Globals.SAVEONMAKE ^= true;
1133
+ }
7551134 else if(e.getSource() == lookAtCB)
7561135 {
7571136 cameraView.ToggleLookAt();
....@@ -768,7 +1147,8 @@
7681147
7691148 /**/
7701149 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
771
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1150
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1151
+ TreePath path = objEditor.jTree.getSelectionPath();
7721152 if ((path == null) || (path.getPathCount() <= 1)) {
7731153 // We can't move the root node or an empty selection
7741154 return;
....@@ -840,7 +1220,9 @@
8401220 // objEditor.DropFile((java.io.File[]) object, true);
8411221 // return;
8421222 // }
843
- if (string.charAt(0) == '/')
1223
+
1224
+ // File path for Mac and Windows
1225
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441226 {
8451227 // file(s)
8461228 String[] names = string.split("\n");
....@@ -867,7 +1249,7 @@
8671249
8681250 flashIt = false;
8691251 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1252
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711253 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721254
8731255 if (group.selection.size() == 1)
....@@ -883,23 +1265,33 @@
8831265
8841266 assert target == objEditor.jTree;
8851267 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1268
+ Object3D destinationLeaf;
8861269 try {
887
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1270
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
8881271 } catch (Exception e) {
8891272 System.out.println("destinationPath : " + destinationPath);
8901273 return;
8911274 }
8921275
893
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1276
+ for (int i=group.selection.size(); --i>=0;)
8941277 {
1278
+ Object3D child = (Object3D)group.selection.elementAt(i);
1279
+
1280
+ // Cannot move into itself
1281
+ if (child == destinationLeaf)
1282
+ return;
1283
+ }
1284
+
1285
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1286
+// {
8951287 loadClipboard(true);
8961288 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
898
- } else {
899
- loadClipboard(false);
900
- objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
902
- }
1289
+ pasteInto(false, false);
1290
+// } else {
1291
+// loadClipboard(false);
1292
+// objEditor.jTree.setSelectionPath(destinationPath);
1293
+// pasteInto(false, false); // true); // ???
1294
+// }
9031295 }
9041296 public void dropActionChanged(DropTargetDragEvent dtde)
9051297 // Called if the user has modified the current drop gesture
....@@ -1002,90 +1394,106 @@
10021394
10031395 void buildCreateMenu(Menu menu)
10041396 {
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);
1397
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1398
+ //heightFieldItem.addActionListener(this);
1399
+// gridItem = menu.add(new MenuItem("Grid"));
1400
+// gridItem.addActionListener(this);
1401
+// rectoidItem = menu.add(new MenuItem("Box"));
1402
+// rectoidItem.addActionListener(this);
1403
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1404
+// ellipsoidItem.addActionListener(this);
1405
+// coneItem = menu.add(new MenuItem("Cone"));
1406
+// coneItem.addActionListener(this);
1407
+// torusItem = menu.add(new MenuItem("Torus"));
1408
+// torusItem.addActionListener(this);
1409
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1410
+// superItem.addActionListener(this);
1411
+
1412
+ cameraItem = menu.add(new MenuItem("Camera"));
1413
+ cameraItem.addActionListener(this);
1414
+
1415
+ if (!Globals.ADVANCED)
1416
+ {
1417
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1418
+ kleinItem.addActionListener(this);
1419
+ }
1420
+
1421
+// particleItem = menu.add(new MenuItem("Particle system"));
1422
+// particleItem.addActionListener(this);
1423
+ if (Globals.ADVANCED)
1424
+ {
10191425 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201426 ragdollItem.addActionListener(this);
10211427 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221428 ragdoll2Item.addActionListener(this);
1429
+ }
10231430 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1431
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251432 meshItem.addActionListener(this);
10261433 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271434 // meshGroupItem.addActionListener(this);
1435
+ if (Globals.ADVANCED)
1436
+ {
10281437 springItem = menu.add(new MenuItem("Spring"));
10291438 springItem.addActionListener(this);
10301439 flagItem = menu.add(new MenuItem("Flag"));
10311440 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);
10361441 blobItem = menu.add(new MenuItem("Blob"));
10371442 blobItem.addActionListener(this);
10381443 latheItem = menu.add(new MenuItem("Lathe"));
10391444 latheItem.addActionListener(this);
1040
- lightItem = menu.add(new MenuItem("Light"));
1041
- lightItem.addActionListener(this);
1445
+ }
1446
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1447
+ bezierItem.addActionListener(this);
1448
+// overlayItem = menu.add(new MenuItem("Overlay"));
1449
+// overlayItem.addActionListener(this);
1450
+// lightItem = menu.add(new MenuItem("Light"));
1451
+// lightItem.addActionListener(this);
10421452 menu.add("-");
10431453 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10441454 //superLoopItem.addActionListener(this);
1045
- loopItem = menu.add(new MenuItem("Loop"));
1046
- loopItem.addActionListener(this);
1455
+// loopItem = menu.add(new MenuItem("Loop"));
1456
+// loopItem.addActionListener(this);
10471457 doubleItem = menu.add(new MenuItem("Fork"));
10481458 doubleItem.addActionListener(this);
1459
+ if (Globals.ADVANCED)
1460
+ {
10491461 tripleItem = menu.add(new MenuItem("Trident"));
10501462 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);
1463
+ }
10601464 }
10611465
10621466 void buildToolsMenu(Menu menu)
10631467 {
10641468 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651469 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1470
+ animationItem.setState(Globals.ANIMATION);
10671471
10681472 menu.add("-");
10691473 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701474 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1475
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1476
+ textureFieldItem.addActionListener(this);
1477
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721478 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751479 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761480 reduceMorphItem.addActionListener(this);
10771481 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781482 reduce34MorphItem.addActionListener(this);
1079
-
1483
+ menu.add("-");
10801484 menu.add(computeAOItem = new MenuItem("Compute AO"));
10811485 computeAOItem.addActionListener(this);
1082
- menu.add("-");
10831486
1487
+ if (Globals.ADVANCED)
1488
+ {
1489
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1490
+ mirrorItem.addActionListener(this);
1491
+ menu.add("-");
10841492 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851493 memoryItem.addActionListener(this);
10861494 menu.add(analyzeItem = new MenuItem("Analyze"));
10871495 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
1496
+ menu.add(dumpItem = new MenuItem("Print"));
10891497 dumpItem.addActionListener(this);
10901498 // menu.add(pathItem = new MenuItem("From-to path"));
10911499 // pathItem.addActionListener(this);
....@@ -1094,6 +1502,8 @@
10941502 resetParentItem.addActionListener(this);
10951503 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961504 repairParentItem.addActionListener(this);
1505
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1506
+ repairShadowItem.addActionListener(this);
10971507 menu.add(invariantsItem = new MenuItem("Invariants"));
10981508 invariantsItem.addActionListener(this);
10991509 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1511,7 @@
11011511 menu.add("-");
11021512 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031513 editScriptItem.addActionListener(this);
1514
+ }
11041515 }
11051516
11061517 void ScreenFit()
....@@ -1223,9 +1634,24 @@
12231634 shadow.material = new cMaterial(obj.material);
12241635 shadow.material.diffuse = 0.0001f;
12251636 shadow.material.specular = 0.0001f;
1637
+ //shadow.projectedVertices[1].x = 300;
12261638
12271639 makeSomething(shadow);
12281640 }
1641
+
1642
+ private void ClearUnpinned()
1643
+ {
1644
+ //for (Object3D obj : listUI)
1645
+ for (int i=listUI.size(); --i>=0;)
1646
+ {
1647
+ Object3D obj = listUI.elementAt(i);
1648
+ if (!obj.pinned)
1649
+ {
1650
+ obj.CloseUI();
1651
+ listUI.remove(i);
1652
+ }
1653
+ }
1654
+ }
12291655
12301656 /**
12311657 * applyExample
....@@ -1429,9 +1855,9 @@
14291855
14301856 void Overwrite(int mask)
14311857 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1858
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14331859 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1860
+ Object3D content = Grafreed.clipboard.get(0);
14351861
14361862 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371863 content = ((cGroup)content).get(0);
....@@ -1454,6 +1880,7 @@
14541880 //
14551881 public void actionPerformed(ActionEvent event) // , Object arg)
14561882 {
1883
+ Object source = event.getSource();
14571884 /*
14581885 if (event.getSource() == nameField)
14591886 {
....@@ -1465,11 +1892,11 @@
14651892 }
14661893 else
14671894 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1895
+ if (source == lookAtItem || source == lookFromItem)
14691896 {
14701897 ScreenFit();
14711898 } else
1472
- if (event.getSource() == switchItem)
1899
+ if (source == switchViewItem)
14731900 {
14741901 cVector v1 = new cVector();
14751902 cVector v2 = new cVector();
....@@ -1478,11 +1905,11 @@
14781905 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791906 objEditor.cameraView.repaint();
14801907 } else
1481
- if (event.getSource() == rectoidItem)
1908
+ if (source == rectoidItem || source == boxButton)
14821909 {
14831910 makeSomething(new Box());
14841911 } else
1485
- if (event.getSource() == particleItem)
1912
+ if (source == particleItem || source == particlesButton)
14861913 {
14871914 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881915 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1930,9 @@
15031930 applyExample(particleGeom, "SMOKE");
15041931 makeSomething(particleGeom);
15051932 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1933
+ if (source == ragdollItem || source == ragdoll2Item)
15071934 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1935
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091936
15101937 ragdoll.toParent = LA.newMatrix();
15111938 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +1948,71 @@
15211948 makeSomething(ragdoll);
15221949 //makeSomething(new VehicleDemo());
15231950 } else
1524
- if (event.getSource() == gridItem)
1951
+ /*
1952
+ */
1953
+ if (source == heightFieldItem)
1954
+ {
1955
+ Object3D obj = new Object3D();
1956
+
1957
+ obj.CreateMaterial();
1958
+ obj.bRep = new BoundaryRep();
1959
+
1960
+ obj.bRep.CreateMesh(new iHeightField()
1961
+ {
1962
+ public double f(double x, double y)
1963
+ {
1964
+ // The Mandelbrot set is represented by coloring
1965
+ // each point (x,y) according to the number of
1966
+ // iterations it takes before the while loop in
1967
+ // this method ends. For points that are actually
1968
+ // in the Mandelbrot set, or very close to it, the
1969
+ // count will reach the maximum value, 80. These
1970
+ // points will be colored purple. All other colors
1971
+ // represent points that are definitely NOT in the set.
1972
+ x -= 600;
1973
+ y -= 500;
1974
+ x /= 200;
1975
+ y /= 200;
1976
+ int count = 0;
1977
+ double zx = x;
1978
+ double zy = y;
1979
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
1980
+ double new_zx = zx*zx - zy*zy + x;
1981
+ zy = 2*zx*zy + y;
1982
+ zx = new_zx;
1983
+ count++;
1984
+ }
1985
+ return count; // Math.sqrt(count);
1986
+ }
1987
+ }, 1000,1000);
1988
+
1989
+ makeSomething(obj);
1990
+ } else
1991
+ if (source == gridItem || source == gridButton)
15251992 {
15261993 makeSomething(new Grid());
15271994 } else
1528
- if (event.getSource() == ellipsoidItem)
1995
+ if (source == ellipsoidItem || source == sphereButton)
15291996 {
15301997 makeSomething(new Sphere());
15311998 } else
1532
- if (event.getSource() == coneItem)
1999
+ if (source == coneItem || source == coneButton)
15332000 {
15342001 makeSomething(new Cone());
15352002 } else
1536
- if (event.getSource() == torusItem)
2003
+ if (source == torusItem || source == torusButton)
15372004 {
15382005 makeSomething(new Torus());
15392006 } else
1540
- if (event.getSource() == superItem)
2007
+ if (source == superItem || source == superButton)
15412008 {
15422009 makeSomething(new Superellipsoid());
15432010 } else
1544
- if (event.getSource() == blobItem)
2011
+ if (source == kleinItem || source == kleinButton)
2012
+ {
2013
+ makeSomething(new Klein());
2014
+ } else
2015
+ if (source == blobItem)
15452016 {
15462017 Blob blob = new Blob();
15472018 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2020,15 @@
15492020 //blob.retile();
15502021 makeSomething(blob);
15512022 } else
1552
- if (event.getSource() == latheItem)
2023
+ if (source == latheItem)
15532024 {
15542025 makeSomething(new Lathe());
15552026 } else
1556
- if (event.getSource() == bezierItem)
2027
+ if (source == bezierItem)
15572028 {
15582029 makeSomething(new BezierSurface());
15592030 } else
1560
- if (event.getSource() == checkerItem)
2031
+ if (source == overlayItem || source == overlayButton)
15612032 {
15622033 /*
15632034 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2041,9 @@
15702041 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712042 LA.matInvert(obj.toParent, obj.fromParent);
15722043 */
1573
- makeSomething(new CheckerIG());
2044
+ makeSomething(new Checker());
15742045 } else
1575
- if (event.getSource() == meshItem)
2046
+ if (source == meshItem)
15762047 {
15772048 Object3D itemtomake = new Object3D();
15782049 Object3D child;
....@@ -1593,35 +2064,35 @@
15932064 makeSomething(child);
15942065 }
15952066 } else
1596
- if (event.getSource() == springItem)
2067
+ if (source == springItem)
15972068 {
15982069 cSpring s = new cSpring();
15992070 s.setup();
16002071 makeSomething(s);
16012072 } else
1602
- if (event.getSource() == flagItem)
2073
+ if (source == flagItem)
16032074 {
16042075 cSpring s = new cFlag();
16052076 s.setup();
16062077 makeSomething(s);
16072078 } else
1608
- if (event.getSource() == lightItem)
2079
+ if (source == lightItem || source == lightButton)
16092080 {
16102081 makeSomething(new Light());
16112082 } else
1612
- if (event.getSource() == csgItem)
2083
+ if (source == csgItem)
16132084 {
16142085 group(new CSG());
16152086 } else
1616
- if (event.getSource() == templateItem)
2087
+ if (source == templateItem)
16172088 {
16182089 group(new cTemplate());
16192090 } else
1620
- if (event.getSource() == attributeItem)
2091
+ if (source == attributeItem)
16212092 {
16222093 makeSomething(new Attribute());
16232094 } else
1624
- if (event.getSource() == pointflowItem)
2095
+ if (source == pointflowItem)
16252096 {
16262097 makeSomething(new PointFlow());
16272098 } else
....@@ -1633,7 +2104,7 @@
16332104 } else
16342105 */
16352106
1636
- if (event.getSource() == superLoopItem)
2107
+ if (source == superLoopItem)
16372108 {
16382109 Composite g = new cGroup();
16392110 for (int i=0; i<15; i++)
....@@ -1655,30 +2126,30 @@
16552126
16562127 group(g);
16572128 } else
1658
- if (event.getSource() == loopItem)
2129
+ if (source == loopItem || source == loopButton)
16592130 {
16602131 Composite csg = new GroupLeaf();
16612132 csg.count = 5;
16622133 group(csg);
1663
- Composite child = new cGroup();
2134
+ Composite child = new cGroup("Branch");
16642135 csg.addChild(child);
16652136 child.addChild(csg);
16662137 } else
1667
- if (event.getSource() == doubleItem)
2138
+ if (source == doubleItem)
16682139 {
1669
- Composite csg = new GroupLeaf();
2140
+ Composite csg = new GroupLeaf("Fork");
16702141 csg.count = 5;
16712142 group(csg);
1672
- Composite child = new cGroup();
2143
+ Composite child = new cGroup("Branch A");
16732144 csg.addChild(child);
16742145 child.addChild(csg);
1675
- child = new cGroup();
2146
+ child = new cGroup("Branch B");
16762147 csg.addChild(child);
16772148 child.addChild(csg);
16782149 } else
1679
- if (event.getSource() == tripleItem)
2150
+ if (source == tripleItem)
16802151 {
1681
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Trident");
16822153 csg.count = 4;
16832154 group(csg);
16842155 Composite child = new cGroup();
....@@ -1691,71 +2162,83 @@
16912162 csg.addChild(child);
16922163 child.addChild(csg);
16932164 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2165
+ if (source == computeAOItem)
16962166 {
1697
- ImportGFD();
2167
+ Globals.drawMode = CameraPane.OCCLUSION;
2168
+ Globals.theRenderer.repaint();
16982169 } 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)
2170
+ if (source == recompileItem)
17172171 {
17182172 Recompile();
17192173 refreshContents();
17202174 } else
1721
- if (event.getSource() == editScriptItem)
2175
+ if (source == editScriptItem)
17222176 {
17232177 OpenDialog();
17242178 refreshContents();
17252179 } else
1726
- if (event.getSource() == invariantsItem)
2180
+ if (source == invariantsItem)
17272181 {
17282182 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2183
+ Grafreed.grafreeD.universe.invariants();
17302184 } else
1731
- if (event.getSource() == memoryItem)
2185
+ if (source == memoryItem)
17322186 {
17332187 //System.out.println("Invariants:");
17342188 PrintMemory();
17352189 } else
1736
- if (event.getSource() == pathItem)
2190
+ if (source == pathItem)
17372191 {
17382192 PrintPath();
17392193 } else
1740
- if (event.getSource() == analyzeItem)
2194
+ if (source == analyzeItem)
17412195 {
17422196 AnalyzeObject();
17432197 } else
1744
- if (event.getSource() == dumpItem)
2198
+ if (source == dumpItem)
17452199 {
17462200 DumpObject();
17472201 } else
1748
- if (event.getSource() == screenfitButton)
2202
+ if (source == minButton)
2203
+ {
2204
+ Minimize();
2205
+ } else
2206
+ if (source == maxButton)
2207
+ {
2208
+ Maximize();
2209
+ } else
2210
+ if (source == fullButton)
2211
+ {
2212
+ ToggleFullScreen();
2213
+ } else
2214
+ if (source == undoButton)
2215
+ {
2216
+ Undo();
2217
+ } else
2218
+ if (source == redoButton)
2219
+ {
2220
+ Redo();
2221
+ } else
2222
+ if (source == saveButton)
2223
+ {
2224
+ Save();
2225
+ } else
2226
+ if (source == oneStepButton)
2227
+ {
2228
+ Globals.ONESTEP = true;
2229
+ cameraView.repaint();
2230
+ } else
2231
+ if (source == screenfitButton)
17492232 {
17502233 //Reload(lastConverter, lastFilename, true);
17512234 ScreenFit();
17522235 } else
1753
- if (event.getSource() == screenfitpointButton)
2236
+ if (source == screenfitpointButton)
17542237 {
17552238 //Reload(lastConverter, lastFilename, true);
17562239 ScreenFitPoint();
17572240 } else
1758
- if (event.getSource() == snapobjectButton)
2241
+ if (source == snapobjectButton)
17592242 {
17602243 //Reload(lastConverter, lastFilename, true);
17612244 SnapObject();
....@@ -1766,13 +2249,13 @@
17662249 // Recompile();
17672250 // refreshContents();
17682251 // } else
1769
- if (event.getSource() == gcButton)
2252
+ if (source == gcButton)
17702253 {
17712254 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722255 System.gc();
17732256 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742257 } else
1775
- if (event.getSource() == editLeafItem)
2258
+ if (source == editLeafItem)
17762259 {
17772260 Object3D obj;
17782261 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2269,78 @@
17862269 }
17872270 refreshContents(true);
17882271 } else
1789
- if (event.getSource() == openWindowItem)
2272
+ if (source == openWindowItem)
17902273 {
17912274 EditSelection(true);
17922275 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2276
+ if (source == cutItem || source == clearButton)
17942277 {
17952278 loadClipboard(true);
17962279 } else
1797
- if (event.getSource() == duplicateItem)
2280
+ if (source == undoItem)
17982281 {
1799
- Object3D keep = GraphreeD.clipboard;
2282
+ Undo();
2283
+ } else
2284
+ if (source == redoItem)
2285
+ {
2286
+ Redo();
2287
+ } else
2288
+ if (source == duplicateItem)
2289
+ {
2290
+ Object3D keep = Grafreed.clipboard;
18002291 loadClipboard(false);
18012292 paste(false);
1802
- GraphreeD.clipboard = keep;
2293
+ Grafreed.clipboard = keep;
18032294 } else
1804
- if (event.getSource() == cloneItem)
2295
+ if (source == cloneItem)
18052296 {
18062297 CloneSelection(false);
18072298 } else
1808
- if (event.getSource() == cloneSupportItem)
2299
+ if (source == cloneSupportItem)
18092300 {
18102301 CloneSelection(true);
18112302 } else
1812
- if (event.getSource() == copyItem)
2303
+ if (source == copyItem)
18132304 {
18142305 loadClipboard(false);
18152306 } else
1816
- if (event.getSource() == pasteItem)
2307
+ if (source == pasteItem)
18172308 {
18182309 paste(false);
18192310 } else
1820
- if (event.getSource() == pasteLinkItem)
2311
+ if (source == pasteIntoItem)
18212312 {
1822
- pasteInto(false);
2313
+ pasteInto(true, false);
18232314 } else
1824
- if (event.getSource() == pasteCloneItem)
2315
+ if (source == pasteLinkItem)
18252316 {
1826
- pasteInto(true);
2317
+ pasteInto(false, false);
18272318 } else
1828
- if (event.getSource() == pasteExpandItem)
2319
+ if (source == pasteCloneItem)
2320
+ {
2321
+ pasteInto(true, true);
2322
+ } else
2323
+ if (source == pasteExpandItem)
18292324 {
18302325 paste(true);
18312326 } else
1832
- if (event.getSource() == synchronizeItem)
2327
+ if (source == synchronizeItem)
18332328 {
18342329 Overwrite(Object3D.TRANSFORM);
18352330 } else
1836
- if (event.getSource() == overwriteNameItem)
2331
+ if (source == overwriteNameItem)
18372332 {
18382333 Overwrite(Object3D.NAME);
18392334 } else
1840
- if (event.getSource() == overwriteUVItem)
2335
+ if (source == overwriteUVItem)
18412336 {
18422337 Overwrite(Object3D.UV);
18432338 } else
1844
- if (event.getSource() == overwriteMatItem)
2339
+ if (source == overwriteMatItem)
18452340 {
2341
+ /* july 2015
18462342 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2343
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482344 else
18492345 {
18502346 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2352,16 @@
18562352 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572353 }
18582354 }
2355
+ */
2356
+
2357
+ Overwrite(dropAttributes);
18592358 }
1860
- if (event.getSource() == overwriteGeoItem)
2359
+ if (source == overwriteGeoItem)
18612360 {
18622361 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2362
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642363 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2364
+// Object3D content = GrafreeD.clipboard.get(0);
18662365 //
18672366 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682367 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2373,7 @@
18742373 // refreshContents();
18752374 // }
18762375 } else
1877
- if (event.getSource() == generateMeshItem)
2376
+ if (source == generateMeshItem)
18782377 {
18792378 //if (group.selection.size() == 1)
18802379 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2384,7 @@
18852384 ResetModel();
18862385 refreshContents();
18872386 } else
1888
- if (event.getSource() == extractGeometriesItem)
2387
+ if (source == extractGeometriesItem)
18892388 {
18902389 boolean one = false;
18912390
....@@ -1912,7 +2411,7 @@
19122411 ResetModel();
19132412 refreshContents();
19142413 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2414
+ if (source == cloneGeometriesItem)
19162415 {
19172416 boolean one = false;
19182417
....@@ -1938,32 +2437,37 @@
19382437 ResetModel();
19392438 refreshContents();
19402439 } else
1941
- if (event.getSource() == shareGeometriesItem)
2440
+ if (source == shareGeometriesItem)
19422441 {
19432442 boolean one = false;
19442443
19452444 if (group.selection.size() == 1)
19462445 one = true;
19472446
2447
+ Object3D merge = null;
2448
+
19482449 Object3D content = new cGroup();
19492450
19502451 for (int i=0; i<group.selection.size(); i++)
19512452 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2453
+ merge = new Merge(group.selection.get(i));
19532454
19542455 if (one)
1955
- makeSomething(sel, false);
2456
+ makeSomething(merge, false);
19562457 else
1957
- content.addChild(sel);
2458
+ content.addChild(merge);
19582459 }
19592460
19602461 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2462
+ makeSomething(content, true);
2463
+ else
2464
+ {
2465
+ ResetModel();
2466
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2467
+ refreshContents();
2468
+ }
19652469 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2470
+ if (source == mergeGeometriesItem)
19672471 {
19682472 boolean one = false;
19692473
....@@ -1993,11 +2497,11 @@
19932497 ResetModel();
19942498 refreshContents();
19952499 } else
1996
- if (event.getSource() == linkverticesItem)
2500
+ if (source == linkverticesItem)
19972501 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2502
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992503 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2504
+// Object3D content = GrafreeD.clipboard.get(0);
20012505 //
20022506 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032507 // content = ((cGroup)content).get(0);
....@@ -2006,39 +2510,48 @@
20062510 // group.selection.get(0).setMasterThis(content); // should be identity
20072511 // refreshContents();
20082512 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2513
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20102514 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2515
+ Object3D content = Grafreed.clipboard.get(0);
20122516
20132517 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142518 content = ((cGroup)content).get(0);
20152519
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2520
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172521 for (int i=0; i<group.selection.size(); i++)
20182522 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
2523
+ boolean random = CameraPane.SWITCH;
2524
+ CameraPane.SWITCH = false; // parse all random nodes
20212525 group.selection.get(i).linkVerticesThis(content);
20222526 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
2527
+ CameraPane.SWITCH = random;
20242528 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2529
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262530 refreshContents();
20272531 }
20282532 } else
2029
- if (event.getSource() == resetsupportItem)
2533
+ if (source == resetsupportItem)
20302534 {
20312535 for (int i=0; i<group.selection.size(); i++)
20322536 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
2537
+ boolean random = CameraPane.SWITCH;
2538
+ CameraPane.SWITCH = false; // parse all random nodes
20352539 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
2540
+ CameraPane.SWITCH = random;
20372541 }
20382542
20392543 refreshContents();
20402544 } else
2041
- if (event.getSource() == resetreferencesItem)
2545
+ if (source == relinkverticesItem)
2546
+ {
2547
+ boolean random = CameraPane.SWITCH;
2548
+ CameraPane.SWITCH = false; // parse all random nodes
2549
+ group.selection.RelinkToSupport();
2550
+ CameraPane.SWITCH = random;
2551
+
2552
+ refreshContents();
2553
+ } else
2554
+ if (source == resetreferencesItem)
20422555 {
20432556 for (int i=0; i<group.selection.size(); i++)
20442557 {
....@@ -2047,11 +2560,11 @@
20472560
20482561 refreshContents();
20492562 } else
2050
- if (event.getSource() == setMasterItem)
2563
+ if (source == setMasterItem)
20512564 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2565
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20532566 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2567
+ Object3D content = Grafreed.clipboard.get(0);
20552568
20562569 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572570 content = ((cGroup)content).get(0);
....@@ -2060,13 +2573,13 @@
20602573 refreshContents();
20612574 }
20622575 } else
2063
- if (event.getSource() == poseMeshItem)
2576
+ if (source == poseMeshItem)
20642577 {
20652578 if (group.selection.size() == 1)
20662579 {
2067
- if (GraphreeD.clipboard.size() == 1)
2580
+ if (Grafreed.clipboard.size() == 1)
20682581 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2582
+ Object3D content = Grafreed.clipboard.get(0);
20702583
20712584 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722585 content = ((cGroup)content).get(0);
....@@ -2079,19 +2592,19 @@
20792592 }
20802593
20812594 } else
2082
- if (event.getSource() == revertMeshItem)
2595
+ if (source == revertMeshItem)
20832596 {
20842597 RevertMeshes();
20852598 } else
2086
- if (event.getSource() == resetMeshItem)
2599
+ if (source == resetAllItem)
20872600 {
20882601 ResetAll();
20892602 } else
2090
- if (event.getSource() == stepAllItem)
2603
+ if (source == stepAllItem)
20912604 {
20922605 StepAll();
20932606 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2607
+ if (source == clearItem) // || event.getSource() == clearButton)
20952608 {
20962609 //int indices[] = jList.getSelectedIndices();
20972610 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2612,46 @@
20992612
21002613 ClearSelection(false);
21012614 } else
2102
- if (event.getSource() == clearAllItem)
2615
+ if (source == clearAllItem)
21032616 {
21042617 ClearSelection(true);
21052618 } else
2106
- if (event.getSource() == grabItem)
2619
+ if (source == grabItem || source == groupButton)
21072620 {
2108
- group(new cGroup(), true);
2621
+ group(new cGroup(), false); // true);
21092622 } else
2110
- if (event.getSource() == frontItem)
2623
+ if (source == hideItem)
2624
+ {
2625
+ group(new HiddenObject());
2626
+ } else
2627
+ if (source == frontItem)
21112628 {
21122629 front();
21132630 } else
2114
- if (event.getSource() == backItem)
2631
+ if (source == backItem)
21152632 {
21162633 back();
21172634 } else
2118
- if (event.getSource() == cameraItem)
2635
+ if (source == cameraItem)
21192636 {
21202637 makeSomething(new Camera());
21212638 } else
2122
- if (event.getSource() == compositeItem)
2639
+ if (source == compositeItem || source == compositeButton)
21232640 {
21242641 group(new Composite());
21252642 } else
2126
- if (event.getSource() == randomItem)
2643
+ if (source == switchItem || source == switchButton)
21272644 {
21282645 RandomNode random = new RandomNode();
21292646 group(random);
21302647 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
2648
+ random.name = random.get(0).name + "Switch";
21322649 } else
2133
- if (event.getSource() == physicsItem)
2650
+ if (source == physicsItem)
21342651 {
21352652 group(new PhysicsNode());
21362653 } else
2137
- if (event.getSource() == frameselectorItem)
2654
+ if (source == frameselectorItem)
21382655 {
21392656 for (int i=0; i<group.selection.size(); i++)
21402657 {
....@@ -2146,7 +2663,7 @@
21462663 ResetModel();
21472664 refreshContents();
21482665 } else
2149
- if (event.getSource() == switchGeoItem)
2666
+ if (source == switchGeoItem)
21502667 {
21512668 for (int i=0; i<group.selection.size(); i++)
21522669 {
....@@ -2158,7 +2675,7 @@
21582675 ResetModel();
21592676 refreshContents();
21602677 } else
2161
- if (event.getSource() == switchTransfoItem)
2678
+ if (source == switchTransfoItem)
21622679 {
21632680 for (int i=0; i<group.selection.size(); i++)
21642681 {
....@@ -2170,7 +2687,7 @@
21702687 ResetModel();
21712688 refreshContents();
21722689 } else
2173
- if (event.getSource() == morphItem)
2690
+ if (source == morphItem)
21742691 {
21752692 for (int i=0; i<group.selection.size(); i++)
21762693 {
....@@ -2182,7 +2699,7 @@
21822699 ResetModel();
21832700 refreshContents();
21842701 } else
2185
- if (event.getSource() == scriptNodeItem)
2702
+ if (source == scriptNodeItem)
21862703 {
21872704 boolean atleastone = false;
21882705
....@@ -2221,191 +2738,252 @@
22212738 }
22222739 }
22232740 } else
2224
- if (event.getSource() == linkerItem)
2741
+ if (source == linkerItem)
22252742 {
22262743 group(new cLinker());
22272744 } else
2228
- if (event.getSource() == textureItem)
2745
+ if (source == textureItem || source == textureButton)
22292746 {
22302747 group(new TextureNode());
22312748 } else
2232
- if (event.getSource() == shadowXItem)
2749
+ if (source == billboardItem)
2750
+ {
2751
+ group(new BillboardNode());
2752
+ } else
2753
+ if (source == shadowXItem)
22332754 {
22342755 CastShadow(0);
22352756 } else
2236
- if (event.getSource() == shadowYItem)
2757
+ if (source == shadowYItem)
22372758 {
22382759 CastShadow(1);
22392760 } else
2240
- if (event.getSource() == shadowZItem)
2761
+ if (source == shadowZItem)
22412762 {
22422763 CastShadow(2);
22432764 } else
2244
- if (event.getSource() == ungroupItem)
2765
+ if (source == ungroupItem || source == ungroupButton)
22452766 {
2246
- ungroup();
2767
+ boolean hasRoot = false;
2768
+
2769
+ for (int i=0; i<group.selection.size(); i++)
2770
+ {
2771
+ if (group.selection.get(i) == group)
2772
+ {
2773
+ hasRoot = true;
2774
+ break;
2775
+ }
2776
+ }
2777
+
2778
+ if (!hasRoot)
2779
+ {
2780
+ for (int i=0; i<group.selection.size(); i++)
2781
+ {
2782
+ Ungroup(group.selection.get(i));
2783
+ }
2784
+
2785
+ ClearSelection(false);
2786
+
2787
+ refreshContents();
2788
+ }
22472789 } else
2248
- if (event.getSource() == genUVItem)
2790
+ if (source == genUVItem)
22492791 {
22502792 GenUV();
22512793 } else
2252
- if (event.getSource() == genNormalsCADItem)
2794
+ if (source == genNormalsCADItem)
22532795 {
22542796 GenNormals(true);
22552797 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2798
+ if (source == genNormalsMESHItem)
2799
+ {
2800
+ GenNormalsMESH();
2801
+ } else
2802
+ if (source == genNormalsORGANItem)
22572803 {
22582804 GenNormals(false);
22592805 } else
2260
- if (event.getSource() == stripifyItem)
2806
+ if (source == genNormalsMINEItem)
2807
+ {
2808
+ GenNormalsMINE();
2809
+ } else
2810
+ if (source == stripifyItem)
22612811 {
22622812 Stripify();
22632813 } else
2264
- if (event.getSource() == unstripifyItem)
2814
+ if (source == unstripifyItem)
22652815 {
22662816 Unstripify();
22672817 } else
2268
- if (event.getSource() == trimItem)
2818
+ if (source == trimItem)
22692819 {
22702820 Trim();
22712821 } else
2272
- if (event.getSource() == untrimItem)
2822
+ if (source == untrimItem)
22732823 {
22742824 Untrim();
22752825 } else
2276
- if (event.getSource() == clearColorsItem)
2826
+ if (source == clearColorsItem)
22772827 {
22782828 ClearColors();
22792829 } else
2280
- if (event.getSource() == clearMaterialsItem)
2830
+ if (source == clearMaterialsItem)
22812831 {
22822832 ClearMaterials();
22832833 } else
2284
- if (event.getSource() == liveleavesItem)
2834
+ if (source == liveleavesItem)
22852835 {
22862836 LiveLeaves(true);
22872837 } else
2288
- if (event.getSource() == unliveleavesItem)
2838
+ if (source == unliveleavesItem)
22892839 {
22902840 LiveLeaves(false);
22912841 } else
2292
- if (event.getSource() == supportleavesItem)
2842
+ if (source == supportleavesItem)
22932843 {
22942844 SupportLeaves(true);
22952845 } else
2296
- if (event.getSource() == unsupportleavesItem)
2846
+ if (source == unsupportleavesItem)
22972847 {
22982848 SupportLeaves(false);
22992849 } else
2300
- if (event.getSource() == hideleavesItem)
2850
+ if (source == hideleavesItem)
23012851 {
23022852 HideLeaves(true);
23032853 } else
2304
- if (event.getSource() == showleavesItem)
2854
+ if (source == showleavesItem)
23052855 {
23062856 HideLeaves(false);
23072857 } else
2308
- if (event.getSource() == markleavesItem)
2858
+ if (source == markleavesItem)
23092859 {
23102860 MarkLeaves(true);
23112861 } else
2312
- if (event.getSource() == unmarkleavesItem)
2862
+ if (source == unmarkleavesItem)
23132863 {
23142864 MarkLeaves(false);
23152865 } else
2316
- if (event.getSource() == flipVItem)
2866
+ if (source == rewindleavesItem)
2867
+ {
2868
+ RewindLeaves(true);
2869
+ } else
2870
+ if (source == unrewindleavesItem)
2871
+ {
2872
+ RewindLeaves(false);
2873
+ } else
2874
+ if (source == randomleavesItem)
2875
+ {
2876
+ RandomLeaves(true);
2877
+ } else
2878
+ if (source == unrandomleavesItem)
2879
+ {
2880
+ RandomLeaves(false);
2881
+ } else
2882
+ if (source == flipVItem)
23172883 {
23182884 FlipV(true);
23192885 } else
2320
- if (event.getSource() == unflipVItem)
2886
+ if (source == unflipVItem)
23212887 {
23222888 FlipV(false);
23232889 } else
2324
- if (event.getSource() == lowTexturesItem)
2890
+ if (source == lowTexturesItem)
23252891 {
23262892 SetTexRes(0);
23272893 } else
2328
- if (event.getSource() == normalTexturesItem)
2894
+ if (source == normalTexturesItem)
23292895 {
23302896 SetTexRes(1);
23312897 } else
2332
- if (event.getSource() == highTexturesItem)
2898
+ if (source == highTexturesItem)
23332899 {
23342900 SetTexRes(2);
23352901 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2902
+ if (source == veryhighTexturesItem)
23372903 {
23382904 SetTexRes(3);
23392905 } else
2340
- if (event.getSource() == maxTexturesItem)
2906
+ if (source == maxTexturesItem)
23412907 {
23422908 SetTexRes(4);
23432909 } else
2344
- if (event.getSource() == panoTexturesItem)
2910
+ if (source == panoTexturesItem)
23452911 {
23462912 SetTexRes(5);
23472913 } else
2348
- if (event.getSource() == reverseNormalsItem)
2914
+ if (source == reverseNormalsItem)
23492915 {
23502916 ReverseNormals();
23512917 } else
2352
- if (event.getSource() == parseverticesItem)
2918
+ if (source == parseverticesItem)
23532919 {
23542920 ParseVertices();
23552921 } else
2356
- if (event.getSource() == alignItem)
2922
+ if (source == textureFieldItem)
2923
+ {
2924
+ TextureVertices();
2925
+ } else
2926
+ if (source == alignItem)
23572927 {
23582928 Align();
23592929 } else
2360
- if (event.getSource() == mirrorItem)
2930
+ if (source == mirrorItem)
23612931 {
23622932 MirrorPoses();
23632933 } else
2364
- if (event.getSource() == reduceMorphItem)
2934
+ if (source == reduceMorphItem)
23652935 {
23662936 MeshReduction(false);
23672937 } else
2368
- if (event.getSource() == reduce34MorphItem)
2938
+ if (source == reduce34MorphItem)
23692939 {
23702940 MeshReduction(true);
23712941 } else
2372
- if (event.getSource() == reverseTrianglesItem)
2942
+ if (source == reverseTrianglesItem)
23732943 {
23742944 ReverseTriangles();
23752945 } else
2376
- if (event.getSource() == reduceMeshItem)
2946
+ if (source == reduceMeshItem)
23772947 {
23782948 ReduceMesh(false);
23792949 } else
2380
- if (event.getSource() == reduce34MeshItem)
2950
+ if (source == reduce34MeshItem)
23812951 {
23822952 ReduceMesh(true);
23832953 } else
2384
- if (event.getSource() == increaseMeshItem)
2954
+ if (source == increaseMeshItem)
23852955 {
23862956 IncreaseMesh();
23872957 } else
2388
- if (event.getSource() == clipMeshItem)
2958
+ if (source == clipMeshItem)
23892959 {
23902960 ClipMesh();
23912961 } else
2392
- if (event.getSource() == smoothMeshItem)
2962
+ if (source == smoothMeshItem)
23932963 {
23942964 SmoothMesh();
23952965 } else
2396
- if (event.getSource() == transformgeometryItem)
2966
+ if (source == transformGeometryItem)
23972967 {
23982968 TransformGeometry();
23992969 } else
2400
- if (event.getSource() == resetTransformItem)
2970
+ if (source == transformChildrenItem)
2971
+ {
2972
+ TransformChildren();
2973
+ } else
2974
+ if (source == resetTransformItem)
24012975 {
24022976 ResetTransform();
24032977 } else
2404
- if (event.getSource() == resetCentroidItem)
2978
+ if (source == resetCentroidItem)
24052979 {
2406
- ResetCentroid();
2980
+ ResetCentroid(true);
24072981 } else
2408
- if (event.getSource() == resetParentItem)
2982
+ if (source == resetCentroidXZItem)
2983
+ {
2984
+ ResetCentroid(false);
2985
+ } else
2986
+ if (source == resetParentItem)
24092987 {
24102988 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24112989 {
....@@ -2415,7 +2993,7 @@
24152993
24162994 refreshContents();
24172995 } else
2418
- if (event.getSource() == repairParentItem)
2996
+ if (source == repairParentItem)
24192997 {
24202998 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24212999 {
....@@ -2429,7 +3007,21 @@
24293007
24303008 refreshContents();
24313009 } else
2432
- if (event.getSource() == sortbysizeItem)
3010
+ if (source == repairShadowItem)
3011
+ {
3012
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3013
+ {
3014
+ Object3D obj = (Object3D)e.nextElement();
3015
+ obj.RepairShadow();
3016
+// for (int i=0; i<obj.size(); i++)
3017
+// {
3018
+// obj.get(i).parent = obj;
3019
+// }
3020
+ }
3021
+
3022
+ refreshContents();
3023
+ } else
3024
+ if (source == sortbysizeItem)
24333025 {
24343026 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353027 {
....@@ -2441,7 +3033,7 @@
24413033 ResetModel();
24423034 refreshContents();
24433035 } else
2444
- if (event.getSource() == sortbynameItem)
3036
+ if (source == sortbynameItem)
24453037 {
24463038 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473039 {
....@@ -2453,7 +3045,7 @@
24533045 ResetModel();
24543046 refreshContents();
24553047 } else
2456
- if (event.getSource() == attachPigmentItem)
3048
+ if (source == attachPigmentItem)
24573049 {
24583050 String texture = GetFile("Attach pigment");
24593051 Object3D obj;
....@@ -2465,7 +3057,7 @@
24653057
24663058 refreshContents();
24673059 } else
2468
- if (event.getSource() == detachPigmentItem)
3060
+ if (source == detachPigmentItem)
24693061 {
24703062 Object3D obj;
24713063 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3068,7 @@
24763068
24773069 refreshContents();
24783070 } else
2479
- if (event.getSource() == attachBumpItem)
3071
+ if (source == attachBumpItem)
24803072 {
24813073 String texture = GetFile("Attach bump");
24823074 Object3D obj;
....@@ -2488,7 +3080,7 @@
24883080
24893081 refreshContents();
24903082 } else
2491
- if (event.getSource() == detachBumpItem)
3083
+ if (source == detachBumpItem)
24923084 {
24933085 Object3D obj;
24943086 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +3091,7 @@
24993091
25003092 refreshContents();
25013093 } else
2502
- if (event.getSource() == pigmentBumpItem)
3094
+ if (source == pigmentBumpItem)
25033095 {
25043096 Object3D obj;
25053097 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +3102,237 @@
25103102
25113103 refreshContents();
25123104 } else
2513
- if (event.getSource() == flashSelectionButton)
3105
+ if (source == flashSelectionButton)
25143106 {
25153107 CameraPane.flash = true;
25163108 refreshContents();
25173109 } else
2518
- if (event.getSource() == oneButton)
3110
+ if (source == oneButton)
25193111 {
25203112 } else
2521
- if (event.getSource() == twoButton)
3113
+ if (source == twoButton)
25223114 {
25233115 radio.layout = twoButton;
3116
+
3117
+ if (CameraPane.FULLSCREEN)
3118
+ fullscreenLayout = radio.layout;
3119
+
25243120 // bug
25253121 //gridPanel.setDividerLocation(1.0);
25263122 //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();
3123
+// bigThree.remove(scenePanel);
3124
+// bigThree.remove(centralPanel);
3125
+// bigThree.remove(XYZPanel);
3126
+// aWindowConstraints.gridx = 0;
3127
+// aWindowConstraints.gridy = 0;
3128
+// aWindowConstraints.gridwidth = 1;
3129
+// // aConstraints.gridheight = 3;
3130
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3131
+// aWindowConstraints.weightx = 0;
3132
+// aWindowConstraints.weighty = 1;
3133
+// //bigThree.add(jtp, aWindowConstraints);
3134
+// aWindowConstraints.weightx = 1;
3135
+// aWindowConstraints.gridwidth = 3;
3136
+// // aConstraints.gridheight = 3;
3137
+// aWindowConstraints.gridx = 1;
3138
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3139
+// bigThree.add(centralPanel, aWindowConstraints);
3140
+// aWindowConstraints.weightx = 0;
3141
+// aWindowConstraints.gridx = 4;
3142
+// aWindowConstraints.gridwidth = 1;
3143
+// // aConstraints.gridheight = 3;
3144
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3145
+// //bigThree.add(XYZPanel, aWindowConstraints);
3146
+// scenePanel.setVisible(false);
3147
+// centralPanel.setVisible(true);
3148
+// XYZPanel.setVisible(false);
3149
+ bigThree.ClearUI();
3150
+ bigThree.add(centralPanel);
3151
+ bigThree.FlushUI();
3152
+
3153
+ cameraView.requestFocusInWindow();
3154
+
3155
+// refreshContents(true);
3156
+//
3157
+// try
3158
+// {
3159
+// java.awt.Robot bot = new java.awt.Robot();
3160
+// int mask = InputEvent.BUTTON1_MASK;
3161
+// bot.mouseMove(100, 100);
3162
+// bot.mousePress(mask);
3163
+// bot.mouseRelease(mask);
3164
+// }
3165
+// catch (Exception e)
3166
+// {
3167
+//
3168
+// }
3169
+
25513170 } else
2552
- if (event.getSource() == threeButton)
3171
+ if (source == threeButton)
25533172 {
25543173 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();
3174
+
3175
+ if (CameraPane.FULLSCREEN)
3176
+ fullscreenLayout = radio.layout;
3177
+
3178
+// bigThree.remove(scenePanel);
3179
+// bigThree.remove(centralPanel);
3180
+// bigThree.remove(XYZPanel);
3181
+// aWindowConstraints.gridx = 0;
3182
+// aWindowConstraints.gridy = 0;
3183
+// aWindowConstraints.gridwidth = 1;
3184
+// // aConstraints.gridheight = 3;
3185
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3186
+// aWindowConstraints.weightx = 0;
3187
+// aWindowConstraints.weighty = 1;
3188
+// //bigThree.add(jtp, aWindowConstraints);
3189
+// aWindowConstraints.weightx = 1;
3190
+// aWindowConstraints.gridwidth = 3;
3191
+// // aConstraints.gridheight = 3;
3192
+// aWindowConstraints.gridx = 1;
3193
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3194
+// bigThree.add(centralPanel, aWindowConstraints);
3195
+// aWindowConstraints.weightx = 0;
3196
+// aWindowConstraints.gridx = 4;
3197
+// aWindowConstraints.gridwidth = 1;
3198
+// // aConstraints.gridheight = 3;
3199
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3200
+// bigThree.add(XYZPanel, aWindowConstraints);
3201
+// bigThree.validate();
3202
+// scenePanel.setVisible(false);
3203
+// centralPanel.setVisible(true);
3204
+// XYZPanel.setVisible(true);
3205
+ bigThree.ClearUI();
3206
+ bigThree.add(centralPanel);
3207
+ bigThree.add(XYZPanel);
3208
+ bigThree.FlushUI();
3209
+
3210
+ cameraView.requestFocusInWindow();
25793211 } else
2580
- if (event.getSource() == fourButton)
3212
+ if (source == fourButton)
25813213 {
25823214 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();
3215
+
3216
+ if (CameraPane.FULLSCREEN)
3217
+ fullscreenLayout = radio.layout;
3218
+
3219
+// bigThree.remove(scenePanel);
3220
+// bigThree.remove(centralPanel);
3221
+// bigThree.remove(XYZPanel);
3222
+// aWindowConstraints.gridx = 0;
3223
+// aWindowConstraints.gridy = 0;
3224
+// aWindowConstraints.gridwidth = 1;
3225
+// // aWindowConstraints.gridheight = 3;
3226
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3227
+// aWindowConstraints.weightx = 1;
3228
+// aWindowConstraints.weighty = 1;
3229
+// bigThree.add(scenePanel, aWindowConstraints);
3230
+// aWindowConstraints.weightx = 1;
3231
+// aWindowConstraints.gridwidth = 3;
3232
+// // aConstraints.gridheight = 3;
3233
+// aWindowConstraints.gridx = 1;
3234
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3235
+// //bigThree.add(cameraPanel, aWindowConstraints);
3236
+// aWindowConstraints.weightx = 0;
3237
+// aWindowConstraints.gridx = 4;
3238
+// aWindowConstraints.gridwidth = 1;
3239
+// // aWindowConstraints.gridheight = 3;
3240
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3241
+// //bigThree.add(XYZPanel, aWindowConstraints);
3242
+// bigThree.validate();
3243
+// scenePanel.setVisible(true);
3244
+// centralPanel.setVisible(false);
3245
+// XYZPanel.setVisible(false);
3246
+ bigThree.ClearUI();
3247
+ bigThree.add(scenePanel);
3248
+ bigThree.FlushUI();
3249
+
3250
+ cameraView.requestFocusInWindow();
26073251 } else
2608
- if (event.getSource() == sixButton)
3252
+ if (source == sixButton)
26093253 {
26103254 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();
3255
+
3256
+ if (CameraPane.FULLSCREEN)
3257
+ fullscreenLayout = radio.layout;
3258
+
3259
+// bigThree.remove(scenePanel);
3260
+// bigThree.remove(centralPanel);
3261
+// bigThree.remove(XYZPanel);
3262
+// aWindowConstraints.gridx = 0;
3263
+// aWindowConstraints.gridy = 0;
3264
+// aWindowConstraints.gridwidth = 1;
3265
+// // aConstraints.gridheight = 3;
3266
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3267
+// aWindowConstraints.weightx = 0;
3268
+// aWindowConstraints.weighty = 1;
3269
+// bigThree.add(scenePanel, aWindowConstraints);
3270
+// aWindowConstraints.weightx = 1;
3271
+// aWindowConstraints.gridwidth = 3;
3272
+// // aWindowConstraints.gridheight = 3;
3273
+// aWindowConstraints.gridx = 1;
3274
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3275
+// bigThree.add(centralPanel, aWindowConstraints);
3276
+// aWindowConstraints.weightx = 0;
3277
+// aWindowConstraints.gridx = 4;
3278
+// aWindowConstraints.gridwidth = 1;
3279
+// // aWindowConstraints.gridheight = 3;
3280
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3281
+// //bigThree.add(XYZPanel, aConstraints);
3282
+// bigThree.validate();
3283
+// scenePanel.setVisible(true);
3284
+// centralPanel.setVisible(true);
3285
+// XYZPanel.setVisible(false);
3286
+ bigThree.ClearUI();
3287
+ bigThree.add(scenePanel);
3288
+ bigThree.add(centralPanel);
3289
+ bigThree.FlushUI();
3290
+
3291
+ cameraView.requestFocusInWindow();
26353292 } else
2636
- if (event.getSource() == sevenButton)
3293
+ if (source == sevenButton)
26373294 {
26383295 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();
3296
+
3297
+ if (CameraPane.FULLSCREEN)
3298
+ fullscreenLayout = radio.layout;
3299
+
3300
+// bigThree.remove(scenePanel);
3301
+// bigThree.remove(centralPanel);
3302
+// bigThree.remove(XYZPanel);
3303
+// aWindowConstraints.gridx = 0;
3304
+// aWindowConstraints.gridy = 0;
3305
+// aWindowConstraints.gridwidth = 1;
3306
+// // aWindowConstraints.gridheight = 3;
3307
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3308
+// aWindowConstraints.weightx = 0;
3309
+// aWindowConstraints.weighty = 1;
3310
+// bigThree.add(scenePanel, aWindowConstraints);
3311
+// aWindowConstraints.weightx = 1;
3312
+// aWindowConstraints.gridwidth = 3;
3313
+// // aWindowConstraints.gridheight = 3;
3314
+// aWindowConstraints.gridx = 1;
3315
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3316
+// bigThree.add(centralPanel, aWindowConstraints);
3317
+// aWindowConstraints.weightx = 0;
3318
+// aWindowConstraints.gridx = 4;
3319
+// aWindowConstraints.gridwidth = 1;
3320
+// // aConstraints.gridheight = 3;
3321
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3322
+// bigThree.add(XYZPanel, aWindowConstraints);
3323
+// bigThree.validate();
3324
+// scenePanel.setVisible(true);
3325
+// centralPanel.setVisible(true);
3326
+// XYZPanel.setVisible(true);
3327
+ bigThree.ClearUI();
3328
+ bigThree.add(scenePanel);
3329
+ bigThree.add(centralPanel);
3330
+ bigThree.add(XYZPanel);
3331
+ bigThree.FlushUI();
3332
+
3333
+ cameraView.requestFocusInWindow();
26633334 } else
2664
- if (event.getSource() == rootButton)
3335
+ if (source == rootButton)
26653336 {
26663337 Object3D obj;
26673338 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2671,66 +3342,84 @@
26713342 EditObject(obj);
26723343 }
26733344
3345
+ cameraView.requestFocusInWindow();
26743346 refreshContents(true);
26753347 } else
2676
- if (event.getSource() == closeButton)
3348
+ if (source == closeButton)
26773349 {
26783350 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793351 cRadio ab;
26803352 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813353 {
26823354 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3355
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843356 {
3357
+ // Patch to avoid bug with transparency.
3358
+ if (!ab.hadMaterial)
3359
+ {
3360
+ ab.object.material = null;
3361
+ }
3362
+
26853363 buttonGroup.remove(ab);
26863364 radioPanel.remove(ab);
26873365
2688
- ab.GetObject().editWindow = null;
3366
+ //ab.GetObject().editWindow = null;
3367
+ ab.GetObject().manipWindow = null;
26893368 // ab.GetObject().objectUI = null; // ?????????
26903369
26913370 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923371 break;
26933372 }
26943373 }
3374
+
3375
+ cameraView.requestFocusInWindow();
26953376 refreshContents(true);
26963377 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3378
+ if (source == editItem || source == editButton)
26983379 {
3380
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3381
+ {
3382
+ Object3D child = (Object3D)e.nextElement();
3383
+ child.pinned = true;
3384
+ }
3385
+
26993386 EditSelection(false);
27003387 } else
2701
- if (event.getSource() == uneditButton)
3388
+ if (source == uneditButton)
27023389 {
27033390 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043391 {
27053392 Object3D child = (Object3D)e.nextElement();
27063393 if(child.editWindow != null)
27073394 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3395
+ child.pinned = false;
27083396 child.CloseUI();
27093397 listUI.remove(child);
27103398
2711
- child.editWindow = null; // ???????????
3399
+ //child.editWindow = null; // ???????????
27123400 }
2713
- objEditor.ctrlPanel.revalidate();
3401
+ objEditor.ctrlPanel.FlushUI();
27143402 //objEditor.jTree.clearSelection();
27153403 //objEditor.ResetSliders();
27163404 refreshContents(true);
27173405 } else
2718
- if (event.getSource() == clearPanelButton)
3406
+ if (source == clearPanelButton)
27193407 {
27203408 assert(copy == group);
27213409 //copy.ClearUI();
27223410 for (Object3D obj : listUI)
27233411 {
3412
+ obj.pinned = false;
27243413 obj.CloseUI();
27253414 }
27263415 listUI.clear();
27273416 refreshContents(true);
27283417 } else
2729
- if (event.getSource() == allParamsButton)
3418
+ if (source == allParamsButton)
27303419 {
27313420 assert(copy == group);
27323421
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3422
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27343423
27353424 for (Object3D obj : listUI)
27363425 {
....@@ -2747,19 +3436,19 @@
27473436
27483437 refreshContents(true);
27493438 } else
2750
- if (event.getSource() == unselectButton)
3439
+ if (source == unselectButton)
27513440 {
27523441 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3442
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543443 objEditor.ResetSliders();
27553444 refreshContents(true);
27563445 } else
2757
- if(event.getSource() instanceof cRadio)
3446
+ if(source instanceof cRadio)
27583447 {
27593448 group.parent = keepparent;
27603449 group.attributes = 0;
27613450 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3451
+ /*cRadio*/ radio = (cRadio)source;
27633452 Object3D obj = radio.GetObject();
27643453 System.out.println("Edit " + obj);
27653454 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +3468,7 @@
27793468 }
27803469
27813470 copy = group;
2782
- //CameraPane.theRenderer.object = group;
3471
+ //Globals.theRenderer.object = group;
27833472 if(!useclient)
27843473 {
27853474 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +3477,50 @@
27883477 cameraView.cameras[cameraView.cameracount] = radio.camera;
27893478 cameraView.targetLookAt.set(radio.camera.lookAt);
27903479 cameraView.object = group;
2791
- cameraView.lighttouched = true;
3480
+ //cameraView.lighttouched = true;
3481
+ Globals.lighttouched = true;
27923482 topView.object = group;
27933483 frontView.object = group;
27943484 sideView.object = group;
27953485 }
2796
- group.editWindow = this;
3486
+
3487
+// fix "+" issue
3488
+ //group.editWindow = this;
3489
+ group.manipWindow = this;
3490
+
27973491 /*
27983492 currentLayout = radio.layout;
27993493 if (currentLayout == null)
28003494 currentLayout = sevenButton;
28013495 */
28023496 radio.layout.doClick();
3497
+
3498
+ ClearUnpinned();
3499
+ SetPinStates(group.selection.size() > 0);
3500
+ if (group.selection.size() == 1)
3501
+ EditSelection(false);
28033502 keepparent = group.parent;
28043503 // PARENT = NULL or not???
28053504 //group.parent = null; // ROOT
28063505 //group.attributes = -1;
28073506 ResetModel();
3507
+
3508
+ cameraView.requestFocusInWindow();
28083509 refreshContents(true);
2809
- }
3510
+ } else if (event.getSource() == editCameraItem)
3511
+ {
3512
+ cameraView.ProtectCamera();
3513
+ cameraView.repaint();
3514
+ return;
3515
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3516
+ {
3517
+ cameraView.RevertCamera();
3518
+ cameraView.repaint();
3519
+ return;
3520
+ // } else if (event.getSource() == textureButton)
3521
+ // {
3522
+ // return; // true;
3523
+ }
28103524 else
28113525 {
28123526 //return super.action(event, arg);
....@@ -2815,7 +3529,6 @@
28153529 }
28163530
28173531 boolean useclient = false;
2818
- cRadio radio;
28193532
28203533 void ToggleRoot()
28213534 {
....@@ -2824,7 +3537,7 @@
28243537 if (useclient)
28253538 {
28263539 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3540
+ Globals.lighttouched = true;
28283541 //topView.object = client;
28293542 //frontView.object = client;
28303543 //sideView.object = client;
....@@ -2832,7 +3545,7 @@
28323545 else
28333546 {
28343547 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3548
+ Globals.lighttouched = true;
28363549 //topView.object = group;
28373550 //frontView.object = group;
28383551 //sideView.object = group;
....@@ -2867,6 +3580,28 @@
28673580 refreshContents();
28683581 }
28693582
3583
+ void TransformChildren()
3584
+ {
3585
+ Object3D obj;
3586
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3587
+ {
3588
+ obj = (Object3D)e.nextElement();
3589
+ obj.KeepTextureMatrices();
3590
+ obj.TransformChildren();
3591
+ obj.RestoreTextureMatrices();
3592
+
3593
+// if (obj.parent == null)
3594
+// {
3595
+// System.out.println("NULL PARENT!");
3596
+// new Exception().printStackTrace();
3597
+// }
3598
+// else
3599
+// TouchTransform(obj);
3600
+// //obj.parent.Touch();
3601
+ }
3602
+
3603
+ refreshContents();
3604
+ }
28703605
28713606 void ResetTransform()
28723607 {
....@@ -2979,7 +3714,7 @@
29793714 refreshContents();
29803715 }
29813716
2982
- void ResetCentroid()
3717
+ void ResetCentroid(boolean full)
29833718 {
29843719 Object3D obj;
29853720 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +3729,16 @@
29943729 LA.matIdentity(Object3D.mat);
29953730 obj.getBounds(minima, maxima, false);
29963731 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3732
+ if (full)
3733
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29983734 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29993735 obj.TransformMesh(Object3D.mat);
3736
+
30003737 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3738
+ if (full)
3739
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30023740 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3741
+
30033742 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30043743 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30053744 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +3767,8 @@
30283767
30293768 int size = obj.MemorySize();
30303769
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
3770
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3771
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30323772 }
30333773 }
30343774 catch (Exception e)
....@@ -3065,9 +3805,9 @@
30653805 obj = (Object3D)e.nextElement();
30663806
30673807 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3808
+ Grafreed.AnalyzeObject(obj);
30693809 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3810
+ Grafreed.AnalyzeObject(obj.bRep);
30713811
30723812 // System.err.println((size/1024) + " KB is the size of " + obj);
30733813 }
....@@ -3109,6 +3849,20 @@
31093849 void GenNormals(boolean crease)
31103850 {
31113851 group.GenNormalsS(crease);
3852
+
3853
+ refreshContents();
3854
+ }
3855
+
3856
+ void GenNormalsMESH()
3857
+ {
3858
+ group.GenNormalsMeshS();
3859
+
3860
+ refreshContents();
3861
+ }
3862
+
3863
+ void GenNormalsMINE()
3864
+ {
3865
+ group.selection.GenNormalsMINE();
31123866
31133867 refreshContents();
31143868 }
....@@ -3157,104 +3911,259 @@
31573911
31583912 //Object3D buffer;
31593913 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
-
3914
+// BoundaryRep temprep;
3915
+// Object3D nodes;
3916
+// Vector<Vertex> vertices;
3917
+//
3918
+// cGroup buffer;
3919
+//
3920
+// public void Vertex(Object3D node, Vertex v)
3921
+// {
3922
+//// vertices.add(v);
3923
+//// nodes.addElement(node);
3924
+////
3925
+//// if (temprep.GetCache(v) != null)
3926
+//// {
3927
+//// temprep.Remove(v);
3928
+//// } else
3929
+//// {
3930
+//// temprep.Remember(v);
3931
+//// }
3932
+//
3933
+// //Object3D node = nodes.get(index);
3934
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
3935
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3936
+//
3937
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3938
+//
3939
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3940
+//
3941
+// cGroup g = new cGroup();
3942
+//
3943
+// if (g.toParent == null)
3944
+// {
3945
+// g.toParent = LA.newMatrix();
3946
+// g.fromParent = LA.newMatrix();
3947
+// }
3948
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3949
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3950
+//
3951
+// g.add(GrafreeD.clipboard);
3952
+//
3953
+// buffer.add(g);
3954
+// }
3955
+//
3956
+// public void Face(Object3D node, Face f)
3957
+// {
3958
+//
3959
+// }
3960
+//
3961
+// void ParseVerticesOld() // ??
3962
+// {
3963
+// //if (group.selection.size() != 1)
3964
+// // return;
3965
+//
3966
+// temprep = new BoundaryRep();
3967
+// nodes = new Object3D();
3968
+// vertices = new Vector<Vertex>();
3969
+//
3970
+// boolean epsequal = GrafreeD.epsequal;
3971
+// GrafreeD.epsequal = true;
3972
+//
3973
+// for (int i=0; i<group.selection.size(); i++)
3974
+// {
3975
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3976
+//
3977
+// group.selection.get(i).Parse(
3978
+//this );
3979
+//
3980
+// int repsize = temprep.VertexCount();
3981
+// int tablesize = temprep.vertextable.size();
3982
+// int nodesize = nodes.size();
3983
+//
3984
+// assert(vertices.size() == nodes.size());
3985
+//
3986
+// temprep.vertextable.elements();
3987
+//
3988
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
3989
+//
3990
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3991
+// {
3992
+// cGroup g = new cGroup();
3993
+//
3994
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3995
+//
3996
+// Object3D node = nodes.get(index);
3997
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
3998
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3999
+//
4000
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4001
+//
4002
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4003
+//
4004
+// if (g.toParent == null)
4005
+// {
4006
+// g.toParent = LA.newMatrix();
4007
+// g.fromParent = LA.newMatrix();
4008
+// }
4009
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4010
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4011
+//
4012
+// g.add(GrafreeD.clipboard);
4013
+//
4014
+// buffer.add(g);
4015
+// }
4016
+//
4017
+// makeSomething(buffer, i==group.selection.size()-1);
4018
+// }
4019
+//
4020
+// GrafreeD.epsequal = epsequal;
4021
+//
4022
+// //buffer = null;
4023
+// temprep = null;
4024
+// nodes = null;
4025
+//
4026
+// refreshContents();
4027
+// }
4028
+
31844029 void ParseVertices()
31854030 {
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;
4031
+ boolean epsequal = Grafreed.epsequal;
4032
+ Grafreed.epsequal = true;
31954033
31964034 for (int i=0; i<group.selection.size(); i++)
31974035 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4036
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994037
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4038
+ group.selection.get(i).Parse(
4039
+
4040
+ new iParse()
4041
+ {
4042
+ public void Vertex(Object3D node, Vertex v)
4043
+ {
4044
+ temp.set(v);
4045
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054046
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();
4047
+ cGroup g = new cGroup();
32114048
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4049
+ if (g.toParent == null)
4050
+ {
4051
+ g.toParent = LA.newMatrix();
4052
+ g.fromParent = LA.newMatrix();
4053
+ }
4054
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4055
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154056
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);
4057
+ g.add(Grafreed.clipboard);
32204058
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);
4059
+ buffer.add(g);
4060
+ }
32324061
3233
- g.add(GraphreeD.clipboard);
4062
+ public void Face(Object3D node, Face f)
4063
+ {
32344064
3235
- buffer.add(g);
3236
- }
4065
+ }
4066
+ }
4067
+ );
32374068
32384069 makeSomething(buffer, i==group.selection.size()-1);
32394070 }
32404071
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4072
+ Grafreed.epsequal = epsequal;
32464073
32474074 refreshContents();
32484075 }
3249
-
4076
+
4077
+ void TextureVertices()
4078
+ {
4079
+ for (int i=0; i<group.selection.size(); i++)
4080
+ {
4081
+ group.selection.get(i).Parse(
4082
+ new iParse()
4083
+ {
4084
+ public void Vertex(Object3D node, Vertex v)
4085
+ {
4086
+ cTexture tex = node.GetTextures();
4087
+ String pigment = Object3D.GetPigment(tex);
4088
+ //String bump = Object3D.GetBump(tex);
4089
+
4090
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4091
+
4092
+ try
4093
+ {
4094
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4095
+ }
4096
+ catch (Exception e)
4097
+ {
4098
+ System.err.println("FAIL: " + node);
4099
+ }
4100
+
4101
+ double s = v.s;
4102
+
4103
+ if (s == 1)
4104
+ s = 0;
4105
+
4106
+ double t = v.t;
4107
+
4108
+ if (t == 1)
4109
+ t = 0;
4110
+
4111
+ int indexs = (int) (texturedata.getWidth() * s);
4112
+ int indext = (int) (texturedata.getHeight() * t);
4113
+
4114
+ int index = indext * texturedata.getWidth() + indexs;
4115
+
4116
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4117
+
4118
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4119
+
4120
+ float scale = bytebuf.get(index*slide) & 0xFF;
4121
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4122
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4123
+ scale /= 3;
4124
+
4125
+ scale /= 0xFF;
4126
+ // c'est quoi ca? scale /= 4;
4127
+
4128
+ //v.AO = scale;
4129
+
4130
+ v.x += v.norm.x * scale;
4131
+ v.y += v.norm.y * scale;
4132
+ v.z += v.norm.z * scale;
4133
+ }
4134
+
4135
+ public void Face(Object3D node, Face f)
4136
+ {
4137
+ }
4138
+ }
4139
+ );
4140
+ }
4141
+
4142
+ refreshContents();
4143
+ }
4144
+
32504145 void Align()
32514146 {
4147
+ if (group.selection.size() == 0)
4148
+ return;
4149
+
4150
+ cVector bbmin = new cVector();
4151
+ cVector bbmax = new cVector();
4152
+
4153
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4154
+
4155
+ double dx = bbmax.x - bbmin.x;
4156
+ double dy = bbmax.y - bbmin.y;
4157
+ double dz = bbmax.z - bbmin.z;
4158
+
4159
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4160
+
32524161 for (int i=0; i<group.selection.size(); i++)
32534162 {
32544163 Object3D obj = group.selection.get(i);
32554164
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4165
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4166
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584167 }
32594168
32604169 refreshContents();
....@@ -3267,7 +4176,7 @@
32674176 // ref.SaveSupports();
32684177 // Object3D par = ref.parent;
32694178 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4179
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714180 // ref.parent = par;
32724181 // ref.RestoreSupports();
32734182
....@@ -3275,11 +4184,11 @@
32754184
32764185 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774186
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4187
+ boolean random = CameraPane.SWITCH;
4188
+ CameraPane.SWITCH = false; // parse all random nodes
32804189 lowres.linkVerticesThis(null);
32814190 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4191
+ CameraPane.SWITCH = random;
32834192
32844193 System.err.flush();
32854194
....@@ -3297,7 +4206,7 @@
32974206 // lowres.SaveSupports();
32984207 // par = lowres.parent;
32994208 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4209
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014210 Object3D newlow = CloneObject(lowres, false);
33024211 newlow.name = sn.switchobject.get(i).name;
33034212 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4228,7 @@
33194228 return;
33204229
33214230 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4231
+ Object3D ref = Grafreed.clipboard.get(0);
33234232
33244233 Object3D newgroup = new Object3D("Po:" + poses.name);
33254234
....@@ -3488,7 +4397,7 @@
34884397 group.selection.RelinkToSupport(); // july 2014
34894398 System.out.println("DONE.");
34904399 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4400
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34924401 }
34934402
34944403 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +4422,20 @@
35134422
35144423 void ClipMesh()
35154424 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4425
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35174426 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
4427
+ Object3D content = Grafreed.clipboard.get(0);
35194428
35204429 if (content instanceof cGroup && ((cGroup)content).transientlink )
35214430 content = ((cGroup)content).get(0);
35224431
35234432 // for (int i=0; i<group.selection.size(); i++)
35244433 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4434
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264435 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4436
+ group.selection.ClipMesh(Grafreed.clipboard);
35284437 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4438
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304439 System.out.println("DONE.");
35314440 refreshContents();
35324441 }
....@@ -3571,6 +4480,18 @@
35714480 void MarkLeaves(boolean hide)
35724481 {
35734482 group.selection.MarkLeaves(hide);
4483
+ refreshContents();
4484
+ }
4485
+
4486
+ void RewindLeaves(boolean hide)
4487
+ {
4488
+ group.selection.RewindLeaves(hide);
4489
+ refreshContents();
4490
+ }
4491
+
4492
+ void RandomLeaves(boolean hide)
4493
+ {
4494
+ group.selection.RandomLeaves(hide);
35744495 refreshContents();
35754496 }
35764497
....@@ -3645,10 +4566,6 @@
36454566 // }
36464567 // }
36474568
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36524569 void EditSelection(boolean newWindow)
36534570 {
36544571 // aConstraints.gridy = 0;
....@@ -3656,10 +4573,10 @@
36564573 {
36574574 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36584575 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4576
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36604577
36614578 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
4579
+ if(elem != group || !newWindow)
36634580 {
36644581 // if (!(elem instanceof Composite))
36654582 // newWindow = false;
....@@ -3741,7 +4658,8 @@
37414658 //new Exception().printStackTrace();
37424659
37434660 freezemodel = true;
3744
-
4661
+ ClearUnpinned();
4662
+
37454663 /**/
37464664 //switch (event.id)
37474665 {
....@@ -3749,7 +4667,6 @@
37494667 //case 702: // Event.LIST_DESELECT
37504668 group.deselectAll();
37514669 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37534670 if (tps != null)
37544671 {
37554672 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +4675,39 @@
37584675
37594676 //if (child.parent != null)
37604677 //child.parent.addSelectee(child);
4678
+ objEditor.SetMaterial(child);
37614679 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37654680 }
37664681 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
4682
+// else
4683
+// {
4684
+// objEditor.SetMaterial(group); // .GetMaterial());
4685
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4686
+// System.err.println("info : " + group.GetPath());
4687
+// }
37734688
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4689
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37774690 CameraPane.flash = true;
37784691
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4692
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37804693 // a camera
37814694 {
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;
4695
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4696
+ {
4697
+ CameraPane.camerachangeframe = 0; // don't refuse it
4698
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4699
+ }
4700
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4701
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864702 }
37874703
4704
+ if (tps != null && tps.length == 1)
4705
+ {
4706
+ EditSelection(false);
4707
+ }
4708
+
4709
+ SetPinStates(tps != null && tps.length > 0);
4710
+
37884711 refreshContents();
37894712 //return true;
37904713 }
....@@ -3793,6 +4716,35 @@
37934716
37944717 freezemodel = false;
37954718 }
4719
+
4720
+ void SetPinStates(boolean enabled)
4721
+ {
4722
+ editButton.setEnabled(enabled);
4723
+ uneditButton.setEnabled(enabled);
4724
+ unselectButton.setEnabled(enabled);
4725
+ flashSelectionButton.setEnabled(enabled);
4726
+ }
4727
+
4728
+ void refreshContents(boolean cp)
4729
+ {
4730
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4731
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4732
+ {
4733
+ objEditor.ClearInfo(); // .GetMaterial());
4734
+
4735
+ for (int i=0; i < group.selection.Size(); i++)
4736
+ {
4737
+ Object3D child = (Object3D) group.selection.get(i);
4738
+
4739
+ objEditor.AddInfo(child, this, true);
4740
+ System.err.println("info : " + child.GetPath());
4741
+ }
4742
+
4743
+ objEditor.SetText(); // jan 2014
4744
+ }
4745
+
4746
+ super.refreshContents(cp);
4747
+ }
37964748
37974749 void linkSomething(Object3D thing)
37984750 {
....@@ -3864,16 +4816,19 @@
38644816 {
38654817 if (group.selection.isEmpty())
38664818 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4819
+
4820
+ Grafreed.clipboardIsTempGroup = false;
38684821 Composite tGroup = null;
38694822 if (group.selection.size() > 0) // 1)
38704823 {
38714824 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4825
+ Grafreed.clipboardIsTempGroup = true;
38734826 }
38744827
38754828 if (cut)
38764829 {
4830
+ if (Globals.SAVEONMAKE)
4831
+ Save();
38774832 //int indices[] = jList.getSelectedIndices();
38784833 //for (int i = indices.length - 1; i >= 0; i--)
38794834 //jList.remove(indices[i]);
....@@ -3909,16 +4864,16 @@
39094864 //System.out.println("cut " + child);
39104865 //System.out.println("parent = " + child.parent);
39114866 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4867
+ if (Grafreed.clipboardIsTempGroup)
39134868 tGroup.add/*Child*/(tmp);
39144869 else
3915
- GraphreeD.clipboard = tmp;
4870
+ Grafreed.clipboard = tmp;
39164871 }
39174872 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4873
+ if (Grafreed.clipboardIsTempGroup)
39194874 tGroup.add/*Child*/(child);
39204875 else
3921
- GraphreeD.clipboard = child;
4876
+ Grafreed.clipboard = child;
39224877 }
39234878
39244879 //ResetModel();
....@@ -3950,21 +4905,23 @@
39504905 //System.out.println("cut " + elem);
39514906 //System.out.println("parent = " + elem.parent);
39524907 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4908
+ if (Grafreed.clipboardIsTempGroup)
39544909 tGroup.add/*Child*/(tmp);
39554910 else
3956
- GraphreeD.clipboard = tmp;
4911
+ Grafreed.clipboard = tmp;
39574912 }
39584913 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4914
+ if (Grafreed.clipboardIsTempGroup)
39604915 tGroup.add/*Child*/(child);
39614916 else
3962
- GraphreeD.clipboard = child;
4917
+ Grafreed.clipboard = child;
39634918 }
39644919
39654920 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4921
+
4922
+ if (Grafreed.clipboardIsTempGroup)
4923
+ Grafreed.clipboard = tGroup;
4924
+
39684925 if (cut)
39694926 {
39704927 ResetModel();
....@@ -3974,11 +4931,11 @@
39744931
39754932 void paste(boolean expand)
39764933 {
3977
- // if (GraphreeD.clipboard == null)
4934
+ // if (GrafreeD.clipboard == null)
39784935 // return;
39794936 boolean first = true;
39804937
3981
- if (GraphreeD.clipboardIsTempGroup)
4938
+ if (Grafreed.clipboardIsTempGroup)
39824939 {
39834940 Composite temp;
39844941
....@@ -3989,7 +4946,7 @@
39894946 temp = (Composite)Applet3D.clipboard.deepCopy();
39904947 */
39914948 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4949
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39934950 {
39944951 Object3D child = (Object3D)e.nextElement();
39954952
....@@ -4003,7 +4960,7 @@
40034960 else
40044961 elem = child.deepCopy(); // ?
40054962 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4963
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40074964 // elem = elem.get(0);
40084965 makeSomething(elem, true); // ?? first);
40094966 //group.addChild(elem);
....@@ -4023,23 +4980,23 @@
40234980 //Object3D cb = Applet3D.clipboard;
40244981 //temp.addChild(cb);
40254982 //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());
4983
+ assert(Grafreed.clipboard.parent == null);
4984
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4985
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4986
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4987
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40314988 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
4989
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4990
+ Grafreed.clipboard.get(0).parent = keepparent;
40344991 }
40354992
40364993 ResetModel();
40374994 refreshContents();
40384995 }
40394996
4040
- void pasteInto(boolean copyit)
4997
+ void pasteInto(boolean copyit, boolean clone)
40414998 {
4042
-// if (GraphreeD.clipboard == null)
4999
+// if (GrafreeD.clipboard == null)
40435000 // return;
40445001
40455002 if (group.selection.size() != 1)
....@@ -4066,15 +5023,22 @@
40665023 if (copyit)
40675024 {
40685025 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5026
+ if (clone)
5027
+ {
5028
+ CloneClipboard(false); // sept 2014
5029
+ }
5030
+ else
5031
+ {
5032
+ paste(false);
5033
+ }
40705034 }
40715035 else
40725036 {
40735037 boolean first = true;
40745038
4075
- if (GraphreeD.clipboardIsTempGroup)
5039
+ if (Grafreed.clipboardIsTempGroup)
40765040 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5041
+ Composite temp = (Composite)Grafreed.clipboard;
40785042 Object3D copy;
40795043 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805044 {
....@@ -4084,7 +5048,7 @@
40845048 }
40855049 } else
40865050 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5051
+ linkSomething(Grafreed.clipboard); //.get(0));
40885052 }
40895053 }
40905054 }
....@@ -4276,6 +5240,26 @@
42765240 makeSomething(csg);
42775241 }
42785242
5243
+ void Ungroup(Object3D g)
5244
+ {
5245
+ if (g instanceof HiddenObject)
5246
+ {
5247
+ HiddenObject h = (HiddenObject) g;
5248
+
5249
+ for (int i=0; i<h.ActualSize(); i++)
5250
+ {
5251
+ objEditor.makeSomething(h.get(i), false);
5252
+ }
5253
+ }
5254
+ else
5255
+ {
5256
+ for (int i=0; i<g.Size(); i++)
5257
+ {
5258
+ objEditor.makeSomething(g.get(i), false);
5259
+ }
5260
+ }
5261
+ }
5262
+
42795263 void ungroup()
42805264 {
42815265 /*
....@@ -4469,21 +5453,6 @@
44695453 }
44705454 */
44715455
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
-
44875456 /*
44885457 public void Callback(Object obj)
44895458 {
....@@ -4507,26 +5476,9 @@
45075476 }
45085477 */
45095478
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
-
45275479 String GetFile(String dialogName)
45285480 {
4529
- if (GraphreeD.standAlone)
5481
+ if (Grafreed.standAlone)
45305482 {
45315483 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45325484 browser.show();
....@@ -4590,10 +5542,33 @@
45905542 cButton flashSelectionButton;
45915543 cButton editButton;
45925544 cButton uneditButton;
5545
+ JCheckBox allParamsButton;
45935546 cButton clearpanelButton;
4594
- cButton allParamsButton;
45955547 cButton unselectButton;
45965548
5549
+ cButton restoreCameraButton;
5550
+
5551
+ cButton saveButton;
5552
+ cButton oneStepButton;
5553
+
5554
+ cButton groupButton;
5555
+ cButton ungroupButton;
5556
+ cButton compositeButton;
5557
+ cButton switchButton;
5558
+ cButton loopButton;
5559
+ cButton textureButton;
5560
+
5561
+ cButton gridButton;
5562
+ cButton boxButton;
5563
+ cButton sphereButton;
5564
+ cButton coneButton;
5565
+ cButton torusButton;
5566
+ cButton superButton;
5567
+ cButton kleinButton;
5568
+ cButton particlesButton;
5569
+ cButton overlayButton;
5570
+ cButton lightButton;
5571
+
45975572 cButton screenfitButton;
45985573 cButton screenfitpointButton;
45995574 cButton snapobjectButton;
....@@ -4605,14 +5580,6 @@
46055580
46065581 cButton setsupportButton;
46075582
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
-
46165583 //
46175584 //Composite
46185585 Object3D // to do !!
....@@ -4622,9 +5589,11 @@
46225589 //JTree jTree;
46235590 private MenuItem lookAtItem;
46245591 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
5592
+ private MenuItem switchViewItem;
46265593 private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
5594
+ private MenuItem undoItem;
5595
+ private MenuItem redoItem;
5596
+ private JMenuItem duplicateItem;
46285597 private MenuItem cloneItem;
46295598 private MenuItem cloneSupportItem;
46305599 private MenuItem overwriteGeoItem;
....@@ -4635,8 +5604,9 @@
46355604 private MenuItem resetsupportItem;
46365605 private MenuItem resetreferencesItem;
46375606 private MenuItem linkverticesItem;
5607
+ private MenuItem relinkverticesItem;
46385608 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
5609
+ private MenuItem resetAllItem;
46405610 private MenuItem stepAllItem;
46415611 private MenuItem revertMeshItem;
46425612 private MenuItem poseMeshItem;
....@@ -4647,14 +5617,17 @@
46475617 private MenuItem mergeGeometriesItem;
46485618 private MenuItem copyItem;
46495619 private MenuItem pasteItem;
5620
+ private MenuItem pasteIntoItem;
46505621 private MenuItem pasteLinkItem;
46515622 private MenuItem pasteCloneItem;
46525623 private MenuItem pasteExpandItem;
46535624 private MenuItem clearItem;
46545625 private MenuItem clearAllItem;
46555626 private MenuItem genUVItem;
5627
+ private MenuItem genNormalsMESHItem;
46565628 private MenuItem genNormalsCADItem;
46575629 private MenuItem genNormalsORGANItem;
5630
+ private MenuItem genNormalsMINEItem;
46585631 private MenuItem stripifyItem;
46595632 private MenuItem unstripifyItem;
46605633 private MenuItem trimItem;
....@@ -4683,6 +5656,10 @@
46835656 private MenuItem showleavesItem;
46845657 private MenuItem markleavesItem;
46855658 private MenuItem unmarkleavesItem;
5659
+ private MenuItem rewindleavesItem;
5660
+ private MenuItem unrewindleavesItem;
5661
+ private MenuItem randomleavesItem;
5662
+ private MenuItem unrandomleavesItem;
46865663
46875664 private MenuItem flipVItem;
46885665 private MenuItem unflipVItem;
....@@ -4694,14 +5671,17 @@
46945671 private MenuItem panoTexturesItem;
46955672
46965673 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
5674
+ private MenuItem resetCentroidXZItem;
46985675 private MenuItem resetTransformItem;
5676
+ private MenuItem transformGeometryItem;
5677
+ private MenuItem transformChildrenItem;
5678
+ private MenuItem hideItem;
46995679 private MenuItem grabItem;
47005680 private MenuItem backItem;
47015681 private MenuItem frontItem;
47025682 private MenuItem cameraItem;
47035683 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
5684
+ private MenuItem switchItem;
47055685 private MenuItem physicsItem;
47065686 private MenuItem frameselectorItem;
47075687 private MenuItem scriptNodeItem;
....@@ -4716,6 +5696,7 @@
47165696
47175697 private MenuItem resetParentItem;
47185698 private MenuItem repairParentItem;
5699
+ private MenuItem repairShadowItem;
47195700 private MenuItem sortbysizeItem;
47205701 private MenuItem sortbynameItem;
47215702
....@@ -4728,16 +5709,19 @@
47285709 private MenuItem particleItem;
47295710 private MenuItem ragdollItem;
47305711 private MenuItem ragdoll2Item;
5712
+ private MenuItem heightFieldItem;
5713
+ private MenuItem textureFieldItem;
47315714 private MenuItem gridItem;
47325715 private MenuItem rectoidItem;
47335716 private MenuItem ellipsoidItem;
47345717 private MenuItem coneItem;
47355718 private MenuItem torusItem;
47365719 private MenuItem superItem;
5720
+ private MenuItem kleinItem;
47375721 private MenuItem blobItem;
47385722 private MenuItem latheItem;
47395723 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
5724
+ private MenuItem overlayItem;
47415725 private MenuItem meshItem;
47425726 // private MenuItem meshGroupItem;
47435727 private MenuItem springItem;
....@@ -4746,6 +5730,7 @@
47465730 private MenuItem csgItem;
47475731 private MenuItem templateItem;
47485732 private MenuItem textureItem;
5733
+ private MenuItem billboardItem;
47495734 private MenuItem shadowXItem;
47505735 private MenuItem shadowYItem;
47515736 private MenuItem shadowZItem;
....@@ -4758,11 +5743,6 @@
47585743 private MenuItem doubleItem;
47595744 private MenuItem tripleItem;
47605745
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47665746 private MenuItem computeAOItem;
47675747 private MenuItem recompileItem;
47685748 private MenuItem editScriptItem;
....@@ -4772,4 +5752,8 @@
47725752 private MenuItem analyzeItem;
47735753 private MenuItem dumpItem;
47745754 //boolean freezemodel = false;
5755
+
5756
+ Menu cameraMenu;
5757
+ MenuItem editCameraItem;
5758
+ MenuItem restoreCameraItem;
47755759 }