Normand Briere
2019-06-30 cfd7a643cb5a445016ddb15595158ecc59b184fd
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,217 @@
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
+ if (Globals.ADVANCED)
594
+ {
595
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ maxButton.setToolTipText("Maximize window");
597
+ maxButton.addActionListener(this);
598
+ }
599
+
600
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
601
+ fullButton.setToolTipText("Full-screen window");
602
+ fullButton.addActionListener(this);
603
+
604
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
605
+ restoreCameraButton.setToolTipText("Restore viewpoint");
606
+ restoreCameraButton.addActionListener(this);
607
+
608
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ undoButton.setToolTipText("Undo changes");
610
+ undoButton.addActionListener(this);
611
+ undoButton.setEnabled(false);
612
+
613
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
614
+ redoButton.setToolTipText("Redo changes");
615
+ redoButton.addActionListener(this);
616
+ redoButton.setEnabled(false);
617
+
618
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ saveButton.setToolTipText("Save changes");
620
+ saveButton.addActionListener(this);
621
+
622
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
623
+ liveCB.setToolTipText("Enable animation");
414624 liveCB.addItemListener(this);
415625
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);
626
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
627
+ oneStepButton.setToolTipText("Animate one step forward");
628
+ oneStepButton.addActionListener(this);
629
+
630
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
631
+ fastCB.setToolTipText("Fast mode");
434632 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);
633
+
634
+ //oe.toolboxPanel.Return();
635
+
636
+ copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637
+ screenfitButton.setToolTipText("Screen fit");
480638 screenfitButton.addActionListener(this);
481
- oe.aConstraints.gridx += 1;
639
+
640
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
641
+// trackCB.setToolTipText("Enable tracking");
642
+// trackCB.addItemListener(this);
643
+
482644 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
483645 // 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;
488646
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;
647
+ if (Globals.ADVANCED)
648
+ {
649
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
+ snapobjectButton.addActionListener(this);
651
+ snapobjectButton.setToolTipText("Snap Object");
652
+ }
653
+
654
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
499655
500
- //
501
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
656
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
+ twoButton.setToolTipText("Show center view only");
502658 twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
659
+ this.fullscreenLayout = twoButton;
660
+
661
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504662 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
663
+ fourButton.setToolTipText("Show left panel only");
664
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
+ sixButton.setToolTipText("2-column layout left");
506666 sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
667
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
+ threeButton.setToolTipText("2-column layout right");
508669 threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
670
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
+ sevenButton.setToolTipText("3-column layout");
510672 sevenButton.addActionListener(this);
511673 //
512674
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
675
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
+ rootButton.setToolTipText("Edit selection in new tab");
514677 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
678
+
679
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
680
+ closeButton.setToolTipText("Close tab");
517681 closeButton.addActionListener(this);
518682 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
519683 //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;
528684
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
685
+ // INSERT
686
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
687
+ gridButton.setToolTipText("Create grid");
688
+ gridButton.addActionListener(this);
689
+
690
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
691
+ boxButton.setToolTipText("Create box");
692
+ boxButton.addActionListener(this);
693
+
694
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ sphereButton.setToolTipText("Create sphere");
696
+ sphereButton.addActionListener(this);
697
+
698
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
699
+ coneButton.setToolTipText("Create cone");
700
+ coneButton.addActionListener(this);
701
+
702
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+ torusButton.setToolTipText("Create torus");
704
+ torusButton.addActionListener(this);
705
+
706
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707
+ superButton.setToolTipText("Create superellipsoid");
708
+ superButton.addActionListener(this);
709
+
710
+ if (Globals.ADVANCED)
711
+ {
712
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ kleinButton.setToolTipText("Create Klein bottle");
714
+ kleinButton.addActionListener(this);
715
+ }
716
+
717
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
718
+ particlesButton.setToolTipText("Create particle system");
719
+ particlesButton.addActionListener(this);
720
+
721
+ oe.toolboxPanel.Return();
722
+
723
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ groupButton.setToolTipText("Create group");
725
+ groupButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
728
+ compositeButton.setToolTipText("Create composite");
729
+ compositeButton.addActionListener(this);
730
+
731
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
732
+ switchButton.setToolTipText("Create item switcher");
733
+ switchButton.addActionListener(this);
734
+
735
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+ loopButton.setToolTipText("Create loop");
737
+ loopButton.addActionListener(this);
738
+
739
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
740
+ textureButton.setToolTipText("Create texture");
741
+ textureButton.addActionListener(this);
742
+
743
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ overlayButton.setToolTipText("Create overlay");
745
+ overlayButton.addActionListener(this);
746
+
747
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ lightButton.setToolTipText("Create light");
749
+ lightButton.addActionListener(this);
750
+
751
+ for (int i=6; --i>=0;)
752
+ {
753
+ oe.toolboxPanel.Return();
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
+ oe.toolboxPanel.add(new cGridBag());
759
+ oe.toolboxPanel.add(new cGridBag());
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ }
762
+
763
+ // EDIT panel
764
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ editButton.setToolTipText("Pin selection controls");
766
+ editButton.addActionListener(this);
767
+
768
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ uneditButton.setToolTipText("Remove selection controls");
530770 uneditButton.addActionListener(this);
531771
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);
772
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
773
+ allParamsButton.setToolTipText("Show all controle");
544774 allParamsButton.addActionListener(this);
545775
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);
776
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ clearPanelButton.setToolTipText("Clear edit panel");
778
+ clearPanelButton.addActionListener(this);
779
+
780
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
+ unselectButton.setToolTipText("Unselect");
551782 unselectButton.addActionListener(this);
552783
784
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ flashSelectionButton.setToolTipText("Highlight selection");
786
+ flashSelectionButton.addActionListener(this);
787
+
788
+ editCommandsPanel.preferredHeight = 1;
789
+
790
+ SetPinStates(false);
791
+// oe.treePanel.add(commandsPanel);
792
+// oe.treePanel.Return();
793
+
553794 // oe.aConstraints.gridx += 1;
554795 // oe.aConstraints.weighty = 0;
555796 // oe.aConstraints.gridwidth = 1;
....@@ -561,40 +802,22 @@
561802 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
562803 // gcButton.addActionListener(this);
563804
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;
805
+ cGridBag jSPPanel = new cGridBag();
806
+
807
+ JScrollPane jSP;
575808 //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);
809
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
577810 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;
597811
812
+ oe.treePanel.add(jSPPanel);
813
+ oe.treePanel.Return();
814
+
815
+ oe.treePanel.add(copyOptionsPanel);
816
+ oe.treePanel.Return();
817
+
818
+// mainPanel.setDividerLocation(0.5); //1.0);
819
+// mainPanel.setResizeWeight(0.5);
820
+
598821 //jList.addListSelectionListener(this);
599822 oe.jTree.addTreeSelectionListener(this);
600823 //jTree.setRootVisible(false);
....@@ -616,20 +839,157 @@
616839 radio.layout = sevenButton;
617840 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
618841 }
842
+
843
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
844
+ {
845
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
846
+ colorCB.setToolTipText("Copy color when dropped");
847
+ colorCB.addItemListener(this);
848
+
849
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
850
+ materialCB.setToolTipText("Copy material when dropped");
851
+ materialCB.addItemListener(this);
852
+
853
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
854
+ textureCB.setToolTipText("Copy texture when dropped");
855
+ textureCB.addItemListener(this);
856
+
857
+ panel.Return();
858
+
859
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
860
+ boxCB.setToolTipText("Display bounding boxes");
861
+ boxCB.addItemListener(this);
862
+
863
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
864
+ zoomBoxCB.setToolTipText("Display only for wheel");
865
+ zoomBoxCB.addItemListener(this);
866
+
867
+ if (true) // Globals.ADVANCED)
868
+ {
869
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
870
+// supportCB.setToolTipText("Enable rigging");
871
+// supportCB.addItemListener(this);
872
+
873
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
874
+ freezeCB.setToolTipText("Fast moving camera");
875
+ freezeCB.addItemListener(this);
876
+
877
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
878
+ // localCB.addItemListener(this);
879
+
880
+ panel.Return();
881
+
882
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
883
+ crowdCB.setToolTipText("Used for crowds");
884
+ crowdCB.addItemListener(this);
885
+
886
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
887
+ smoothCB.setToolTipText("Snapping delay");
888
+ smoothCB.addItemListener(this);
889
+
890
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
891
+ slowCB.setToolTipText("Smooth interpolation");
892
+ slowCB.addItemListener(this);
893
+
894
+// constraints.gridy += 1;
895
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
896
+// speakerMocapCB.addItemListener(this);
897
+
898
+ panel.Return();
899
+
900
+ if (false)
901
+ {
902
+ // handled in scripts
903
+ //constraints.gridy += 1;
904
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
905
+ speakerCameraCB.addItemListener(this);
906
+
907
+ //constraints.gridy += 1;
908
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
909
+ speakerFocusCB.addItemListener(this);
910
+
911
+ //constraints.gridy += 1;
912
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
913
+ smoothfocusCB.addItemListener(this);
914
+ panel.Return();
915
+ }
916
+
917
+//constraints.gridx += 1;
918
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
919
+// debugCB.addItemListener(this);
920
+
921
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
922
+ trackCB.setToolTipText("Enable tracking target");
923
+ trackCB.addItemListener(this);
924
+
925
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
926
+ oeilCB.setToolTipText("Move camera when tracking");
927
+ oeilCB.addItemListener(this);
928
+
929
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
930
+ shadowCB.setToolTipText("When live compute shadows");
931
+ shadowCB.addItemListener(this);
932
+
933
+ panel.Return();
934
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
935
+ toggleTextureCB.setToolTipText("Load textures");
936
+ toggleTextureCB.addItemListener(this);
937
+
938
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
939
+ toggleSwitchCB.setToolTipText("Choose a single item");
940
+ toggleSwitchCB.addItemListener(this);
941
+
942
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
943
+ autosaveCB.setToolTipText("On structure change");
944
+ autosaveCB.addItemListener(this);
945
+
946
+ panel.Return();
947
+ if (Globals.ADVANCED)
948
+ {
949
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
950
+ lookAtCB.setToolTipText("Look-at target");
951
+ lookAtCB.addItemListener(this);
952
+ }
953
+
954
+ }
955
+
956
+ cGridBag fill = new cGridBag();
957
+ fill.preferredHeight = 200;
958
+ cGridBag fill2 = new cGridBag();
959
+ fill2.preferredHeight = 200;
960
+ cGridBag fill3 = new cGridBag();
961
+ fill3.preferredHeight = 200;
962
+
963
+ panel.add(fill);
964
+ panel.add(fill2);
965
+ panel.add(fill3);
966
+
967
+ }
619968
620969 void EditObject(Object3D obj)
621970 {
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();
971
+ cRadio radioButton = new cRadio(obj.name);
972
+
973
+ // Patch to avoid bug with transparency.
974
+ radioButton.hadMaterial = obj.material != null;
975
+ if (!radioButton.hadMaterial)
976
+ {
977
+ obj.material = new cMaterial();
978
+ }
979
+
980
+ radioButton.SetObject(obj);
981
+ radioButton.layout = sevenButton;
982
+ radioButton.SetCamera(cameraView.renderCamera, false);
983
+ radioButton.addActionListener(this);
984
+ radioPanel.add(radioButton);
985
+ buttonGroup.add(radioButton);
986
+ radioButton.doClick();
630987 }
988
+
631989 void SetupViews(ObjEditor oe)
632990 {
991
+ theFrame = this;
992
+
633993 oe.SetupViews();
634994
635995 System.out.println("SetupViews");
....@@ -638,22 +998,28 @@
638998 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
639999 }
6401000
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;
1001
+ cToggleButton liveCB;
1002
+ cCheckBox supportCB;
1003
+ cCheckBox localCB;
1004
+ cCheckBox crowdCB;
1005
+ cCheckBox smoothCB;
1006
+ cToggleButton fastCB;
1007
+ cCheckBox slowCB;
1008
+ cCheckBox boxCB;
1009
+ cCheckBox zoomBoxCB;
1010
+ cCheckBox freezeCB;
1011
+ //cToggleButton trackCB;
1012
+ cCheckBox trackCB;
1013
+ cCheckBox smoothfocusCB;
6511014 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
1015
+ cCheckBox speakerCameraCB;
1016
+ cCheckBox speakerFocusCB;
1017
+ cCheckBox debugCB;
1018
+
1019
+ cCheckBox oeilCB;
1020
+ cCheckBox shadowCB;
1021
+ cCheckBox autosaveCB;
1022
+ cCheckBox lookAtCB;
6571023
6581024 // static int COLOR = 1;
6591025 // static int MATERIAL = 2;
....@@ -661,9 +1027,9 @@
6611027
6621028 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6631029
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
1030
+ cCheckBox colorCB;
1031
+ cCheckBox materialCB;
1032
+ cCheckBox textureCB;
6671033
6681034 public void itemStateChanged(ItemEvent e)
6691035 {
....@@ -688,10 +1054,10 @@
6881054 dropAttributes |= Object3D.TEXTURE;
6891055 else
6901056 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
1057
+ } else if(e.getSource() == liveCB)
6931058 {
6941059 cameraView.ToggleLive();
1060
+ refreshContents(false);
6951061 }
6961062 else if(e.getSource() == supportCB)
6971063 {
....@@ -727,6 +1093,10 @@
7271093 cameraView.repaint();
7281094 // refreshContents();
7291095 }
1096
+ else if(e.getSource() == zoomBoxCB)
1097
+ {
1098
+ cameraView.ToggleZoomBoxMode();
1099
+ }
7301100 else if(e.getSource() == smoothfocusCB)
7311101 {
7321102 cameraView.ToggleSmoothFocus();
....@@ -752,6 +1122,18 @@
7521122 {
7531123 cameraView.ToggleOeil();
7541124 }
1125
+ else if(e.getSource() == shadowCB)
1126
+ {
1127
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1128
+ }
1129
+ else if(e.getSource() == freezeCB)
1130
+ {
1131
+ Globals.FREEZEONMOVE ^= true;
1132
+ }
1133
+ else if(e.getSource() == autosaveCB)
1134
+ {
1135
+ Globals.SAVEONMAKE ^= true;
1136
+ }
7551137 else if(e.getSource() == lookAtCB)
7561138 {
7571139 cameraView.ToggleLookAt();
....@@ -768,7 +1150,8 @@
7681150
7691151 /**/
7701152 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
771
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1153
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1154
+ TreePath path = objEditor.jTree.getSelectionPath();
7721155 if ((path == null) || (path.getPathCount() <= 1)) {
7731156 // We can't move the root node or an empty selection
7741157 return;
....@@ -840,7 +1223,9 @@
8401223 // objEditor.DropFile((java.io.File[]) object, true);
8411224 // return;
8421225 // }
843
- if (string.charAt(0) == '/')
1226
+
1227
+ // File path for Mac and Windows
1228
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441229 {
8451230 // file(s)
8461231 String[] names = string.split("\n");
....@@ -867,7 +1252,7 @@
8671252
8681253 flashIt = false;
8691254 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1255
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711256 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721257
8731258 if (group.selection.size() == 1)
....@@ -883,23 +1268,33 @@
8831268
8841269 assert target == objEditor.jTree;
8851270 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1271
+ Object3D destinationLeaf;
8861272 try {
887
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1273
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
8881274 } catch (Exception e) {
8891275 System.out.println("destinationPath : " + destinationPath);
8901276 return;
8911277 }
8921278
893
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1279
+ for (int i=group.selection.size(); --i>=0;)
8941280 {
1281
+ Object3D child = (Object3D)group.selection.elementAt(i);
1282
+
1283
+ // Cannot move into itself
1284
+ if (child == destinationLeaf)
1285
+ return;
1286
+ }
1287
+
1288
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1289
+// {
8951290 loadClipboard(true);
8961291 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
898
- } else {
899
- loadClipboard(false);
900
- objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
902
- }
1292
+ pasteInto(false, false);
1293
+// } else {
1294
+// loadClipboard(false);
1295
+// objEditor.jTree.setSelectionPath(destinationPath);
1296
+// pasteInto(false, false); // true); // ???
1297
+// }
9031298 }
9041299 public void dropActionChanged(DropTargetDragEvent dtde)
9051300 // Called if the user has modified the current drop gesture
....@@ -1002,90 +1397,106 @@
10021397
10031398 void buildCreateMenu(Menu menu)
10041399 {
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);
1400
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1401
+ //heightFieldItem.addActionListener(this);
1402
+// gridItem = menu.add(new MenuItem("Grid"));
1403
+// gridItem.addActionListener(this);
1404
+// rectoidItem = menu.add(new MenuItem("Box"));
1405
+// rectoidItem.addActionListener(this);
1406
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1407
+// ellipsoidItem.addActionListener(this);
1408
+// coneItem = menu.add(new MenuItem("Cone"));
1409
+// coneItem.addActionListener(this);
1410
+// torusItem = menu.add(new MenuItem("Torus"));
1411
+// torusItem.addActionListener(this);
1412
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1413
+// superItem.addActionListener(this);
1414
+
1415
+ cameraItem = menu.add(new MenuItem("Camera"));
1416
+ cameraItem.addActionListener(this);
1417
+
1418
+ if (!Globals.ADVANCED)
1419
+ {
1420
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1421
+ kleinItem.addActionListener(this);
1422
+ }
1423
+
1424
+// particleItem = menu.add(new MenuItem("Particle system"));
1425
+// particleItem.addActionListener(this);
1426
+ if (Globals.ADVANCED)
1427
+ {
10191428 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201429 ragdollItem.addActionListener(this);
10211430 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221431 ragdoll2Item.addActionListener(this);
1432
+ }
10231433 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1434
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251435 meshItem.addActionListener(this);
10261436 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271437 // meshGroupItem.addActionListener(this);
1438
+ if (Globals.ADVANCED)
1439
+ {
10281440 springItem = menu.add(new MenuItem("Spring"));
10291441 springItem.addActionListener(this);
10301442 flagItem = menu.add(new MenuItem("Flag"));
10311443 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);
10361444 blobItem = menu.add(new MenuItem("Blob"));
10371445 blobItem.addActionListener(this);
10381446 latheItem = menu.add(new MenuItem("Lathe"));
10391447 latheItem.addActionListener(this);
1040
- lightItem = menu.add(new MenuItem("Light"));
1041
- lightItem.addActionListener(this);
1448
+ }
1449
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1450
+ bezierItem.addActionListener(this);
1451
+// overlayItem = menu.add(new MenuItem("Overlay"));
1452
+// overlayItem.addActionListener(this);
1453
+// lightItem = menu.add(new MenuItem("Light"));
1454
+// lightItem.addActionListener(this);
10421455 menu.add("-");
10431456 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10441457 //superLoopItem.addActionListener(this);
1045
- loopItem = menu.add(new MenuItem("Loop"));
1046
- loopItem.addActionListener(this);
1458
+// loopItem = menu.add(new MenuItem("Loop"));
1459
+// loopItem.addActionListener(this);
10471460 doubleItem = menu.add(new MenuItem("Fork"));
10481461 doubleItem.addActionListener(this);
1462
+ if (Globals.ADVANCED)
1463
+ {
10491464 tripleItem = menu.add(new MenuItem("Trident"));
10501465 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);
1466
+ }
10601467 }
10611468
10621469 void buildToolsMenu(Menu menu)
10631470 {
10641471 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651472 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1473
+ animationItem.setState(Globals.ANIMATION);
10671474
10681475 menu.add("-");
10691476 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701477 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1478
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1479
+ textureFieldItem.addActionListener(this);
1480
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721481 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751482 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761483 reduceMorphItem.addActionListener(this);
10771484 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781485 reduce34MorphItem.addActionListener(this);
1079
-
1486
+ menu.add("-");
10801487 menu.add(computeAOItem = new MenuItem("Compute AO"));
10811488 computeAOItem.addActionListener(this);
1082
- menu.add("-");
10831489
1490
+ if (Globals.ADVANCED)
1491
+ {
1492
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1493
+ mirrorItem.addActionListener(this);
1494
+ menu.add("-");
10841495 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851496 memoryItem.addActionListener(this);
10861497 menu.add(analyzeItem = new MenuItem("Analyze"));
10871498 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
1499
+ menu.add(dumpItem = new MenuItem("Print"));
10891500 dumpItem.addActionListener(this);
10901501 // menu.add(pathItem = new MenuItem("From-to path"));
10911502 // pathItem.addActionListener(this);
....@@ -1094,6 +1505,8 @@
10941505 resetParentItem.addActionListener(this);
10951506 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961507 repairParentItem.addActionListener(this);
1508
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1509
+ repairShadowItem.addActionListener(this);
10971510 menu.add(invariantsItem = new MenuItem("Invariants"));
10981511 invariantsItem.addActionListener(this);
10991512 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1514,7 @@
11011514 menu.add("-");
11021515 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031516 editScriptItem.addActionListener(this);
1517
+ }
11041518 }
11051519
11061520 void ScreenFit()
....@@ -1223,9 +1637,24 @@
12231637 shadow.material = new cMaterial(obj.material);
12241638 shadow.material.diffuse = 0.0001f;
12251639 shadow.material.specular = 0.0001f;
1640
+ //shadow.projectedVertices[1].x = 300;
12261641
12271642 makeSomething(shadow);
12281643 }
1644
+
1645
+ private void ClearUnpinned()
1646
+ {
1647
+ //for (Object3D obj : listUI)
1648
+ for (int i=listUI.size(); --i>=0;)
1649
+ {
1650
+ Object3D obj = listUI.elementAt(i);
1651
+ if (!obj.pinned)
1652
+ {
1653
+ obj.CloseUI();
1654
+ listUI.remove(i);
1655
+ }
1656
+ }
1657
+ }
12291658
12301659 /**
12311660 * applyExample
....@@ -1429,9 +1858,9 @@
14291858
14301859 void Overwrite(int mask)
14311860 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1861
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14331862 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1863
+ Object3D content = Grafreed.clipboard.get(0);
14351864
14361865 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371866 content = ((cGroup)content).get(0);
....@@ -1454,6 +1883,7 @@
14541883 //
14551884 public void actionPerformed(ActionEvent event) // , Object arg)
14561885 {
1886
+ Object source = event.getSource();
14571887 /*
14581888 if (event.getSource() == nameField)
14591889 {
....@@ -1465,11 +1895,11 @@
14651895 }
14661896 else
14671897 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1898
+ if (source == lookAtItem || source == lookFromItem)
14691899 {
14701900 ScreenFit();
14711901 } else
1472
- if (event.getSource() == switchItem)
1902
+ if (source == switchViewItem)
14731903 {
14741904 cVector v1 = new cVector();
14751905 cVector v2 = new cVector();
....@@ -1478,11 +1908,11 @@
14781908 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791909 objEditor.cameraView.repaint();
14801910 } else
1481
- if (event.getSource() == rectoidItem)
1911
+ if (source == rectoidItem || source == boxButton)
14821912 {
14831913 makeSomething(new Box());
14841914 } else
1485
- if (event.getSource() == particleItem)
1915
+ if (source == particleItem || source == particlesButton)
14861916 {
14871917 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881918 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1933,9 @@
15031933 applyExample(particleGeom, "SMOKE");
15041934 makeSomething(particleGeom);
15051935 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1936
+ if (source == ragdollItem || source == ragdoll2Item)
15071937 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1938
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091939
15101940 ragdoll.toParent = LA.newMatrix();
15111941 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +1951,71 @@
15211951 makeSomething(ragdoll);
15221952 //makeSomething(new VehicleDemo());
15231953 } else
1524
- if (event.getSource() == gridItem)
1954
+ /*
1955
+ */
1956
+ if (source == heightFieldItem)
1957
+ {
1958
+ Object3D obj = new Object3D();
1959
+
1960
+ obj.CreateMaterial();
1961
+ obj.bRep = new BoundaryRep();
1962
+
1963
+ obj.bRep.CreateMesh(new iHeightField()
1964
+ {
1965
+ public double f(double x, double y)
1966
+ {
1967
+ // The Mandelbrot set is represented by coloring
1968
+ // each point (x,y) according to the number of
1969
+ // iterations it takes before the while loop in
1970
+ // this method ends. For points that are actually
1971
+ // in the Mandelbrot set, or very close to it, the
1972
+ // count will reach the maximum value, 80. These
1973
+ // points will be colored purple. All other colors
1974
+ // represent points that are definitely NOT in the set.
1975
+ x -= 600;
1976
+ y -= 500;
1977
+ x /= 200;
1978
+ y /= 200;
1979
+ int count = 0;
1980
+ double zx = x;
1981
+ double zy = y;
1982
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
1983
+ double new_zx = zx*zx - zy*zy + x;
1984
+ zy = 2*zx*zy + y;
1985
+ zx = new_zx;
1986
+ count++;
1987
+ }
1988
+ return count; // Math.sqrt(count);
1989
+ }
1990
+ }, 1000,1000);
1991
+
1992
+ makeSomething(obj);
1993
+ } else
1994
+ if (source == gridItem || source == gridButton)
15251995 {
15261996 makeSomething(new Grid());
15271997 } else
1528
- if (event.getSource() == ellipsoidItem)
1998
+ if (source == ellipsoidItem || source == sphereButton)
15291999 {
15302000 makeSomething(new Sphere());
15312001 } else
1532
- if (event.getSource() == coneItem)
2002
+ if (source == coneItem || source == coneButton)
15332003 {
15342004 makeSomething(new Cone());
15352005 } else
1536
- if (event.getSource() == torusItem)
2006
+ if (source == torusItem || source == torusButton)
15372007 {
15382008 makeSomething(new Torus());
15392009 } else
1540
- if (event.getSource() == superItem)
2010
+ if (source == superItem || source == superButton)
15412011 {
15422012 makeSomething(new Superellipsoid());
15432013 } else
1544
- if (event.getSource() == blobItem)
2014
+ if (source == kleinItem || source == kleinButton)
2015
+ {
2016
+ makeSomething(new Klein());
2017
+ } else
2018
+ if (source == blobItem)
15452019 {
15462020 Blob blob = new Blob();
15472021 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2023,15 @@
15492023 //blob.retile();
15502024 makeSomething(blob);
15512025 } else
1552
- if (event.getSource() == latheItem)
2026
+ if (source == latheItem)
15532027 {
15542028 makeSomething(new Lathe());
15552029 } else
1556
- if (event.getSource() == bezierItem)
2030
+ if (source == bezierItem)
15572031 {
15582032 makeSomething(new BezierSurface());
15592033 } else
1560
- if (event.getSource() == checkerItem)
2034
+ if (source == overlayItem || source == overlayButton)
15612035 {
15622036 /*
15632037 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2044,9 @@
15702044 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712045 LA.matInvert(obj.toParent, obj.fromParent);
15722046 */
1573
- makeSomething(new CheckerIG());
2047
+ makeSomething(new Checker());
15742048 } else
1575
- if (event.getSource() == meshItem)
2049
+ if (source == meshItem)
15762050 {
15772051 Object3D itemtomake = new Object3D();
15782052 Object3D child;
....@@ -1593,35 +2067,35 @@
15932067 makeSomething(child);
15942068 }
15952069 } else
1596
- if (event.getSource() == springItem)
2070
+ if (source == springItem)
15972071 {
15982072 cSpring s = new cSpring();
15992073 s.setup();
16002074 makeSomething(s);
16012075 } else
1602
- if (event.getSource() == flagItem)
2076
+ if (source == flagItem)
16032077 {
16042078 cSpring s = new cFlag();
16052079 s.setup();
16062080 makeSomething(s);
16072081 } else
1608
- if (event.getSource() == lightItem)
2082
+ if (source == lightItem || source == lightButton)
16092083 {
16102084 makeSomething(new Light());
16112085 } else
1612
- if (event.getSource() == csgItem)
2086
+ if (source == csgItem)
16132087 {
16142088 group(new CSG());
16152089 } else
1616
- if (event.getSource() == templateItem)
2090
+ if (source == templateItem)
16172091 {
16182092 group(new cTemplate());
16192093 } else
1620
- if (event.getSource() == attributeItem)
2094
+ if (source == attributeItem)
16212095 {
16222096 makeSomething(new Attribute());
16232097 } else
1624
- if (event.getSource() == pointflowItem)
2098
+ if (source == pointflowItem)
16252099 {
16262100 makeSomething(new PointFlow());
16272101 } else
....@@ -1633,7 +2107,7 @@
16332107 } else
16342108 */
16352109
1636
- if (event.getSource() == superLoopItem)
2110
+ if (source == superLoopItem)
16372111 {
16382112 Composite g = new cGroup();
16392113 for (int i=0; i<15; i++)
....@@ -1655,30 +2129,30 @@
16552129
16562130 group(g);
16572131 } else
1658
- if (event.getSource() == loopItem)
2132
+ if (source == loopItem || source == loopButton)
16592133 {
16602134 Composite csg = new GroupLeaf();
16612135 csg.count = 5;
16622136 group(csg);
1663
- Composite child = new cGroup();
2137
+ Composite child = new cGroup("Branch");
16642138 csg.addChild(child);
16652139 child.addChild(csg);
16662140 } else
1667
- if (event.getSource() == doubleItem)
2141
+ if (source == doubleItem)
16682142 {
1669
- Composite csg = new GroupLeaf();
2143
+ Composite csg = new GroupLeaf("Fork");
16702144 csg.count = 5;
16712145 group(csg);
1672
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch A");
16732147 csg.addChild(child);
16742148 child.addChild(csg);
1675
- child = new cGroup();
2149
+ child = new cGroup("Branch B");
16762150 csg.addChild(child);
16772151 child.addChild(csg);
16782152 } else
1679
- if (event.getSource() == tripleItem)
2153
+ if (source == tripleItem)
16802154 {
1681
- Composite csg = new GroupLeaf();
2155
+ Composite csg = new GroupLeaf("Trident");
16822156 csg.count = 4;
16832157 group(csg);
16842158 Composite child = new cGroup();
....@@ -1691,71 +2165,83 @@
16912165 csg.addChild(child);
16922166 child.addChild(csg);
16932167 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2168
+ if (source == computeAOItem)
16962169 {
1697
- ImportGFD();
2170
+ Globals.drawMode = CameraPane.OCCLUSION;
2171
+ Globals.theRenderer.repaint();
16982172 } 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)
2173
+ if (source == recompileItem)
17172174 {
17182175 Recompile();
17192176 refreshContents();
17202177 } else
1721
- if (event.getSource() == editScriptItem)
2178
+ if (source == editScriptItem)
17222179 {
17232180 OpenDialog();
17242181 refreshContents();
17252182 } else
1726
- if (event.getSource() == invariantsItem)
2183
+ if (source == invariantsItem)
17272184 {
17282185 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2186
+ Grafreed.grafreeD.universe.invariants();
17302187 } else
1731
- if (event.getSource() == memoryItem)
2188
+ if (source == memoryItem)
17322189 {
17332190 //System.out.println("Invariants:");
17342191 PrintMemory();
17352192 } else
1736
- if (event.getSource() == pathItem)
2193
+ if (source == pathItem)
17372194 {
17382195 PrintPath();
17392196 } else
1740
- if (event.getSource() == analyzeItem)
2197
+ if (source == analyzeItem)
17412198 {
17422199 AnalyzeObject();
17432200 } else
1744
- if (event.getSource() == dumpItem)
2201
+ if (source == dumpItem)
17452202 {
17462203 DumpObject();
17472204 } else
1748
- if (event.getSource() == screenfitButton)
2205
+ if (source == minButton)
2206
+ {
2207
+ Minimize();
2208
+ } else
2209
+ if (source == maxButton)
2210
+ {
2211
+ Maximize();
2212
+ } else
2213
+ if (source == fullButton)
2214
+ {
2215
+ ToggleFullScreen();
2216
+ } else
2217
+ if (source == undoButton)
2218
+ {
2219
+ Undo();
2220
+ } else
2221
+ if (source == redoButton)
2222
+ {
2223
+ Redo();
2224
+ } else
2225
+ if (source == saveButton)
2226
+ {
2227
+ Save();
2228
+ } else
2229
+ if (source == oneStepButton)
2230
+ {
2231
+ Globals.ONESTEP = true;
2232
+ cameraView.repaint();
2233
+ } else
2234
+ if (source == screenfitButton)
17492235 {
17502236 //Reload(lastConverter, lastFilename, true);
17512237 ScreenFit();
17522238 } else
1753
- if (event.getSource() == screenfitpointButton)
2239
+ if (source == screenfitpointButton)
17542240 {
17552241 //Reload(lastConverter, lastFilename, true);
17562242 ScreenFitPoint();
17572243 } else
1758
- if (event.getSource() == snapobjectButton)
2244
+ if (source == snapobjectButton)
17592245 {
17602246 //Reload(lastConverter, lastFilename, true);
17612247 SnapObject();
....@@ -1766,13 +2252,13 @@
17662252 // Recompile();
17672253 // refreshContents();
17682254 // } else
1769
- if (event.getSource() == gcButton)
2255
+ if (source == gcButton)
17702256 {
17712257 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722258 System.gc();
17732259 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742260 } else
1775
- if (event.getSource() == editLeafItem)
2261
+ if (source == editLeafItem)
17762262 {
17772263 Object3D obj;
17782264 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2272,78 @@
17862272 }
17872273 refreshContents(true);
17882274 } else
1789
- if (event.getSource() == openWindowItem)
2275
+ if (source == openWindowItem)
17902276 {
17912277 EditSelection(true);
17922278 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2279
+ if (source == cutItem || source == clearButton)
17942280 {
17952281 loadClipboard(true);
17962282 } else
1797
- if (event.getSource() == duplicateItem)
2283
+ if (source == undoItem)
17982284 {
1799
- Object3D keep = GraphreeD.clipboard;
2285
+ Undo();
2286
+ } else
2287
+ if (source == redoItem)
2288
+ {
2289
+ Redo();
2290
+ } else
2291
+ if (source == duplicateItem)
2292
+ {
2293
+ Object3D keep = Grafreed.clipboard;
18002294 loadClipboard(false);
18012295 paste(false);
1802
- GraphreeD.clipboard = keep;
2296
+ Grafreed.clipboard = keep;
18032297 } else
1804
- if (event.getSource() == cloneItem)
2298
+ if (source == cloneItem)
18052299 {
18062300 CloneSelection(false);
18072301 } else
1808
- if (event.getSource() == cloneSupportItem)
2302
+ if (source == cloneSupportItem)
18092303 {
18102304 CloneSelection(true);
18112305 } else
1812
- if (event.getSource() == copyItem)
2306
+ if (source == copyItem)
18132307 {
18142308 loadClipboard(false);
18152309 } else
1816
- if (event.getSource() == pasteItem)
2310
+ if (source == pasteItem)
18172311 {
18182312 paste(false);
18192313 } else
1820
- if (event.getSource() == pasteLinkItem)
2314
+ if (source == pasteIntoItem)
18212315 {
1822
- pasteInto(false);
2316
+ pasteInto(true, false);
18232317 } else
1824
- if (event.getSource() == pasteCloneItem)
2318
+ if (source == pasteLinkItem)
18252319 {
1826
- pasteInto(true);
2320
+ pasteInto(false, false);
18272321 } else
1828
- if (event.getSource() == pasteExpandItem)
2322
+ if (source == pasteCloneItem)
2323
+ {
2324
+ pasteInto(true, true);
2325
+ } else
2326
+ if (source == pasteExpandItem)
18292327 {
18302328 paste(true);
18312329 } else
1832
- if (event.getSource() == synchronizeItem)
2330
+ if (source == synchronizeItem)
18332331 {
18342332 Overwrite(Object3D.TRANSFORM);
18352333 } else
1836
- if (event.getSource() == overwriteNameItem)
2334
+ if (source == overwriteNameItem)
18372335 {
18382336 Overwrite(Object3D.NAME);
18392337 } else
1840
- if (event.getSource() == overwriteUVItem)
2338
+ if (source == overwriteUVItem)
18412339 {
18422340 Overwrite(Object3D.UV);
18432341 } else
1844
- if (event.getSource() == overwriteMatItem)
2342
+ if (source == overwriteMatItem)
18452343 {
2344
+ /* july 2015
18462345 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2346
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482347 else
18492348 {
18502349 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2355,16 @@
18562355 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572356 }
18582357 }
2358
+ */
2359
+
2360
+ Overwrite(dropAttributes);
18592361 }
1860
- if (event.getSource() == overwriteGeoItem)
2362
+ if (source == overwriteGeoItem)
18612363 {
18622364 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2365
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642366 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2367
+// Object3D content = GrafreeD.clipboard.get(0);
18662368 //
18672369 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682370 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2376,7 @@
18742376 // refreshContents();
18752377 // }
18762378 } else
1877
- if (event.getSource() == generateMeshItem)
2379
+ if (source == generateMeshItem)
18782380 {
18792381 //if (group.selection.size() == 1)
18802382 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2387,7 @@
18852387 ResetModel();
18862388 refreshContents();
18872389 } else
1888
- if (event.getSource() == extractGeometriesItem)
2390
+ if (source == extractGeometriesItem)
18892391 {
18902392 boolean one = false;
18912393
....@@ -1912,7 +2414,7 @@
19122414 ResetModel();
19132415 refreshContents();
19142416 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2417
+ if (source == cloneGeometriesItem)
19162418 {
19172419 boolean one = false;
19182420
....@@ -1938,32 +2440,37 @@
19382440 ResetModel();
19392441 refreshContents();
19402442 } else
1941
- if (event.getSource() == shareGeometriesItem)
2443
+ if (source == shareGeometriesItem)
19422444 {
19432445 boolean one = false;
19442446
19452447 if (group.selection.size() == 1)
19462448 one = true;
19472449
2450
+ Object3D merge = null;
2451
+
19482452 Object3D content = new cGroup();
19492453
19502454 for (int i=0; i<group.selection.size(); i++)
19512455 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2456
+ merge = new Merge(group.selection.get(i));
19532457
19542458 if (one)
1955
- makeSomething(sel, false);
2459
+ makeSomething(merge, false);
19562460 else
1957
- content.addChild(sel);
2461
+ content.addChild(merge);
19582462 }
19592463
19602464 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2465
+ makeSomething(content, true);
2466
+ else
2467
+ {
2468
+ ResetModel();
2469
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2470
+ refreshContents();
2471
+ }
19652472 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2473
+ if (source == mergeGeometriesItem)
19672474 {
19682475 boolean one = false;
19692476
....@@ -1993,11 +2500,11 @@
19932500 ResetModel();
19942501 refreshContents();
19952502 } else
1996
- if (event.getSource() == linkverticesItem)
2503
+ if (source == linkverticesItem)
19972504 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2505
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992506 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2507
+// Object3D content = GrafreeD.clipboard.get(0);
20012508 //
20022509 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032510 // content = ((cGroup)content).get(0);
....@@ -2006,39 +2513,48 @@
20062513 // group.selection.get(0).setMasterThis(content); // should be identity
20072514 // refreshContents();
20082515 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2516
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20102517 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2518
+ Object3D content = Grafreed.clipboard.get(0);
20122519
20132520 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142521 content = ((cGroup)content).get(0);
20152522
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2523
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172524 for (int i=0; i<group.selection.size(); i++)
20182525 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
2526
+ boolean random = CameraPane.SWITCH;
2527
+ CameraPane.SWITCH = false; // parse all random nodes
20212528 group.selection.get(i).linkVerticesThis(content);
20222529 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
2530
+ CameraPane.SWITCH = random;
20242531 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2532
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262533 refreshContents();
20272534 }
20282535 } else
2029
- if (event.getSource() == resetsupportItem)
2536
+ if (source == resetsupportItem)
20302537 {
20312538 for (int i=0; i<group.selection.size(); i++)
20322539 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
2540
+ boolean random = CameraPane.SWITCH;
2541
+ CameraPane.SWITCH = false; // parse all random nodes
20352542 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
2543
+ CameraPane.SWITCH = random;
20372544 }
20382545
20392546 refreshContents();
20402547 } else
2041
- if (event.getSource() == resetreferencesItem)
2548
+ if (source == relinkverticesItem)
2549
+ {
2550
+ boolean random = CameraPane.SWITCH;
2551
+ CameraPane.SWITCH = false; // parse all random nodes
2552
+ group.selection.RelinkToSupport();
2553
+ CameraPane.SWITCH = random;
2554
+
2555
+ refreshContents();
2556
+ } else
2557
+ if (source == resetreferencesItem)
20422558 {
20432559 for (int i=0; i<group.selection.size(); i++)
20442560 {
....@@ -2047,11 +2563,11 @@
20472563
20482564 refreshContents();
20492565 } else
2050
- if (event.getSource() == setMasterItem)
2566
+ if (source == setMasterItem)
20512567 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2568
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20532569 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2570
+ Object3D content = Grafreed.clipboard.get(0);
20552571
20562572 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572573 content = ((cGroup)content).get(0);
....@@ -2060,13 +2576,13 @@
20602576 refreshContents();
20612577 }
20622578 } else
2063
- if (event.getSource() == poseMeshItem)
2579
+ if (source == poseMeshItem)
20642580 {
20652581 if (group.selection.size() == 1)
20662582 {
2067
- if (GraphreeD.clipboard.size() == 1)
2583
+ if (Grafreed.clipboard.size() == 1)
20682584 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2585
+ Object3D content = Grafreed.clipboard.get(0);
20702586
20712587 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722588 content = ((cGroup)content).get(0);
....@@ -2079,19 +2595,19 @@
20792595 }
20802596
20812597 } else
2082
- if (event.getSource() == revertMeshItem)
2598
+ if (source == revertMeshItem)
20832599 {
20842600 RevertMeshes();
20852601 } else
2086
- if (event.getSource() == resetMeshItem)
2602
+ if (source == resetAllItem)
20872603 {
20882604 ResetAll();
20892605 } else
2090
- if (event.getSource() == stepAllItem)
2606
+ if (source == stepAllItem)
20912607 {
20922608 StepAll();
20932609 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2610
+ if (source == clearItem) // || event.getSource() == clearButton)
20952611 {
20962612 //int indices[] = jList.getSelectedIndices();
20972613 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2615,46 @@
20992615
21002616 ClearSelection(false);
21012617 } else
2102
- if (event.getSource() == clearAllItem)
2618
+ if (source == clearAllItem)
21032619 {
21042620 ClearSelection(true);
21052621 } else
2106
- if (event.getSource() == grabItem)
2622
+ if (source == grabItem || source == groupButton)
21072623 {
2108
- group(new cGroup(), true);
2624
+ group(new cGroup(), false); // true);
21092625 } else
2110
- if (event.getSource() == frontItem)
2626
+ if (source == hideItem)
2627
+ {
2628
+ group(new HiddenObject());
2629
+ } else
2630
+ if (source == frontItem)
21112631 {
21122632 front();
21132633 } else
2114
- if (event.getSource() == backItem)
2634
+ if (source == backItem)
21152635 {
21162636 back();
21172637 } else
2118
- if (event.getSource() == cameraItem)
2638
+ if (source == cameraItem)
21192639 {
21202640 makeSomething(new Camera());
21212641 } else
2122
- if (event.getSource() == compositeItem)
2642
+ if (source == compositeItem || source == compositeButton)
21232643 {
21242644 group(new Composite());
21252645 } else
2126
- if (event.getSource() == randomItem)
2646
+ if (source == switchItem || source == switchButton)
21272647 {
21282648 RandomNode random = new RandomNode();
21292649 group(random);
21302650 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
2651
+ random.name = random.get(0).name + "Switch";
21322652 } else
2133
- if (event.getSource() == physicsItem)
2653
+ if (source == physicsItem)
21342654 {
21352655 group(new PhysicsNode());
21362656 } else
2137
- if (event.getSource() == frameselectorItem)
2657
+ if (source == frameselectorItem)
21382658 {
21392659 for (int i=0; i<group.selection.size(); i++)
21402660 {
....@@ -2146,7 +2666,7 @@
21462666 ResetModel();
21472667 refreshContents();
21482668 } else
2149
- if (event.getSource() == switchGeoItem)
2669
+ if (source == switchGeoItem)
21502670 {
21512671 for (int i=0; i<group.selection.size(); i++)
21522672 {
....@@ -2158,7 +2678,7 @@
21582678 ResetModel();
21592679 refreshContents();
21602680 } else
2161
- if (event.getSource() == switchTransfoItem)
2681
+ if (source == switchTransfoItem)
21622682 {
21632683 for (int i=0; i<group.selection.size(); i++)
21642684 {
....@@ -2170,7 +2690,7 @@
21702690 ResetModel();
21712691 refreshContents();
21722692 } else
2173
- if (event.getSource() == morphItem)
2693
+ if (source == morphItem)
21742694 {
21752695 for (int i=0; i<group.selection.size(); i++)
21762696 {
....@@ -2182,7 +2702,7 @@
21822702 ResetModel();
21832703 refreshContents();
21842704 } else
2185
- if (event.getSource() == scriptNodeItem)
2705
+ if (source == scriptNodeItem)
21862706 {
21872707 boolean atleastone = false;
21882708
....@@ -2221,191 +2741,252 @@
22212741 }
22222742 }
22232743 } else
2224
- if (event.getSource() == linkerItem)
2744
+ if (source == linkerItem)
22252745 {
22262746 group(new cLinker());
22272747 } else
2228
- if (event.getSource() == textureItem)
2748
+ if (source == textureItem || source == textureButton)
22292749 {
22302750 group(new TextureNode());
22312751 } else
2232
- if (event.getSource() == shadowXItem)
2752
+ if (source == billboardItem)
2753
+ {
2754
+ group(new BillboardNode());
2755
+ } else
2756
+ if (source == shadowXItem)
22332757 {
22342758 CastShadow(0);
22352759 } else
2236
- if (event.getSource() == shadowYItem)
2760
+ if (source == shadowYItem)
22372761 {
22382762 CastShadow(1);
22392763 } else
2240
- if (event.getSource() == shadowZItem)
2764
+ if (source == shadowZItem)
22412765 {
22422766 CastShadow(2);
22432767 } else
2244
- if (event.getSource() == ungroupItem)
2768
+ if (source == ungroupItem || source == ungroupButton)
22452769 {
2246
- ungroup();
2770
+ boolean hasRoot = false;
2771
+
2772
+ for (int i=0; i<group.selection.size(); i++)
2773
+ {
2774
+ if (group.selection.get(i) == group)
2775
+ {
2776
+ hasRoot = true;
2777
+ break;
2778
+ }
2779
+ }
2780
+
2781
+ if (!hasRoot)
2782
+ {
2783
+ for (int i=0; i<group.selection.size(); i++)
2784
+ {
2785
+ Ungroup(group.selection.get(i));
2786
+ }
2787
+
2788
+ ClearSelection(false);
2789
+
2790
+ refreshContents();
2791
+ }
22472792 } else
2248
- if (event.getSource() == genUVItem)
2793
+ if (source == genUVItem)
22492794 {
22502795 GenUV();
22512796 } else
2252
- if (event.getSource() == genNormalsCADItem)
2797
+ if (source == genNormalsCADItem)
22532798 {
22542799 GenNormals(true);
22552800 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2801
+ if (source == genNormalsMESHItem)
2802
+ {
2803
+ GenNormalsMESH();
2804
+ } else
2805
+ if (source == genNormalsORGANItem)
22572806 {
22582807 GenNormals(false);
22592808 } else
2260
- if (event.getSource() == stripifyItem)
2809
+ if (source == genNormalsMINEItem)
2810
+ {
2811
+ GenNormalsMINE();
2812
+ } else
2813
+ if (source == stripifyItem)
22612814 {
22622815 Stripify();
22632816 } else
2264
- if (event.getSource() == unstripifyItem)
2817
+ if (source == unstripifyItem)
22652818 {
22662819 Unstripify();
22672820 } else
2268
- if (event.getSource() == trimItem)
2821
+ if (source == trimItem)
22692822 {
22702823 Trim();
22712824 } else
2272
- if (event.getSource() == untrimItem)
2825
+ if (source == untrimItem)
22732826 {
22742827 Untrim();
22752828 } else
2276
- if (event.getSource() == clearColorsItem)
2829
+ if (source == clearColorsItem)
22772830 {
22782831 ClearColors();
22792832 } else
2280
- if (event.getSource() == clearMaterialsItem)
2833
+ if (source == clearMaterialsItem)
22812834 {
22822835 ClearMaterials();
22832836 } else
2284
- if (event.getSource() == liveleavesItem)
2837
+ if (source == liveleavesItem)
22852838 {
22862839 LiveLeaves(true);
22872840 } else
2288
- if (event.getSource() == unliveleavesItem)
2841
+ if (source == unliveleavesItem)
22892842 {
22902843 LiveLeaves(false);
22912844 } else
2292
- if (event.getSource() == supportleavesItem)
2845
+ if (source == supportleavesItem)
22932846 {
22942847 SupportLeaves(true);
22952848 } else
2296
- if (event.getSource() == unsupportleavesItem)
2849
+ if (source == unsupportleavesItem)
22972850 {
22982851 SupportLeaves(false);
22992852 } else
2300
- if (event.getSource() == hideleavesItem)
2853
+ if (source == hideleavesItem)
23012854 {
23022855 HideLeaves(true);
23032856 } else
2304
- if (event.getSource() == showleavesItem)
2857
+ if (source == showleavesItem)
23052858 {
23062859 HideLeaves(false);
23072860 } else
2308
- if (event.getSource() == markleavesItem)
2861
+ if (source == markleavesItem)
23092862 {
23102863 MarkLeaves(true);
23112864 } else
2312
- if (event.getSource() == unmarkleavesItem)
2865
+ if (source == unmarkleavesItem)
23132866 {
23142867 MarkLeaves(false);
23152868 } else
2316
- if (event.getSource() == flipVItem)
2869
+ if (source == rewindleavesItem)
2870
+ {
2871
+ RewindLeaves(true);
2872
+ } else
2873
+ if (source == unrewindleavesItem)
2874
+ {
2875
+ RewindLeaves(false);
2876
+ } else
2877
+ if (source == randomleavesItem)
2878
+ {
2879
+ RandomLeaves(true);
2880
+ } else
2881
+ if (source == unrandomleavesItem)
2882
+ {
2883
+ RandomLeaves(false);
2884
+ } else
2885
+ if (source == flipVItem)
23172886 {
23182887 FlipV(true);
23192888 } else
2320
- if (event.getSource() == unflipVItem)
2889
+ if (source == unflipVItem)
23212890 {
23222891 FlipV(false);
23232892 } else
2324
- if (event.getSource() == lowTexturesItem)
2893
+ if (source == lowTexturesItem)
23252894 {
23262895 SetTexRes(0);
23272896 } else
2328
- if (event.getSource() == normalTexturesItem)
2897
+ if (source == normalTexturesItem)
23292898 {
23302899 SetTexRes(1);
23312900 } else
2332
- if (event.getSource() == highTexturesItem)
2901
+ if (source == highTexturesItem)
23332902 {
23342903 SetTexRes(2);
23352904 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2905
+ if (source == veryhighTexturesItem)
23372906 {
23382907 SetTexRes(3);
23392908 } else
2340
- if (event.getSource() == maxTexturesItem)
2909
+ if (source == maxTexturesItem)
23412910 {
23422911 SetTexRes(4);
23432912 } else
2344
- if (event.getSource() == panoTexturesItem)
2913
+ if (source == panoTexturesItem)
23452914 {
23462915 SetTexRes(5);
23472916 } else
2348
- if (event.getSource() == reverseNormalsItem)
2917
+ if (source == reverseNormalsItem)
23492918 {
23502919 ReverseNormals();
23512920 } else
2352
- if (event.getSource() == parseverticesItem)
2921
+ if (source == parseverticesItem)
23532922 {
23542923 ParseVertices();
23552924 } else
2356
- if (event.getSource() == alignItem)
2925
+ if (source == textureFieldItem)
2926
+ {
2927
+ TextureVertices();
2928
+ } else
2929
+ if (source == alignItem)
23572930 {
23582931 Align();
23592932 } else
2360
- if (event.getSource() == mirrorItem)
2933
+ if (source == mirrorItem)
23612934 {
23622935 MirrorPoses();
23632936 } else
2364
- if (event.getSource() == reduceMorphItem)
2937
+ if (source == reduceMorphItem)
23652938 {
23662939 MeshReduction(false);
23672940 } else
2368
- if (event.getSource() == reduce34MorphItem)
2941
+ if (source == reduce34MorphItem)
23692942 {
23702943 MeshReduction(true);
23712944 } else
2372
- if (event.getSource() == reverseTrianglesItem)
2945
+ if (source == reverseTrianglesItem)
23732946 {
23742947 ReverseTriangles();
23752948 } else
2376
- if (event.getSource() == reduceMeshItem)
2949
+ if (source == reduceMeshItem)
23772950 {
23782951 ReduceMesh(false);
23792952 } else
2380
- if (event.getSource() == reduce34MeshItem)
2953
+ if (source == reduce34MeshItem)
23812954 {
23822955 ReduceMesh(true);
23832956 } else
2384
- if (event.getSource() == increaseMeshItem)
2957
+ if (source == increaseMeshItem)
23852958 {
23862959 IncreaseMesh();
23872960 } else
2388
- if (event.getSource() == clipMeshItem)
2961
+ if (source == clipMeshItem)
23892962 {
23902963 ClipMesh();
23912964 } else
2392
- if (event.getSource() == smoothMeshItem)
2965
+ if (source == smoothMeshItem)
23932966 {
23942967 SmoothMesh();
23952968 } else
2396
- if (event.getSource() == transformgeometryItem)
2969
+ if (source == transformGeometryItem)
23972970 {
23982971 TransformGeometry();
23992972 } else
2400
- if (event.getSource() == resetTransformItem)
2973
+ if (source == transformChildrenItem)
2974
+ {
2975
+ TransformChildren();
2976
+ } else
2977
+ if (source == resetTransformItem)
24012978 {
24022979 ResetTransform();
24032980 } else
2404
- if (event.getSource() == resetCentroidItem)
2981
+ if (source == resetCentroidItem)
24052982 {
2406
- ResetCentroid();
2983
+ ResetCentroid(true);
24072984 } else
2408
- if (event.getSource() == resetParentItem)
2985
+ if (source == resetCentroidXZItem)
2986
+ {
2987
+ ResetCentroid(false);
2988
+ } else
2989
+ if (source == resetParentItem)
24092990 {
24102991 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24112992 {
....@@ -2415,7 +2996,7 @@
24152996
24162997 refreshContents();
24172998 } else
2418
- if (event.getSource() == repairParentItem)
2999
+ if (source == repairParentItem)
24193000 {
24203001 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24213002 {
....@@ -2429,7 +3010,21 @@
24293010
24303011 refreshContents();
24313012 } else
2432
- if (event.getSource() == sortbysizeItem)
3013
+ if (source == repairShadowItem)
3014
+ {
3015
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3016
+ {
3017
+ Object3D obj = (Object3D)e.nextElement();
3018
+ obj.RepairShadow();
3019
+// for (int i=0; i<obj.size(); i++)
3020
+// {
3021
+// obj.get(i).parent = obj;
3022
+// }
3023
+ }
3024
+
3025
+ refreshContents();
3026
+ } else
3027
+ if (source == sortbysizeItem)
24333028 {
24343029 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353030 {
....@@ -2441,7 +3036,7 @@
24413036 ResetModel();
24423037 refreshContents();
24433038 } else
2444
- if (event.getSource() == sortbynameItem)
3039
+ if (source == sortbynameItem)
24453040 {
24463041 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473042 {
....@@ -2453,7 +3048,7 @@
24533048 ResetModel();
24543049 refreshContents();
24553050 } else
2456
- if (event.getSource() == attachPigmentItem)
3051
+ if (source == attachPigmentItem)
24573052 {
24583053 String texture = GetFile("Attach pigment");
24593054 Object3D obj;
....@@ -2465,7 +3060,7 @@
24653060
24663061 refreshContents();
24673062 } else
2468
- if (event.getSource() == detachPigmentItem)
3063
+ if (source == detachPigmentItem)
24693064 {
24703065 Object3D obj;
24713066 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3071,7 @@
24763071
24773072 refreshContents();
24783073 } else
2479
- if (event.getSource() == attachBumpItem)
3074
+ if (source == attachBumpItem)
24803075 {
24813076 String texture = GetFile("Attach bump");
24823077 Object3D obj;
....@@ -2488,7 +3083,7 @@
24883083
24893084 refreshContents();
24903085 } else
2491
- if (event.getSource() == detachBumpItem)
3086
+ if (source == detachBumpItem)
24923087 {
24933088 Object3D obj;
24943089 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +3094,7 @@
24993094
25003095 refreshContents();
25013096 } else
2502
- if (event.getSource() == pigmentBumpItem)
3097
+ if (source == pigmentBumpItem)
25033098 {
25043099 Object3D obj;
25053100 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +3105,237 @@
25103105
25113106 refreshContents();
25123107 } else
2513
- if (event.getSource() == flashSelectionButton)
3108
+ if (source == flashSelectionButton)
25143109 {
25153110 CameraPane.flash = true;
25163111 refreshContents();
25173112 } else
2518
- if (event.getSource() == oneButton)
3113
+ if (source == oneButton)
25193114 {
25203115 } else
2521
- if (event.getSource() == twoButton)
3116
+ if (source == twoButton)
25223117 {
25233118 radio.layout = twoButton;
3119
+
3120
+ if (CameraPane.FULLSCREEN)
3121
+ fullscreenLayout = radio.layout;
3122
+
25243123 // bug
25253124 //gridPanel.setDividerLocation(1.0);
25263125 //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();
3126
+// bigThree.remove(scenePanel);
3127
+// bigThree.remove(centralPanel);
3128
+// bigThree.remove(XYZPanel);
3129
+// aWindowConstraints.gridx = 0;
3130
+// aWindowConstraints.gridy = 0;
3131
+// aWindowConstraints.gridwidth = 1;
3132
+// // aConstraints.gridheight = 3;
3133
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3134
+// aWindowConstraints.weightx = 0;
3135
+// aWindowConstraints.weighty = 1;
3136
+// //bigThree.add(jtp, aWindowConstraints);
3137
+// aWindowConstraints.weightx = 1;
3138
+// aWindowConstraints.gridwidth = 3;
3139
+// // aConstraints.gridheight = 3;
3140
+// aWindowConstraints.gridx = 1;
3141
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3142
+// bigThree.add(centralPanel, aWindowConstraints);
3143
+// aWindowConstraints.weightx = 0;
3144
+// aWindowConstraints.gridx = 4;
3145
+// aWindowConstraints.gridwidth = 1;
3146
+// // aConstraints.gridheight = 3;
3147
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3148
+// //bigThree.add(XYZPanel, aWindowConstraints);
3149
+// scenePanel.setVisible(false);
3150
+// centralPanel.setVisible(true);
3151
+// XYZPanel.setVisible(false);
3152
+ bigThree.ClearUI();
3153
+ bigThree.add(centralPanel);
3154
+ bigThree.FlushUI();
3155
+
3156
+ cameraView.requestFocusInWindow();
3157
+
3158
+// refreshContents(true);
3159
+//
3160
+// try
3161
+// {
3162
+// java.awt.Robot bot = new java.awt.Robot();
3163
+// int mask = InputEvent.BUTTON1_MASK;
3164
+// bot.mouseMove(100, 100);
3165
+// bot.mousePress(mask);
3166
+// bot.mouseRelease(mask);
3167
+// }
3168
+// catch (Exception e)
3169
+// {
3170
+//
3171
+// }
3172
+
25513173 } else
2552
- if (event.getSource() == threeButton)
3174
+ if (source == threeButton)
25533175 {
25543176 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();
3177
+
3178
+ if (CameraPane.FULLSCREEN)
3179
+ fullscreenLayout = radio.layout;
3180
+
3181
+// bigThree.remove(scenePanel);
3182
+// bigThree.remove(centralPanel);
3183
+// bigThree.remove(XYZPanel);
3184
+// aWindowConstraints.gridx = 0;
3185
+// aWindowConstraints.gridy = 0;
3186
+// aWindowConstraints.gridwidth = 1;
3187
+// // aConstraints.gridheight = 3;
3188
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3189
+// aWindowConstraints.weightx = 0;
3190
+// aWindowConstraints.weighty = 1;
3191
+// //bigThree.add(jtp, aWindowConstraints);
3192
+// aWindowConstraints.weightx = 1;
3193
+// aWindowConstraints.gridwidth = 3;
3194
+// // aConstraints.gridheight = 3;
3195
+// aWindowConstraints.gridx = 1;
3196
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3197
+// bigThree.add(centralPanel, aWindowConstraints);
3198
+// aWindowConstraints.weightx = 0;
3199
+// aWindowConstraints.gridx = 4;
3200
+// aWindowConstraints.gridwidth = 1;
3201
+// // aConstraints.gridheight = 3;
3202
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3203
+// bigThree.add(XYZPanel, aWindowConstraints);
3204
+// bigThree.validate();
3205
+// scenePanel.setVisible(false);
3206
+// centralPanel.setVisible(true);
3207
+// XYZPanel.setVisible(true);
3208
+ bigThree.ClearUI();
3209
+ bigThree.add(centralPanel);
3210
+ bigThree.add(XYZPanel);
3211
+ bigThree.FlushUI();
3212
+
3213
+ cameraView.requestFocusInWindow();
25793214 } else
2580
- if (event.getSource() == fourButton)
3215
+ if (source == fourButton)
25813216 {
25823217 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();
3218
+
3219
+ if (CameraPane.FULLSCREEN)
3220
+ fullscreenLayout = radio.layout;
3221
+
3222
+// bigThree.remove(scenePanel);
3223
+// bigThree.remove(centralPanel);
3224
+// bigThree.remove(XYZPanel);
3225
+// aWindowConstraints.gridx = 0;
3226
+// aWindowConstraints.gridy = 0;
3227
+// aWindowConstraints.gridwidth = 1;
3228
+// // aWindowConstraints.gridheight = 3;
3229
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3230
+// aWindowConstraints.weightx = 1;
3231
+// aWindowConstraints.weighty = 1;
3232
+// bigThree.add(scenePanel, aWindowConstraints);
3233
+// aWindowConstraints.weightx = 1;
3234
+// aWindowConstraints.gridwidth = 3;
3235
+// // aConstraints.gridheight = 3;
3236
+// aWindowConstraints.gridx = 1;
3237
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3238
+// //bigThree.add(cameraPanel, aWindowConstraints);
3239
+// aWindowConstraints.weightx = 0;
3240
+// aWindowConstraints.gridx = 4;
3241
+// aWindowConstraints.gridwidth = 1;
3242
+// // aWindowConstraints.gridheight = 3;
3243
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3244
+// //bigThree.add(XYZPanel, aWindowConstraints);
3245
+// bigThree.validate();
3246
+// scenePanel.setVisible(true);
3247
+// centralPanel.setVisible(false);
3248
+// XYZPanel.setVisible(false);
3249
+ bigThree.ClearUI();
3250
+ bigThree.add(scenePanel);
3251
+ bigThree.FlushUI();
3252
+
3253
+ cameraView.requestFocusInWindow();
26073254 } else
2608
- if (event.getSource() == sixButton)
3255
+ if (source == sixButton)
26093256 {
26103257 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();
3258
+
3259
+ if (CameraPane.FULLSCREEN)
3260
+ fullscreenLayout = radio.layout;
3261
+
3262
+// bigThree.remove(scenePanel);
3263
+// bigThree.remove(centralPanel);
3264
+// bigThree.remove(XYZPanel);
3265
+// aWindowConstraints.gridx = 0;
3266
+// aWindowConstraints.gridy = 0;
3267
+// aWindowConstraints.gridwidth = 1;
3268
+// // aConstraints.gridheight = 3;
3269
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3270
+// aWindowConstraints.weightx = 0;
3271
+// aWindowConstraints.weighty = 1;
3272
+// bigThree.add(scenePanel, aWindowConstraints);
3273
+// aWindowConstraints.weightx = 1;
3274
+// aWindowConstraints.gridwidth = 3;
3275
+// // aWindowConstraints.gridheight = 3;
3276
+// aWindowConstraints.gridx = 1;
3277
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3278
+// bigThree.add(centralPanel, aWindowConstraints);
3279
+// aWindowConstraints.weightx = 0;
3280
+// aWindowConstraints.gridx = 4;
3281
+// aWindowConstraints.gridwidth = 1;
3282
+// // aWindowConstraints.gridheight = 3;
3283
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3284
+// //bigThree.add(XYZPanel, aConstraints);
3285
+// bigThree.validate();
3286
+// scenePanel.setVisible(true);
3287
+// centralPanel.setVisible(true);
3288
+// XYZPanel.setVisible(false);
3289
+ bigThree.ClearUI();
3290
+ bigThree.add(scenePanel);
3291
+ bigThree.add(centralPanel);
3292
+ bigThree.FlushUI();
3293
+
3294
+ cameraView.requestFocusInWindow();
26353295 } else
2636
- if (event.getSource() == sevenButton)
3296
+ if (source == sevenButton)
26373297 {
26383298 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();
3299
+
3300
+ if (CameraPane.FULLSCREEN)
3301
+ fullscreenLayout = radio.layout;
3302
+
3303
+// bigThree.remove(scenePanel);
3304
+// bigThree.remove(centralPanel);
3305
+// bigThree.remove(XYZPanel);
3306
+// aWindowConstraints.gridx = 0;
3307
+// aWindowConstraints.gridy = 0;
3308
+// aWindowConstraints.gridwidth = 1;
3309
+// // aWindowConstraints.gridheight = 3;
3310
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3311
+// aWindowConstraints.weightx = 0;
3312
+// aWindowConstraints.weighty = 1;
3313
+// bigThree.add(scenePanel, aWindowConstraints);
3314
+// aWindowConstraints.weightx = 1;
3315
+// aWindowConstraints.gridwidth = 3;
3316
+// // aWindowConstraints.gridheight = 3;
3317
+// aWindowConstraints.gridx = 1;
3318
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3319
+// bigThree.add(centralPanel, aWindowConstraints);
3320
+// aWindowConstraints.weightx = 0;
3321
+// aWindowConstraints.gridx = 4;
3322
+// aWindowConstraints.gridwidth = 1;
3323
+// // aConstraints.gridheight = 3;
3324
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3325
+// bigThree.add(XYZPanel, aWindowConstraints);
3326
+// bigThree.validate();
3327
+// scenePanel.setVisible(true);
3328
+// centralPanel.setVisible(true);
3329
+// XYZPanel.setVisible(true);
3330
+ bigThree.ClearUI();
3331
+ bigThree.add(scenePanel);
3332
+ bigThree.add(centralPanel);
3333
+ bigThree.add(XYZPanel);
3334
+ bigThree.FlushUI();
3335
+
3336
+ cameraView.requestFocusInWindow();
26633337 } else
2664
- if (event.getSource() == rootButton)
3338
+ if (source == rootButton)
26653339 {
26663340 Object3D obj;
26673341 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2671,66 +3345,84 @@
26713345 EditObject(obj);
26723346 }
26733347
3348
+ cameraView.requestFocusInWindow();
26743349 refreshContents(true);
26753350 } else
2676
- if (event.getSource() == closeButton)
3351
+ if (source == closeButton)
26773352 {
26783353 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793354 cRadio ab;
26803355 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813356 {
26823357 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3358
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843359 {
3360
+ // Patch to avoid bug with transparency.
3361
+ if (!ab.hadMaterial)
3362
+ {
3363
+ ab.object.material = null;
3364
+ }
3365
+
26853366 buttonGroup.remove(ab);
26863367 radioPanel.remove(ab);
26873368
2688
- ab.GetObject().editWindow = null;
3369
+ //ab.GetObject().editWindow = null;
3370
+ ab.GetObject().manipWindow = null;
26893371 // ab.GetObject().objectUI = null; // ?????????
26903372
26913373 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923374 break;
26933375 }
26943376 }
3377
+
3378
+ cameraView.requestFocusInWindow();
26953379 refreshContents(true);
26963380 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3381
+ if (source == editItem || source == editButton)
26983382 {
3383
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3384
+ {
3385
+ Object3D child = (Object3D)e.nextElement();
3386
+ child.pinned = true;
3387
+ }
3388
+
26993389 EditSelection(false);
27003390 } else
2701
- if (event.getSource() == uneditButton)
3391
+ if (source == uneditButton)
27023392 {
27033393 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043394 {
27053395 Object3D child = (Object3D)e.nextElement();
27063396 if(child.editWindow != null)
27073397 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3398
+ child.pinned = false;
27083399 child.CloseUI();
27093400 listUI.remove(child);
27103401
2711
- child.editWindow = null; // ???????????
3402
+ //child.editWindow = null; // ???????????
27123403 }
2713
- objEditor.ctrlPanel.revalidate();
3404
+ objEditor.ctrlPanel.FlushUI();
27143405 //objEditor.jTree.clearSelection();
27153406 //objEditor.ResetSliders();
27163407 refreshContents(true);
27173408 } else
2718
- if (event.getSource() == clearPanelButton)
3409
+ if (source == clearPanelButton)
27193410 {
27203411 assert(copy == group);
27213412 //copy.ClearUI();
27223413 for (Object3D obj : listUI)
27233414 {
3415
+ obj.pinned = false;
27243416 obj.CloseUI();
27253417 }
27263418 listUI.clear();
27273419 refreshContents(true);
27283420 } else
2729
- if (event.getSource() == allParamsButton)
3421
+ if (source == allParamsButton)
27303422 {
27313423 assert(copy == group);
27323424
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3425
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27343426
27353427 for (Object3D obj : listUI)
27363428 {
....@@ -2747,19 +3439,19 @@
27473439
27483440 refreshContents(true);
27493441 } else
2750
- if (event.getSource() == unselectButton)
3442
+ if (source == unselectButton)
27513443 {
27523444 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3445
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543446 objEditor.ResetSliders();
27553447 refreshContents(true);
27563448 } else
2757
- if(event.getSource() instanceof cRadio)
3449
+ if(source instanceof cRadio)
27583450 {
27593451 group.parent = keepparent;
27603452 group.attributes = 0;
27613453 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3454
+ /*cRadio*/ radio = (cRadio)source;
27633455 Object3D obj = radio.GetObject();
27643456 System.out.println("Edit " + obj);
27653457 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +3471,7 @@
27793471 }
27803472
27813473 copy = group;
2782
- //CameraPane.theRenderer.object = group;
3474
+ //Globals.theRenderer.object = group;
27833475 if(!useclient)
27843476 {
27853477 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +3480,50 @@
27883480 cameraView.cameras[cameraView.cameracount] = radio.camera;
27893481 cameraView.targetLookAt.set(radio.camera.lookAt);
27903482 cameraView.object = group;
2791
- cameraView.lighttouched = true;
3483
+ //cameraView.lighttouched = true;
3484
+ Globals.lighttouched = true;
27923485 topView.object = group;
27933486 frontView.object = group;
27943487 sideView.object = group;
27953488 }
2796
- group.editWindow = this;
3489
+
3490
+// fix "+" issue
3491
+ //group.editWindow = this;
3492
+ group.manipWindow = this;
3493
+
27973494 /*
27983495 currentLayout = radio.layout;
27993496 if (currentLayout == null)
28003497 currentLayout = sevenButton;
28013498 */
28023499 radio.layout.doClick();
3500
+
3501
+ ClearUnpinned();
3502
+ SetPinStates(group.selection.size() > 0);
3503
+ if (group.selection.size() == 1)
3504
+ EditSelection(false);
28033505 keepparent = group.parent;
28043506 // PARENT = NULL or not???
28053507 //group.parent = null; // ROOT
28063508 //group.attributes = -1;
28073509 ResetModel();
3510
+
3511
+ cameraView.requestFocusInWindow();
28083512 refreshContents(true);
2809
- }
3513
+ } else if (event.getSource() == editCameraItem)
3514
+ {
3515
+ cameraView.ProtectCamera();
3516
+ cameraView.repaint();
3517
+ return;
3518
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3519
+ {
3520
+ cameraView.RevertCamera();
3521
+ cameraView.repaint();
3522
+ return;
3523
+ // } else if (event.getSource() == textureButton)
3524
+ // {
3525
+ // return; // true;
3526
+ }
28103527 else
28113528 {
28123529 //return super.action(event, arg);
....@@ -2815,7 +3532,6 @@
28153532 }
28163533
28173534 boolean useclient = false;
2818
- cRadio radio;
28193535
28203536 void ToggleRoot()
28213537 {
....@@ -2824,7 +3540,7 @@
28243540 if (useclient)
28253541 {
28263542 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3543
+ Globals.lighttouched = true;
28283544 //topView.object = client;
28293545 //frontView.object = client;
28303546 //sideView.object = client;
....@@ -2832,7 +3548,7 @@
28323548 else
28333549 {
28343550 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3551
+ Globals.lighttouched = true;
28363552 //topView.object = group;
28373553 //frontView.object = group;
28383554 //sideView.object = group;
....@@ -2867,6 +3583,28 @@
28673583 refreshContents();
28683584 }
28693585
3586
+ void TransformChildren()
3587
+ {
3588
+ Object3D obj;
3589
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3590
+ {
3591
+ obj = (Object3D)e.nextElement();
3592
+ obj.KeepTextureMatrices();
3593
+ obj.TransformChildren();
3594
+ obj.RestoreTextureMatrices();
3595
+
3596
+// if (obj.parent == null)
3597
+// {
3598
+// System.out.println("NULL PARENT!");
3599
+// new Exception().printStackTrace();
3600
+// }
3601
+// else
3602
+// TouchTransform(obj);
3603
+// //obj.parent.Touch();
3604
+ }
3605
+
3606
+ refreshContents();
3607
+ }
28703608
28713609 void ResetTransform()
28723610 {
....@@ -2979,7 +3717,7 @@
29793717 refreshContents();
29803718 }
29813719
2982
- void ResetCentroid()
3720
+ void ResetCentroid(boolean full)
29833721 {
29843722 Object3D obj;
29853723 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +3732,16 @@
29943732 LA.matIdentity(Object3D.mat);
29953733 obj.getBounds(minima, maxima, false);
29963734 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3735
+ if (full)
3736
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29983737 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29993738 obj.TransformMesh(Object3D.mat);
3739
+
30003740 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3741
+ if (full)
3742
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30023743 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3744
+
30033745 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30043746 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30053747 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +3770,8 @@
30283770
30293771 int size = obj.MemorySize();
30303772
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
3773
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3774
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30323775 }
30333776 }
30343777 catch (Exception e)
....@@ -3065,9 +3808,9 @@
30653808 obj = (Object3D)e.nextElement();
30663809
30673810 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3811
+ Grafreed.AnalyzeObject(obj);
30693812 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3813
+ Grafreed.AnalyzeObject(obj.bRep);
30713814
30723815 // System.err.println((size/1024) + " KB is the size of " + obj);
30733816 }
....@@ -3109,6 +3852,20 @@
31093852 void GenNormals(boolean crease)
31103853 {
31113854 group.GenNormalsS(crease);
3855
+
3856
+ refreshContents();
3857
+ }
3858
+
3859
+ void GenNormalsMESH()
3860
+ {
3861
+ group.GenNormalsMeshS();
3862
+
3863
+ refreshContents();
3864
+ }
3865
+
3866
+ void GenNormalsMINE()
3867
+ {
3868
+ group.selection.GenNormalsMINE();
31123869
31133870 refreshContents();
31143871 }
....@@ -3157,104 +3914,259 @@
31573914
31583915 //Object3D buffer;
31593916 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
-
3917
+// BoundaryRep temprep;
3918
+// Object3D nodes;
3919
+// Vector<Vertex> vertices;
3920
+//
3921
+// cGroup buffer;
3922
+//
3923
+// public void Vertex(Object3D node, Vertex v)
3924
+// {
3925
+//// vertices.add(v);
3926
+//// nodes.addElement(node);
3927
+////
3928
+//// if (temprep.GetCache(v) != null)
3929
+//// {
3930
+//// temprep.Remove(v);
3931
+//// } else
3932
+//// {
3933
+//// temprep.Remember(v);
3934
+//// }
3935
+//
3936
+// //Object3D node = nodes.get(index);
3937
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
3938
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3939
+//
3940
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3941
+//
3942
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3943
+//
3944
+// cGroup g = new cGroup();
3945
+//
3946
+// if (g.toParent == null)
3947
+// {
3948
+// g.toParent = LA.newMatrix();
3949
+// g.fromParent = LA.newMatrix();
3950
+// }
3951
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3952
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3953
+//
3954
+// g.add(GrafreeD.clipboard);
3955
+//
3956
+// buffer.add(g);
3957
+// }
3958
+//
3959
+// public void Face(Object3D node, Face f)
3960
+// {
3961
+//
3962
+// }
3963
+//
3964
+// void ParseVerticesOld() // ??
3965
+// {
3966
+// //if (group.selection.size() != 1)
3967
+// // return;
3968
+//
3969
+// temprep = new BoundaryRep();
3970
+// nodes = new Object3D();
3971
+// vertices = new Vector<Vertex>();
3972
+//
3973
+// boolean epsequal = GrafreeD.epsequal;
3974
+// GrafreeD.epsequal = true;
3975
+//
3976
+// for (int i=0; i<group.selection.size(); i++)
3977
+// {
3978
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3979
+//
3980
+// group.selection.get(i).Parse(
3981
+//this );
3982
+//
3983
+// int repsize = temprep.VertexCount();
3984
+// int tablesize = temprep.vertextable.size();
3985
+// int nodesize = nodes.size();
3986
+//
3987
+// assert(vertices.size() == nodes.size());
3988
+//
3989
+// temprep.vertextable.elements();
3990
+//
3991
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
3992
+//
3993
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3994
+// {
3995
+// cGroup g = new cGroup();
3996
+//
3997
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3998
+//
3999
+// Object3D node = nodes.get(index);
4000
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
4001
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4002
+//
4003
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4004
+//
4005
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4006
+//
4007
+// if (g.toParent == null)
4008
+// {
4009
+// g.toParent = LA.newMatrix();
4010
+// g.fromParent = LA.newMatrix();
4011
+// }
4012
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4013
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4014
+//
4015
+// g.add(GrafreeD.clipboard);
4016
+//
4017
+// buffer.add(g);
4018
+// }
4019
+//
4020
+// makeSomething(buffer, i==group.selection.size()-1);
4021
+// }
4022
+//
4023
+// GrafreeD.epsequal = epsequal;
4024
+//
4025
+// //buffer = null;
4026
+// temprep = null;
4027
+// nodes = null;
4028
+//
4029
+// refreshContents();
4030
+// }
4031
+
31844032 void ParseVertices()
31854033 {
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;
4034
+ boolean epsequal = Grafreed.epsequal;
4035
+ Grafreed.epsequal = true;
31954036
31964037 for (int i=0; i<group.selection.size(); i++)
31974038 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4039
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994040
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4041
+ group.selection.get(i).Parse(
4042
+
4043
+ new iParse()
4044
+ {
4045
+ public void Vertex(Object3D node, Vertex v)
4046
+ {
4047
+ temp.set(v);
4048
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054049
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();
4050
+ cGroup g = new cGroup();
32114051
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4052
+ if (g.toParent == null)
4053
+ {
4054
+ g.toParent = LA.newMatrix();
4055
+ g.fromParent = LA.newMatrix();
4056
+ }
4057
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4058
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154059
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);
4060
+ g.add(Grafreed.clipboard);
32204061
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);
4062
+ buffer.add(g);
4063
+ }
32324064
3233
- g.add(GraphreeD.clipboard);
4065
+ public void Face(Object3D node, Face f)
4066
+ {
32344067
3235
- buffer.add(g);
3236
- }
4068
+ }
4069
+ }
4070
+ );
32374071
32384072 makeSomething(buffer, i==group.selection.size()-1);
32394073 }
32404074
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4075
+ Grafreed.epsequal = epsequal;
32464076
32474077 refreshContents();
32484078 }
3249
-
4079
+
4080
+ void TextureVertices()
4081
+ {
4082
+ for (int i=0; i<group.selection.size(); i++)
4083
+ {
4084
+ group.selection.get(i).Parse(
4085
+ new iParse()
4086
+ {
4087
+ public void Vertex(Object3D node, Vertex v)
4088
+ {
4089
+ cTexture tex = node.GetTextures();
4090
+ String pigment = Object3D.GetPigment(tex);
4091
+ //String bump = Object3D.GetBump(tex);
4092
+
4093
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4094
+
4095
+ try
4096
+ {
4097
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4098
+ }
4099
+ catch (Exception e)
4100
+ {
4101
+ System.err.println("FAIL: " + node);
4102
+ }
4103
+
4104
+ double s = v.s;
4105
+
4106
+ if (s == 1)
4107
+ s = 0;
4108
+
4109
+ double t = v.t;
4110
+
4111
+ if (t == 1)
4112
+ t = 0;
4113
+
4114
+ int indexs = (int) (texturedata.getWidth() * s);
4115
+ int indext = (int) (texturedata.getHeight() * t);
4116
+
4117
+ int index = indext * texturedata.getWidth() + indexs;
4118
+
4119
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4120
+
4121
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4122
+
4123
+ float scale = bytebuf.get(index*slide) & 0xFF;
4124
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4125
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4126
+ scale /= 3;
4127
+
4128
+ scale /= 0xFF;
4129
+ // c'est quoi ca? scale /= 4;
4130
+
4131
+ //v.AO = scale;
4132
+
4133
+ v.x += v.norm.x * scale;
4134
+ v.y += v.norm.y * scale;
4135
+ v.z += v.norm.z * scale;
4136
+ }
4137
+
4138
+ public void Face(Object3D node, Face f)
4139
+ {
4140
+ }
4141
+ }
4142
+ );
4143
+ }
4144
+
4145
+ refreshContents();
4146
+ }
4147
+
32504148 void Align()
32514149 {
4150
+ if (group.selection.size() == 0)
4151
+ return;
4152
+
4153
+ cVector bbmin = new cVector();
4154
+ cVector bbmax = new cVector();
4155
+
4156
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4157
+
4158
+ double dx = bbmax.x - bbmin.x;
4159
+ double dy = bbmax.y - bbmin.y;
4160
+ double dz = bbmax.z - bbmin.z;
4161
+
4162
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4163
+
32524164 for (int i=0; i<group.selection.size(); i++)
32534165 {
32544166 Object3D obj = group.selection.get(i);
32554167
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4168
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4169
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584170 }
32594171
32604172 refreshContents();
....@@ -3267,7 +4179,7 @@
32674179 // ref.SaveSupports();
32684180 // Object3D par = ref.parent;
32694181 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4182
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714183 // ref.parent = par;
32724184 // ref.RestoreSupports();
32734185
....@@ -3275,11 +4187,11 @@
32754187
32764188 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774189
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4190
+ boolean random = CameraPane.SWITCH;
4191
+ CameraPane.SWITCH = false; // parse all random nodes
32804192 lowres.linkVerticesThis(null);
32814193 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4194
+ CameraPane.SWITCH = random;
32834195
32844196 System.err.flush();
32854197
....@@ -3297,7 +4209,7 @@
32974209 // lowres.SaveSupports();
32984210 // par = lowres.parent;
32994211 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4212
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014213 Object3D newlow = CloneObject(lowres, false);
33024214 newlow.name = sn.switchobject.get(i).name;
33034215 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4231,7 @@
33194231 return;
33204232
33214233 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4234
+ Object3D ref = Grafreed.clipboard.get(0);
33234235
33244236 Object3D newgroup = new Object3D("Po:" + poses.name);
33254237
....@@ -3488,7 +4400,7 @@
34884400 group.selection.RelinkToSupport(); // july 2014
34894401 System.out.println("DONE.");
34904402 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4403
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34924404 }
34934405
34944406 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +4425,20 @@
35134425
35144426 void ClipMesh()
35154427 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4428
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35174429 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
4430
+ Object3D content = Grafreed.clipboard.get(0);
35194431
35204432 if (content instanceof cGroup && ((cGroup)content).transientlink )
35214433 content = ((cGroup)content).get(0);
35224434
35234435 // for (int i=0; i<group.selection.size(); i++)
35244436 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4437
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264438 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4439
+ group.selection.ClipMesh(Grafreed.clipboard);
35284440 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4441
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304442 System.out.println("DONE.");
35314443 refreshContents();
35324444 }
....@@ -3571,6 +4483,18 @@
35714483 void MarkLeaves(boolean hide)
35724484 {
35734485 group.selection.MarkLeaves(hide);
4486
+ refreshContents();
4487
+ }
4488
+
4489
+ void RewindLeaves(boolean hide)
4490
+ {
4491
+ group.selection.RewindLeaves(hide);
4492
+ refreshContents();
4493
+ }
4494
+
4495
+ void RandomLeaves(boolean hide)
4496
+ {
4497
+ group.selection.RandomLeaves(hide);
35744498 refreshContents();
35754499 }
35764500
....@@ -3645,10 +4569,6 @@
36454569 // }
36464570 // }
36474571
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36524572 void EditSelection(boolean newWindow)
36534573 {
36544574 // aConstraints.gridy = 0;
....@@ -3656,10 +4576,10 @@
36564576 {
36574577 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36584578 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4579
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36604580
36614581 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
4582
+ if(elem != group || !newWindow)
36634583 {
36644584 // if (!(elem instanceof Composite))
36654585 // newWindow = false;
....@@ -3741,7 +4661,8 @@
37414661 //new Exception().printStackTrace();
37424662
37434663 freezemodel = true;
3744
-
4664
+ ClearUnpinned();
4665
+
37454666 /**/
37464667 //switch (event.id)
37474668 {
....@@ -3749,7 +4670,6 @@
37494670 //case 702: // Event.LIST_DESELECT
37504671 group.deselectAll();
37514672 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37534673 if (tps != null)
37544674 {
37554675 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +4678,39 @@
37584678
37594679 //if (child.parent != null)
37604680 //child.parent.addSelectee(child);
4681
+ objEditor.SetMaterial(child);
37614682 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37654683 }
37664684 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
4685
+// else
4686
+// {
4687
+// objEditor.SetMaterial(group); // .GetMaterial());
4688
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4689
+// System.err.println("info : " + group.GetPath());
4690
+// }
37734691
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4692
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37774693 CameraPane.flash = true;
37784694
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4695
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37804696 // a camera
37814697 {
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;
4698
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4699
+ {
4700
+ CameraPane.camerachangeframe = 0; // don't refuse it
4701
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4702
+ }
4703
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4704
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864705 }
37874706
4707
+ if (tps != null && tps.length == 1)
4708
+ {
4709
+ EditSelection(false);
4710
+ }
4711
+
4712
+ SetPinStates(tps != null && tps.length > 0);
4713
+
37884714 refreshContents();
37894715 //return true;
37904716 }
....@@ -3793,6 +4719,35 @@
37934719
37944720 freezemodel = false;
37954721 }
4722
+
4723
+ void SetPinStates(boolean enabled)
4724
+ {
4725
+ editButton.setEnabled(enabled);
4726
+ uneditButton.setEnabled(enabled);
4727
+ unselectButton.setEnabled(enabled);
4728
+ flashSelectionButton.setEnabled(enabled);
4729
+ }
4730
+
4731
+ void refreshContents(boolean cp)
4732
+ {
4733
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4734
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4735
+ {
4736
+ objEditor.ClearInfo(); // .GetMaterial());
4737
+
4738
+ for (int i=0; i < group.selection.Size(); i++)
4739
+ {
4740
+ Object3D child = (Object3D) group.selection.get(i);
4741
+
4742
+ objEditor.AddInfo(child, this, true);
4743
+ System.err.println("info : " + child.GetPath());
4744
+ }
4745
+
4746
+ objEditor.SetText(); // jan 2014
4747
+ }
4748
+
4749
+ super.refreshContents(cp);
4750
+ }
37964751
37974752 void linkSomething(Object3D thing)
37984753 {
....@@ -3864,16 +4819,19 @@
38644819 {
38654820 if (group.selection.isEmpty())
38664821 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4822
+
4823
+ Grafreed.clipboardIsTempGroup = false;
38684824 Composite tGroup = null;
38694825 if (group.selection.size() > 0) // 1)
38704826 {
38714827 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4828
+ Grafreed.clipboardIsTempGroup = true;
38734829 }
38744830
38754831 if (cut)
38764832 {
4833
+ if (Globals.SAVEONMAKE)
4834
+ Save();
38774835 //int indices[] = jList.getSelectedIndices();
38784836 //for (int i = indices.length - 1; i >= 0; i--)
38794837 //jList.remove(indices[i]);
....@@ -3909,16 +4867,16 @@
39094867 //System.out.println("cut " + child);
39104868 //System.out.println("parent = " + child.parent);
39114869 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4870
+ if (Grafreed.clipboardIsTempGroup)
39134871 tGroup.add/*Child*/(tmp);
39144872 else
3915
- GraphreeD.clipboard = tmp;
4873
+ Grafreed.clipboard = tmp;
39164874 }
39174875 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4876
+ if (Grafreed.clipboardIsTempGroup)
39194877 tGroup.add/*Child*/(child);
39204878 else
3921
- GraphreeD.clipboard = child;
4879
+ Grafreed.clipboard = child;
39224880 }
39234881
39244882 //ResetModel();
....@@ -3950,21 +4908,23 @@
39504908 //System.out.println("cut " + elem);
39514909 //System.out.println("parent = " + elem.parent);
39524910 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4911
+ if (Grafreed.clipboardIsTempGroup)
39544912 tGroup.add/*Child*/(tmp);
39554913 else
3956
- GraphreeD.clipboard = tmp;
4914
+ Grafreed.clipboard = tmp;
39574915 }
39584916 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4917
+ if (Grafreed.clipboardIsTempGroup)
39604918 tGroup.add/*Child*/(child);
39614919 else
3962
- GraphreeD.clipboard = child;
4920
+ Grafreed.clipboard = child;
39634921 }
39644922
39654923 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4924
+
4925
+ if (Grafreed.clipboardIsTempGroup)
4926
+ Grafreed.clipboard = tGroup;
4927
+
39684928 if (cut)
39694929 {
39704930 ResetModel();
....@@ -3974,11 +4934,11 @@
39744934
39754935 void paste(boolean expand)
39764936 {
3977
- // if (GraphreeD.clipboard == null)
4937
+ // if (GrafreeD.clipboard == null)
39784938 // return;
39794939 boolean first = true;
39804940
3981
- if (GraphreeD.clipboardIsTempGroup)
4941
+ if (Grafreed.clipboardIsTempGroup)
39824942 {
39834943 Composite temp;
39844944
....@@ -3989,7 +4949,7 @@
39894949 temp = (Composite)Applet3D.clipboard.deepCopy();
39904950 */
39914951 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4952
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39934953 {
39944954 Object3D child = (Object3D)e.nextElement();
39954955
....@@ -4003,7 +4963,7 @@
40034963 else
40044964 elem = child.deepCopy(); // ?
40054965 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4966
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40074967 // elem = elem.get(0);
40084968 makeSomething(elem, true); // ?? first);
40094969 //group.addChild(elem);
....@@ -4023,23 +4983,23 @@
40234983 //Object3D cb = Applet3D.clipboard;
40244984 //temp.addChild(cb);
40254985 //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());
4986
+ assert(Grafreed.clipboard.parent == null);
4987
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4988
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4989
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4990
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40314991 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
4992
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4993
+ Grafreed.clipboard.get(0).parent = keepparent;
40344994 }
40354995
40364996 ResetModel();
40374997 refreshContents();
40384998 }
40394999
4040
- void pasteInto(boolean copyit)
5000
+ void pasteInto(boolean copyit, boolean clone)
40415001 {
4042
-// if (GraphreeD.clipboard == null)
5002
+// if (GrafreeD.clipboard == null)
40435003 // return;
40445004
40455005 if (group.selection.size() != 1)
....@@ -4066,15 +5026,22 @@
40665026 if (copyit)
40675027 {
40685028 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5029
+ if (clone)
5030
+ {
5031
+ CloneClipboard(false); // sept 2014
5032
+ }
5033
+ else
5034
+ {
5035
+ paste(false);
5036
+ }
40705037 }
40715038 else
40725039 {
40735040 boolean first = true;
40745041
4075
- if (GraphreeD.clipboardIsTempGroup)
5042
+ if (Grafreed.clipboardIsTempGroup)
40765043 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5044
+ Composite temp = (Composite)Grafreed.clipboard;
40785045 Object3D copy;
40795046 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805047 {
....@@ -4084,7 +5051,7 @@
40845051 }
40855052 } else
40865053 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5054
+ linkSomething(Grafreed.clipboard); //.get(0));
40885055 }
40895056 }
40905057 }
....@@ -4276,6 +5243,26 @@
42765243 makeSomething(csg);
42775244 }
42785245
5246
+ void Ungroup(Object3D g)
5247
+ {
5248
+ if (g instanceof HiddenObject)
5249
+ {
5250
+ HiddenObject h = (HiddenObject) g;
5251
+
5252
+ for (int i=0; i<h.ActualSize(); i++)
5253
+ {
5254
+ objEditor.makeSomething(h.get(i), false);
5255
+ }
5256
+ }
5257
+ else
5258
+ {
5259
+ for (int i=0; i<g.Size(); i++)
5260
+ {
5261
+ objEditor.makeSomething(g.get(i), false);
5262
+ }
5263
+ }
5264
+ }
5265
+
42795266 void ungroup()
42805267 {
42815268 /*
....@@ -4469,21 +5456,6 @@
44695456 }
44705457 */
44715458
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
-
44875459 /*
44885460 public void Callback(Object obj)
44895461 {
....@@ -4507,26 +5479,9 @@
45075479 }
45085480 */
45095481
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
-
45275482 String GetFile(String dialogName)
45285483 {
4529
- if (GraphreeD.standAlone)
5484
+ if (Grafreed.standAlone)
45305485 {
45315486 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45325487 browser.show();
....@@ -4590,10 +5545,33 @@
45905545 cButton flashSelectionButton;
45915546 cButton editButton;
45925547 cButton uneditButton;
5548
+ JCheckBox allParamsButton;
45935549 cButton clearpanelButton;
4594
- cButton allParamsButton;
45955550 cButton unselectButton;
45965551
5552
+ cButton restoreCameraButton;
5553
+
5554
+ cButton saveButton;
5555
+ cButton oneStepButton;
5556
+
5557
+ cButton groupButton;
5558
+ cButton ungroupButton;
5559
+ cButton compositeButton;
5560
+ cButton switchButton;
5561
+ cButton loopButton;
5562
+ cButton textureButton;
5563
+
5564
+ cButton gridButton;
5565
+ cButton boxButton;
5566
+ cButton sphereButton;
5567
+ cButton coneButton;
5568
+ cButton torusButton;
5569
+ cButton superButton;
5570
+ cButton kleinButton;
5571
+ cButton particlesButton;
5572
+ cButton overlayButton;
5573
+ cButton lightButton;
5574
+
45975575 cButton screenfitButton;
45985576 cButton screenfitpointButton;
45995577 cButton snapobjectButton;
....@@ -4605,14 +5583,6 @@
46055583
46065584 cButton setsupportButton;
46075585
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
-
46165586 //
46175587 //Composite
46185588 Object3D // to do !!
....@@ -4622,9 +5592,11 @@
46225592 //JTree jTree;
46235593 private MenuItem lookAtItem;
46245594 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
5595
+ private MenuItem switchViewItem;
46265596 private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
5597
+ private MenuItem undoItem;
5598
+ private MenuItem redoItem;
5599
+ private JMenuItem duplicateItem;
46285600 private MenuItem cloneItem;
46295601 private MenuItem cloneSupportItem;
46305602 private MenuItem overwriteGeoItem;
....@@ -4635,8 +5607,9 @@
46355607 private MenuItem resetsupportItem;
46365608 private MenuItem resetreferencesItem;
46375609 private MenuItem linkverticesItem;
5610
+ private MenuItem relinkverticesItem;
46385611 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
5612
+ private MenuItem resetAllItem;
46405613 private MenuItem stepAllItem;
46415614 private MenuItem revertMeshItem;
46425615 private MenuItem poseMeshItem;
....@@ -4647,14 +5620,17 @@
46475620 private MenuItem mergeGeometriesItem;
46485621 private MenuItem copyItem;
46495622 private MenuItem pasteItem;
5623
+ private MenuItem pasteIntoItem;
46505624 private MenuItem pasteLinkItem;
46515625 private MenuItem pasteCloneItem;
46525626 private MenuItem pasteExpandItem;
46535627 private MenuItem clearItem;
46545628 private MenuItem clearAllItem;
46555629 private MenuItem genUVItem;
5630
+ private MenuItem genNormalsMESHItem;
46565631 private MenuItem genNormalsCADItem;
46575632 private MenuItem genNormalsORGANItem;
5633
+ private MenuItem genNormalsMINEItem;
46585634 private MenuItem stripifyItem;
46595635 private MenuItem unstripifyItem;
46605636 private MenuItem trimItem;
....@@ -4683,6 +5659,10 @@
46835659 private MenuItem showleavesItem;
46845660 private MenuItem markleavesItem;
46855661 private MenuItem unmarkleavesItem;
5662
+ private MenuItem rewindleavesItem;
5663
+ private MenuItem unrewindleavesItem;
5664
+ private MenuItem randomleavesItem;
5665
+ private MenuItem unrandomleavesItem;
46865666
46875667 private MenuItem flipVItem;
46885668 private MenuItem unflipVItem;
....@@ -4694,14 +5674,17 @@
46945674 private MenuItem panoTexturesItem;
46955675
46965676 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
5677
+ private MenuItem resetCentroidXZItem;
46985678 private MenuItem resetTransformItem;
5679
+ private MenuItem transformGeometryItem;
5680
+ private MenuItem transformChildrenItem;
5681
+ private MenuItem hideItem;
46995682 private MenuItem grabItem;
47005683 private MenuItem backItem;
47015684 private MenuItem frontItem;
47025685 private MenuItem cameraItem;
47035686 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
5687
+ private MenuItem switchItem;
47055688 private MenuItem physicsItem;
47065689 private MenuItem frameselectorItem;
47075690 private MenuItem scriptNodeItem;
....@@ -4716,6 +5699,7 @@
47165699
47175700 private MenuItem resetParentItem;
47185701 private MenuItem repairParentItem;
5702
+ private MenuItem repairShadowItem;
47195703 private MenuItem sortbysizeItem;
47205704 private MenuItem sortbynameItem;
47215705
....@@ -4728,16 +5712,19 @@
47285712 private MenuItem particleItem;
47295713 private MenuItem ragdollItem;
47305714 private MenuItem ragdoll2Item;
5715
+ private MenuItem heightFieldItem;
5716
+ private MenuItem textureFieldItem;
47315717 private MenuItem gridItem;
47325718 private MenuItem rectoidItem;
47335719 private MenuItem ellipsoidItem;
47345720 private MenuItem coneItem;
47355721 private MenuItem torusItem;
47365722 private MenuItem superItem;
5723
+ private MenuItem kleinItem;
47375724 private MenuItem blobItem;
47385725 private MenuItem latheItem;
47395726 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
5727
+ private MenuItem overlayItem;
47415728 private MenuItem meshItem;
47425729 // private MenuItem meshGroupItem;
47435730 private MenuItem springItem;
....@@ -4746,6 +5733,7 @@
47465733 private MenuItem csgItem;
47475734 private MenuItem templateItem;
47485735 private MenuItem textureItem;
5736
+ private MenuItem billboardItem;
47495737 private MenuItem shadowXItem;
47505738 private MenuItem shadowYItem;
47515739 private MenuItem shadowZItem;
....@@ -4758,11 +5746,6 @@
47585746 private MenuItem doubleItem;
47595747 private MenuItem tripleItem;
47605748
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47665749 private MenuItem computeAOItem;
47675750 private MenuItem recompileItem;
47685751 private MenuItem editScriptItem;
....@@ -4772,4 +5755,8 @@
47725755 private MenuItem analyzeItem;
47735756 private MenuItem dumpItem;
47745757 //boolean freezemodel = false;
5758
+
5759
+ Menu cameraMenu;
5760
+ MenuItem editCameraItem;
5761
+ MenuItem restoreCameraItem;
47755762 }