Normand Briere
2019-07-17 a5580a47d246c1272b10adba68070f6e13da5e41
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,11 @@
8384
8485 void CloneSelection(boolean supports)
8586 {
86
- // Object3D keep = GraphreeD.clipboard;
87
+ if (Globals.REPLACEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.REPLACEONMAKE;
90
+ Globals.REPLACEONMAKE = false;
91
+ // Object3D keep = GrafreeD.clipboard;
8792 //Object3D obj;
8893 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
8994 {
....@@ -93,18 +98,19 @@
9398
9499 makeSomething(clone, i==group.selection.size()-1);
95100 }
101
+ Globals.REPLACEONMAKE = keep;
96102 }
97103
98104 void CloneClipboard(boolean supports)
99105 {
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));
106
+ assert(Grafreed.clipboard.parent == null);
107
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
108
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
109
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
110
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105111 else
106
- makeSomething(CloneObject(GraphreeD.clipboard, false));
107
- GraphreeD.clipboard.get(0).parent = keepparent;
112
+ makeSomething(CloneObject(Grafreed.clipboard, false));
113
+ Grafreed.clipboard.get(0).parent = keepparent;
108114 }
109115
110116 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +124,7 @@
118124 // obj.support = null;
119125 if (!supports)
120126 obj.SaveSupports();
121
- Object3D clone = (Object3D)GraphreeD.clone(obj);
127
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122128 obj.parent = parent;
123129 // obj.support = support;
124130 // clone.support = support; // aout 2013
....@@ -147,30 +153,29 @@
147153
148154 //JTextField nameField;
149155
150
- void SetupMenu2(ObjEditor oe)
156
+ void SetupMenu2(GroupEditor oe)
151157 {
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);
158
+ oe.jTree = new cTree();
159
+
163160 Menu menu;
164161 oe.menuBar.add(menu = new Menu("Edit"));
165162 //editItem = menu.add(new MenuItem("Edit"));
166163 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
164
+
165
+// undoItem = menu.add(new MenuItem("Undo"));
166
+// undoItem.addActionListener(this);
167
+// redoItem = menu.add(new MenuItem("Redo"));
168
+// redoItem.addActionListener(this);
169
+// menu.add("-");
170
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168171 duplicateItem.addActionListener(this);
169
- menu.add("-");
170172 cloneItem = menu.add(new MenuItem("Clone"));
171173 cloneItem.addActionListener(this);
174
+ if (Globals.ADVANCED)
175
+ {
172176 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173177 cloneSupportItem.addActionListener(this);
178
+ }
174179 menu.add("-");
175180 cutItem = menu.add(new MenuItem("Cut"));
176181 cutItem.addActionListener(this);
....@@ -178,26 +183,123 @@
178183 copyItem.addActionListener(this);
179184 pasteItem = menu.add(new MenuItem("Paste"));
180185 pasteItem.addActionListener(this);
186
+
187
+ menu.add("-");
188
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
189
+ pasteIntoItem.addActionListener(this);
181190 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182191 pasteLinkItem.addActionListener(this);
183192 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184193 pasteCloneItem.addActionListener(this);
185194 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186195 // pasteExpandItem.addActionListener(this);
196
+ menu.add("-");
187197 clearItem = menu.add(new MenuItem("Clear"));
188198 clearItem.addActionListener(this);
199
+
200
+ if (Globals.ADVANCED)
201
+ {
202
+ // Deletes the cameras...
189203 clearAllItem = menu.add(new MenuItem("Clear All"));
190204 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);
205
+ }
206
+
207
+ menuBar.add(cameraMenu = new Menu("View"));
208
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
209
+ //zBufferItem.addActionListener(this);
210
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
211
+ //normalLensItem.addActionListener(this);
212
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
213
+ restoreCameraItem.addActionListener(this);
214
+
215
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
216
+// toggleFullScreenItem.addItemListener(this);
217
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
218
+// cameraMenu.add("-");
219
+//
220
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
221
+// toggleTextureItem.addItemListener(this);
222
+// toggleTextureItem.setState(CameraPane.textureon);
223
+//
224
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
225
+// toggleSwitchItem.addItemListener(this);
226
+// toggleSwitchItem.setState(CameraPane.SWITCH);
227
+
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
229
+ toggleHandleItem.addItemListener(this);
230
+ toggleHandleItem.setState(CameraPane.HANDLES);
231
+
232
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
233
+ togglePaintItem.addItemListener(this);
234
+ togglePaintItem.setState(CameraPane.PAINTMODE);
235
+
236
+ if (Globals.ADVANCED)
237
+ {
238
+ cameraMenu.add("-");
239
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
240
+ toggleLiveItem.addItemListener(this);
241
+ toggleLiveItem.setState(Globals.isLIVE());
242
+
243
+ cameraMenu.add(stepItem = new MenuItem("Step"));
244
+ stepItem.addActionListener(this);
245
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
246
+ // toggleDLItem.addItemListener(this);
247
+ // toggleDLItem.setState(false);
248
+
249
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
250
+ toggleRenderItem.addItemListener(this);
251
+ toggleRenderItem.setState(!CameraPane.frozen);
252
+
253
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
254
+ toggleDebugItem.addItemListener(this);
255
+ toggleDebugItem.setState(Globals.DEBUG);
256
+
257
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
258
+ toggleFrustumItem.addItemListener(this);
259
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
260
+
261
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
262
+ toggleFootContactItem.addItemListener(this);
263
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
264
+
265
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
266
+ toggleTimelineItem.addItemListener(this);
267
+ }
268
+
269
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
270
+// toggleRootItem.addItemListener(this);
271
+// toggleRootItem.setState(false);
272
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
273
+// animationItem.addItemListener(this);
274
+// animationItem.setState(CameraPane.ANIMATION);
275
+ cameraMenu.add("-");
276
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
277
+ editCameraItem.addActionListener(this);
278
+
279
+ if (Globals.ADVANCED)
280
+ {
281
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
282
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
283
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
284
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
285
+ oe.cameraMenu.add("-");
286
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
287
+ openWindowItem.addActionListener(this);
288
+ editLeafItem.addActionListener(this);
289
+ lookAtItem.addActionListener(this);
290
+ //lookFromItem.addActinoListener(this);
291
+ //switchViewItem.addActionListener(this);
292
+ }
293
+
294
+ oe.menuBar.add(menu = new Menu("Setting"));
295
+ if (Globals.ADVANCED)
296
+ {
196297 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
197298 revertMeshItem.addActionListener(this);
198299 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
199300 resetreferencesItem.addActionListener(this);
200301 menu.add("-");
302
+ }
201303 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
202304 overwriteGeoItem.addActionListener(this);
203305 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -209,72 +311,104 @@
209311 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
210312 overwriteUVItem.addActionListener(this);
211313 menu.add("-");
314
+ if (Globals.ADVANCED)
315
+ {
212316 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
213317 generateMeshItem.addActionListener(this);
214318 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
215319 poseMeshItem.addActionListener(this);
216320 menu.add("-");
321
+ }
217322 resetsupportItem = menu.add(new MenuItem("Reset support"));
218323 resetsupportItem.addActionListener(this);
219324 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220325 linkverticesItem.addActionListener(this);
326
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
327
+ relinkverticesItem.addActionListener(this);
328
+
329
+ if (Globals.ADVANCED)
330
+ {
221331 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222332 setMasterItem.addActionListener(this);
333
+ }
223334
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);
335
+ oe.menuBar.add(menu = new Menu("Group"));
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
229338 backItem = menu.add(new MenuItem("Back"));
230339 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);
340
+ frontItem = menu.add(new MenuItem("Front"));
341
+ frontItem.addActionListener(this);
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
344
+
345
+ if (Globals.ADVANCED)
346
+ {
347
+ hideItem = menu.add(new MenuItem("Hidden Group"));
348
+ hideItem.addActionListener(this);
349
+ }
350
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
351
+ ungroupItem.addActionListener(this);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
240359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
241360 switchGeoItem.addActionListener(this);
242361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
243362 switchTransfoItem.addActionListener(this);
244
- morphItem = menu.add(new MenuItem("Morph"));
363
+ morphItem = menu.add(new MenuItem("Morph Group"));
245364 morphItem.addActionListener(this);
365
+
366
+ menu.add("-");
367
+ physicsItem = menu.add(new MenuItem("Physics"));
368
+ physicsItem.addActionListener(this);
369
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
370
+ frameselectorItem.addActionListener(this);
246371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
247372 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);
373
+ }
374
+
375
+ oe.menuBar.add(menu = new Menu("Object"));
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
378
+ billboardItem = menu.add(new MenuItem("Billboard"));
379
+ billboardItem.addActionListener(this);
253380 csgItem = menu.add(new MenuItem("CSG"));
254381 csgItem.addActionListener(this);
255
- shadowXItem = menu.add(new MenuItem("Shadow X"));
382
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
256383 shadowXItem.addActionListener(this);
257
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
384
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
258385 shadowYItem.addActionListener(this);
259
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
386
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
260387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
391
+ if (Globals.ADVANCED)
392
+ {
393
+ menu.add("-");
261394 linkerItem = menu.add(new MenuItem("Linker"));
262395 linkerItem.addActionListener(this);
263396 templateItem = menu.add(new MenuItem("Template"));
264397 templateItem.addActionListener(this);
265
- attributeItem = menu.add(new MenuItem("Attribute"));
266
- attributeItem.addActionListener(this);
267398 pointflowItem = menu.add(new MenuItem("Point Flow"));
268399 pointflowItem.addActionListener(this);
400
+ }
269401 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272402 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273403 resetTransformItem.addActionListener(this);
274404 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275405 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
406
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
407
+ resetCentroidXZItem.addActionListener(this);
408
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
409
+ transformGeometryItem.addActionListener(this);
410
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
411
+ transformChildrenItem.addActionListener(this);
278412
279413 oe.menuBar.add(menu = new Menu("Geometry"));
280414 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +417,13 @@
283417 genNormalsORGANItem.addActionListener(this);
284418 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285419 genNormalsCADItem.addActionListener(this);
420
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
421
+ genNormalsMESHItem.addActionListener(this);
422
+ if (Globals.ADVANCED)
423
+ {
424
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
425
+ genNormalsMINEItem.addActionListener(this);
426
+ }
286427 stripifyItem = menu.add(new MenuItem("Stripify"));
287428 stripifyItem.addActionListener(this);
288429 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +433,6 @@
292433 untrimItem = menu.add(new MenuItem("Untrim"));
293434 untrimItem.addActionListener(this);
294435 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297436 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298437 clearColorsItem.addActionListener(this);
299438 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -306,19 +445,34 @@
306445 reduce34MeshItem.addActionListener(this);
307446 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308447 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311448 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312449 clipMeshItem.addActionListener(this);
450
+
451
+ if (Globals.ADVANCED)
452
+ {
453
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
454
+ smoothMeshItem.addActionListener(this);
455
+ }
456
+
457
+ oe.menuBar.add(menu = new Menu("Attributes"));
458
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
459
+ clearMaterialsItem.addActionListener(this);
460
+ resetAllItem = menu.add(new MenuItem("Reset All"));
461
+ resetAllItem.addActionListener(this);
462
+ stepAllItem = menu.add(new MenuItem("Step All"));
463
+ stepAllItem.addActionListener(this);
313464 menu.add("-");
314465 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315466 liveleavesItem.addActionListener(this);
316467 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
317468 unliveleavesItem.addActionListener(this);
469
+ if (Globals.ADVANCED)
470
+ {
318471 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
319472 supportleavesItem.addActionListener(this);
320473 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
321474 unsupportleavesItem.addActionListener(this);
475
+ }
322476 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
323477 hideleavesItem.addActionListener(this);
324478 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -327,32 +481,31 @@
327481 markleavesItem.addActionListener(this);
328482 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
329483 unmarkleavesItem.addActionListener(this);
484
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
485
+ rewindleavesItem.addActionListener(this);
486
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
487
+ unrewindleavesItem.addActionListener(this);
488
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
489
+ randomleavesItem.addActionListener(this);
490
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
491
+ unrandomleavesItem.addActionListener(this);
330492 menu.add("-");
331493 flipVItem = menu.add(new MenuItem("Flip V"));
332494 flipVItem.addActionListener(this);
333495 unflipVItem = menu.add(new MenuItem("Unflip V"));
334496 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
497
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336498 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
499
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338500 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
501
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340502 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
503
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342504 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
505
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344506 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
507
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346508 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);
356509
357510 oe.menuBar.add(menu = new Menu("Selection"));
358511 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -370,14 +523,42 @@
370523 sortbysizeItem.addActionListener(this);
371524 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372525 sortbynameItem.addActionListener(this);
526
+ menu.add("-");
527
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
528
+ shareGeometriesItem.addActionListener(this);
529
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
530
+ mergeGeometriesItem.addActionListener(this);
531
+ if (Globals.ADVANCED)
532
+ {
533
+ // Pretty much the same as duplicate and clone.
534
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
535
+ extractGeometriesItem.addActionListener(this);
536
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
537
+ cloneGeometriesItem.addActionListener(this);
538
+ }
539
+
373540 oe.menuBar.add(menu = new Menu("Insert"));
374541 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
542
+
543
+ oe.menuBar.add(menu = new Menu("Tools"));
376544 buildToolsMenu(menu);
377545 }
378546
547
+
379548 void SetupUI2(ObjEditor oe)
380549 {
550
+ // June 2019
551
+ if (oe == null)
552
+ {
553
+ //super.SetupUI2(this);
554
+ //return;
555
+ }
556
+
557
+ if (copy != group)
558
+ {
559
+ //super.SetupUI2(this);
560
+ }
561
+
381562 //new Exception().printStackTrace();
382563
383564 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -406,150 +587,230 @@
406587 oe.radioPanel.add(dummyButton);
407588 oe.buttonGroup.add(dummyButton);
408589 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
590
+ cGridBag copyOptionsPanel = new cGridBag();
591
+
592
+ copyOptionsPanel.preferredHeight = 1;
412593
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
594
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
595
+
596
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ //minButton.setToolTipText("Minimize window");
598
+ //minButton.addActionListener(this);
599
+
600
+ if (Globals.ADVANCED)
601
+ {
602
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
+ maxButton.setToolTipText("Maximize window");
604
+ maxButton.addActionListener(this);
605
+ }
606
+
607
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ fullButton.setToolTipText("Full-screen window");
609
+ fullButton.addActionListener(this);
610
+
611
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ screenfitButton.setToolTipText("Screen fit");
613
+ screenfitButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ restoreCameraButton.setToolTipText("Restore viewpoint");
617
+ restoreCameraButton.addActionListener(this);
618
+
619
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ saveButton.setToolTipText("New version");
621
+ saveButton.addActionListener(this);
622
+
623
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ undoButton.setToolTipText("Previous version");
625
+ undoButton.addActionListener(this);
626
+ undoButton.setEnabled(false);
627
+
628
+ cGridBag updown = new cGridBag().setVertical(true);
629
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreButton.setToolTipText("Restore current");
631
+ restoreButton.addActionListener(this);
632
+ restoreButton.setEnabled(false);
633
+
634
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ replaceButton.setToolTipText("Replace current");
636
+ replaceButton.addActionListener(this);
637
+ replaceButton.setEnabled(false);
638
+
639
+ copyOptionsPanel.add(updown);
640
+
641
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ redoButton.setToolTipText("Next version");
643
+ redoButton.addActionListener(this);
644
+ redoButton.setEnabled(false);
645
+
646
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
647
+ liveCB.setToolTipText("Enable animation");
414648 liveCB.addItemListener(this);
415649
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);
650
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
651
+ oneStepButton.setToolTipText("Animate one step forward");
652
+ oneStepButton.addActionListener(this);
653
+
654
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
655
+ fastCB.setToolTipText("Fast mode");
434656 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);
657
+
658
+ //oe.toolboxPanel.Return();
659
+
660
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
661
+// trackCB.setToolTipText("Enable tracking");
662
+// trackCB.addItemListener(this);
441663
442
-// oe.aConstraints.gridx += 1;
443
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
444
-// speakerMocapCB.addItemListener(this);
445
-
446
- if (false)
447
- {
448
- // handled in scripts
449
- oe.aConstraints.gridx += 1;
450
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
451
- speakerCameraCB.addItemListener(this);
452
-
453
- oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
455
- speakerFocusCB.addItemListener(this);
456
-
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
459
- smoothfocusCB.addItemListener(this);
460
- }
461
-
462
-//oe.aConstraints.gridx += 1;
463
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
464
-// debugCB.addItemListener(this);
465
-
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
468
- oeilCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
472
- lookAtCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
476
- trackCB.addItemListener(this);
477
-
478
- oe.aConstraints.gridx += 1;
479
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
480
- screenfitButton.addActionListener(this);
481
- oe.aConstraints.gridx += 1;
482664 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
483665 // 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;
488666
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;
667
+ if (Globals.ADVANCED)
668
+ {
669
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
+ snapobjectButton.addActionListener(this);
671
+ snapobjectButton.setToolTipText("Snap Object");
672
+ }
673
+
674
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
499675
500
- //
501
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
677
+ twoButton.setToolTipText("Show center view only");
502678 twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
679
+ this.fullscreenLayout = twoButton;
680
+
681
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504682 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
683
+ fourButton.setToolTipText("Show left panel only");
684
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
685
+ sixButton.setToolTipText("2-column layout left");
506686 sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
687
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ threeButton.setToolTipText("2-column layout right");
508689 threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
691
+ sevenButton.setToolTipText("3-column layout");
510692 sevenButton.addActionListener(this);
511693 //
512694
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
695
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696
+ rootButton.setToolTipText("Edit selection in new tab");
514697 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
698
+
699
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ closeButton.setToolTipText("Close tab");
517701 closeButton.addActionListener(this);
518702 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
519703 //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;
528704
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
705
+ // INSERT
706
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707
+ gridButton.setToolTipText("Create grid");
708
+ gridButton.addActionListener(this);
709
+
710
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ boxButton.setToolTipText("Create box");
712
+ boxButton.addActionListener(this);
713
+
714
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ sphereButton.setToolTipText("Create sphere");
716
+ sphereButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ coneButton.setToolTipText("Create cone");
720
+ coneButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ torusButton.setToolTipText("Create torus");
724
+ torusButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ superButton.setToolTipText("Create superellipsoid");
728
+ superButton.addActionListener(this);
729
+
730
+ if (Globals.ADVANCED)
731
+ {
732
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ kleinButton.setToolTipText("Create Klein bottle");
734
+ kleinButton.addActionListener(this);
735
+ }
736
+
737
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ particlesButton.setToolTipText("Create particle system");
739
+ particlesButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.Return();
742
+
743
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ groupButton.setToolTipText("Create group");
745
+ groupButton.addActionListener(this);
746
+
747
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ compositeButton.setToolTipText("Create composite");
749
+ compositeButton.addActionListener(this);
750
+
751
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
+ switchButton.setToolTipText("Create item switcher");
753
+ switchButton.addActionListener(this);
754
+
755
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ loopButton.setToolTipText("Create loop");
757
+ loopButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ textureButton.setToolTipText("Create texture");
761
+ textureButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ overlayButton.setToolTipText("Create overlay");
765
+ overlayButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ lightButton.setToolTipText("Create light");
769
+ lightButton.addActionListener(this);
770
+
771
+ for (int i=6; --i>=0;)
772
+ {
773
+ oe.toolboxPanel.Return();
774
+ oe.toolboxPanel.add(new cGridBag());
775
+ oe.toolboxPanel.add(new cGridBag());
776
+ oe.toolboxPanel.add(new cGridBag());
777
+ oe.toolboxPanel.add(new cGridBag());
778
+ oe.toolboxPanel.add(new cGridBag());
779
+ oe.toolboxPanel.add(new cGridBag());
780
+ oe.toolboxPanel.add(new cGridBag());
781
+ }
782
+
783
+ // EDIT panel
784
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ editButton.setToolTipText("Pin selection controls");
786
+ editButton.addActionListener(this);
787
+
788
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
789
+ uneditButton.setToolTipText("Remove selection controls");
530790 uneditButton.addActionListener(this);
531791
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);
792
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
793
+ allParamsButton.setToolTipText("Show all controle");
544794 allParamsButton.addActionListener(this);
545795
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);
796
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ clearPanelButton.setToolTipText("Clear edit panel");
798
+ clearPanelButton.addActionListener(this);
799
+
800
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ unselectButton.setToolTipText("Unselect");
551802 unselectButton.addActionListener(this);
552803
804
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ flashSelectionButton.setToolTipText("Highlight selection");
806
+ flashSelectionButton.addActionListener(this);
807
+
808
+ editCommandsPanel.preferredHeight = 1;
809
+
810
+ SetPinStates(false);
811
+// oe.treePanel.add(commandsPanel);
812
+// oe.treePanel.Return();
813
+
553814 // oe.aConstraints.gridx += 1;
554815 // oe.aConstraints.weighty = 0;
555816 // oe.aConstraints.gridwidth = 1;
....@@ -561,40 +822,25 @@
561822 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
562823 // gcButton.addActionListener(this);
563824
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;
825
+ cGridBag jSPPanel = new cGridBag();
826
+
827
+ JScrollPane jSP;
575828 //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);
829
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
577830 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;
597831
832
+ oe.treePanel.add(jSPPanel);
833
+ oe.treePanel.Return();
834
+
835
+ oe.treePanel.add(copyOptionsPanel);
836
+ oe.treePanel.Return();
837
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
+ versionField = (cNumberSlider)sliderPane.getComponent(1);
839
+ sliderPane.preferredHeight = 1;
840
+
841
+// mainPanel.setDividerLocation(0.5); //1.0);
842
+// mainPanel.setResizeWeight(0.5);
843
+
598844 //jList.addListSelectionListener(this);
599845 oe.jTree.addTreeSelectionListener(this);
600846 //jTree.setRootVisible(false);
....@@ -616,20 +862,157 @@
616862 radio.layout = sevenButton;
617863 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
618864 }
865
+
866
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
867
+ {
868
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
869
+ colorCB.setToolTipText("Copy color when dropped");
870
+ colorCB.addItemListener(this);
871
+
872
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
873
+ materialCB.setToolTipText("Copy material when dropped");
874
+ materialCB.addItemListener(this);
875
+
876
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
877
+ textureCB.setToolTipText("Copy texture when dropped");
878
+ textureCB.addItemListener(this);
879
+
880
+ panel.Return();
881
+
882
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
883
+ boxCB.setToolTipText("Display bounding boxes");
884
+ boxCB.addItemListener(this);
885
+
886
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
887
+ zoomBoxCB.setToolTipText("Display only for wheel");
888
+ zoomBoxCB.addItemListener(this);
889
+
890
+ if (true) // Globals.ADVANCED)
891
+ {
892
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
893
+// supportCB.setToolTipText("Enable rigging");
894
+// supportCB.addItemListener(this);
895
+
896
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
897
+ freezeCB.setToolTipText("Fast moving camera");
898
+ freezeCB.addItemListener(this);
899
+
900
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
901
+ // localCB.addItemListener(this);
902
+
903
+ panel.Return();
904
+
905
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
906
+ crowdCB.setToolTipText("Used for crowds");
907
+ crowdCB.addItemListener(this);
908
+
909
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
910
+ smoothCB.setToolTipText("Snapping delay");
911
+ smoothCB.addItemListener(this);
912
+
913
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
914
+ slowCB.setToolTipText("Smooth interpolation");
915
+ slowCB.addItemListener(this);
916
+
917
+// constraints.gridy += 1;
918
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
919
+// speakerMocapCB.addItemListener(this);
920
+
921
+ panel.Return();
922
+
923
+ if (false)
924
+ {
925
+ // handled in scripts
926
+ //constraints.gridy += 1;
927
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
928
+ speakerCameraCB.addItemListener(this);
929
+
930
+ //constraints.gridy += 1;
931
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
932
+ speakerFocusCB.addItemListener(this);
933
+
934
+ //constraints.gridy += 1;
935
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
936
+ smoothfocusCB.addItemListener(this);
937
+ panel.Return();
938
+ }
939
+
940
+//constraints.gridx += 1;
941
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
942
+// debugCB.addItemListener(this);
943
+
944
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
945
+ trackCB.setToolTipText("Enable tracking target");
946
+ trackCB.addItemListener(this);
947
+
948
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
949
+ oeilCB.setToolTipText("Move camera when tracking");
950
+ oeilCB.addItemListener(this);
951
+
952
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
953
+ shadowCB.setToolTipText("When live compute shadows");
954
+ shadowCB.addItemListener(this);
955
+
956
+ panel.Return();
957
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
958
+ toggleTextureCB.setToolTipText("Load textures");
959
+ toggleTextureCB.addItemListener(this);
960
+
961
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
962
+ toggleSwitchCB.setToolTipText("Choose a single item");
963
+ toggleSwitchCB.addItemListener(this);
964
+
965
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
966
+ autokeepCB.setToolTipText("On structure change");
967
+ autokeepCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ if (Globals.ADVANCED)
971
+ {
972
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
973
+ lookAtCB.setToolTipText("Look-at target");
974
+ lookAtCB.addItemListener(this);
975
+ }
976
+
977
+ }
978
+
979
+ cGridBag fill = new cGridBag();
980
+ fill.preferredHeight = 200;
981
+ cGridBag fill2 = new cGridBag();
982
+ fill2.preferredHeight = 200;
983
+ cGridBag fill3 = new cGridBag();
984
+ fill3.preferredHeight = 200;
985
+
986
+ panel.add(fill);
987
+ panel.add(fill2);
988
+ panel.add(fill3);
989
+
990
+ }
619991
620992 void EditObject(Object3D obj)
621993 {
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();
994
+ cRadio radioButton = new cRadio(obj.name);
995
+
996
+ // June 2019. Patch to avoid bug with transparency.
997
+ radioButton.hadMaterial = obj.material != null;
998
+ if (!radioButton.hadMaterial)
999
+ {
1000
+ obj.material = new cMaterial();
1001
+ }
1002
+
1003
+ radioButton.SetObject(obj);
1004
+ radioButton.layout = sevenButton;
1005
+ radioButton.SetCamera(cameraView.renderCamera, false);
1006
+ radioButton.addActionListener(this);
1007
+ radioPanel.add(radioButton);
1008
+ buttonGroup.add(radioButton);
1009
+ radioButton.doClick();
6301010 }
1011
+
6311012 void SetupViews(ObjEditor oe)
6321013 {
1014
+ theFrame = this;
1015
+
6331016 oe.SetupViews();
6341017
6351018 System.out.println("SetupViews");
....@@ -638,22 +1021,28 @@
6381021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6391022 }
6401023
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;
1024
+ cToggleButton liveCB;
1025
+ cCheckBox supportCB;
1026
+ cCheckBox localCB;
1027
+ cCheckBox crowdCB;
1028
+ cCheckBox smoothCB;
1029
+ cToggleButton fastCB;
1030
+ cCheckBox slowCB;
1031
+ cCheckBox boxCB;
1032
+ cCheckBox zoomBoxCB;
1033
+ cCheckBox freezeCB;
1034
+ //cToggleButton trackCB;
1035
+ cCheckBox trackCB;
1036
+ cCheckBox smoothfocusCB;
6511037 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
1038
+ cCheckBox speakerCameraCB;
1039
+ cCheckBox speakerFocusCB;
1040
+ cCheckBox debugCB;
1041
+
1042
+ cCheckBox oeilCB;
1043
+ cCheckBox shadowCB;
1044
+ cCheckBox autokeepCB;
1045
+ cCheckBox lookAtCB;
6571046
6581047 // static int COLOR = 1;
6591048 // static int MATERIAL = 2;
....@@ -661,9 +1050,9 @@
6611050
6621051 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6631052
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
1053
+ cCheckBox colorCB;
1054
+ cCheckBox materialCB;
1055
+ cCheckBox textureCB;
6671056
6681057 public void itemStateChanged(ItemEvent e)
6691058 {
....@@ -688,10 +1077,10 @@
6881077 dropAttributes |= Object3D.TEXTURE;
6891078 else
6901079 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
1080
+ } else if(e.getSource() == liveCB)
6931081 {
6941082 cameraView.ToggleLive();
1083
+ refreshContents(false);
6951084 }
6961085 else if(e.getSource() == supportCB)
6971086 {
....@@ -727,6 +1116,10 @@
7271116 cameraView.repaint();
7281117 // refreshContents();
7291118 }
1119
+ else if(e.getSource() == zoomBoxCB)
1120
+ {
1121
+ cameraView.ToggleZoomBoxMode();
1122
+ }
7301123 else if(e.getSource() == smoothfocusCB)
7311124 {
7321125 cameraView.ToggleSmoothFocus();
....@@ -752,6 +1145,18 @@
7521145 {
7531146 cameraView.ToggleOeil();
7541147 }
1148
+ else if(e.getSource() == shadowCB)
1149
+ {
1150
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1151
+ }
1152
+ else if(e.getSource() == freezeCB)
1153
+ {
1154
+ Globals.FREEZEONMOVE ^= true;
1155
+ }
1156
+ else if(e.getSource() == autokeepCB)
1157
+ {
1158
+ Globals.REPLACEONMAKE ^= true;
1159
+ }
7551160 else if(e.getSource() == lookAtCB)
7561161 {
7571162 cameraView.ToggleLookAt();
....@@ -768,7 +1173,8 @@
7681173
7691174 /**/
7701175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
771
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
7721178 if ((path == null) || (path.getPathCount() <= 1)) {
7731179 // We can't move the root node or an empty selection
7741180 return;
....@@ -831,8 +1237,6 @@
8311237 }
8321238 }
8331239
834
- String string = (String) object;
835
-
8361240 System.out.println("Transfer = " + object + "; drop : " + target);
8371241 // if( object instanceof java.io.File[])
8381242 // {
....@@ -840,7 +1244,11 @@
8401244 // objEditor.DropFile((java.io.File[]) object, true);
8411245 // return;
8421246 // }
843
- if (string.charAt(0) == '/')
1247
+
1248
+ String string = object.toString();
1249
+
1250
+ // File path for Mac and Windows
1251
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441252 {
8451253 // file(s)
8461254 String[] names = string.split("\n");
....@@ -867,7 +1275,7 @@
8671275
8681276 flashIt = false;
8691277 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1278
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711279 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721280
8731281 if (group.selection.size() == 1)
....@@ -883,23 +1291,33 @@
8831291
8841292 assert target == objEditor.jTree;
8851293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
8861295 try {
887
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
8881297 } catch (Exception e) {
8891298 System.out.println("destinationPath : " + destinationPath);
8901299 return;
8911300 }
8921301
893
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
8941303 {
1304
+ Object3D child = (Object3D)group.selection.elementAt(i);
1305
+
1306
+ // Cannot move into itself
1307
+ if (child == destinationLeaf)
1308
+ return;
1309
+ }
1310
+
1311
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1312
+// {
8951313 loadClipboard(true);
8961314 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
898
- } else {
899
- loadClipboard(false);
900
- objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
902
- }
1315
+ pasteInto(false, false);
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
9031321 }
9041322 public void dropActionChanged(DropTargetDragEvent dtde)
9051323 // Called if the user has modified the current drop gesture
....@@ -1002,90 +1420,109 @@
10021420
10031421 void buildCreateMenu(Menu menu)
10041422 {
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);
1423
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1424
+ //heightFieldItem.addActionListener(this);
1425
+// gridItem = menu.add(new MenuItem("Grid"));
1426
+// gridItem.addActionListener(this);
1427
+// rectoidItem = menu.add(new MenuItem("Box"));
1428
+// rectoidItem.addActionListener(this);
1429
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1430
+// ellipsoidItem.addActionListener(this);
1431
+// coneItem = menu.add(new MenuItem("Cone"));
1432
+// coneItem.addActionListener(this);
1433
+// torusItem = menu.add(new MenuItem("Torus"));
1434
+// torusItem.addActionListener(this);
1435
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1436
+// superItem.addActionListener(this);
1437
+
1438
+ cameraItem = menu.add(new MenuItem("Camera"));
1439
+ cameraItem.addActionListener(this);
1440
+
1441
+ if (!Globals.ADVANCED)
1442
+ {
1443
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1444
+ kleinItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
1449
+ if (Globals.ADVANCED)
1450
+ {
10191451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201452 ragdollItem.addActionListener(this);
10211453 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221454 ragdoll2Item.addActionListener(this);
1455
+ }
10231456 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1457
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251458 meshItem.addActionListener(this);
10261459 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271460 // meshGroupItem.addActionListener(this);
1461
+ if (Globals.ADVANCED)
1462
+ {
10281463 springItem = menu.add(new MenuItem("Spring"));
10291464 springItem.addActionListener(this);
10301465 flagItem = menu.add(new MenuItem("Flag"));
10311466 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);
10361467 blobItem = menu.add(new MenuItem("Blob"));
10371468 blobItem.addActionListener(this);
10381469 latheItem = menu.add(new MenuItem("Lathe"));
10391470 latheItem.addActionListener(this);
1040
- lightItem = menu.add(new MenuItem("Light"));
1041
- lightItem.addActionListener(this);
1471
+ }
1472
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1473
+ bezierItem.addActionListener(this);
1474
+// overlayItem = menu.add(new MenuItem("Overlay"));
1475
+// overlayItem.addActionListener(this);
1476
+// lightItem = menu.add(new MenuItem("Light"));
1477
+// lightItem.addActionListener(this);
10421478 menu.add("-");
10431479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10441480 //superLoopItem.addActionListener(this);
1045
- loopItem = menu.add(new MenuItem("Loop"));
1046
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
10471483 doubleItem = menu.add(new MenuItem("Fork"));
10481484 doubleItem.addActionListener(this);
1485
+ if (Globals.ADVANCED)
1486
+ {
10491487 tripleItem = menu.add(new MenuItem("Trident"));
10501488 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);
1489
+ }
10601490 }
10611491
10621492 void buildToolsMenu(Menu menu)
10631493 {
10641494 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651495 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1496
+ animationItem.setState(Globals.ANIMATION);
1497
+
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
10671500
10681501 menu.add("-");
10691502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701503 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1504
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1505
+ textureFieldItem.addActionListener(this);
1506
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721507 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751508 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761509 reduceMorphItem.addActionListener(this);
10771510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781511 reduce34MorphItem.addActionListener(this);
1079
-
1080
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1081
- computeAOItem.addActionListener(this);
10821512 menu.add("-");
1083
-
10841513 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851514 memoryItem.addActionListener(this);
1515
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1516
+ computeAOItem.addActionListener(this);
1517
+
1518
+ if (Globals.ADVANCED)
1519
+ {
1520
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1521
+ mirrorItem.addActionListener(this);
1522
+ menu.add("-");
10861523 menu.add(analyzeItem = new MenuItem("Analyze"));
10871524 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
1525
+ menu.add(dumpItem = new MenuItem("Print"));
10891526 dumpItem.addActionListener(this);
10901527 // menu.add(pathItem = new MenuItem("From-to path"));
10911528 // pathItem.addActionListener(this);
....@@ -1094,6 +1531,8 @@
10941531 resetParentItem.addActionListener(this);
10951532 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961533 repairParentItem.addActionListener(this);
1534
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1535
+ repairShadowItem.addActionListener(this);
10971536 menu.add(invariantsItem = new MenuItem("Invariants"));
10981537 invariantsItem.addActionListener(this);
10991538 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1540,7 @@
11011540 menu.add("-");
11021541 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031542 editScriptItem.addActionListener(this);
1543
+ }
11041544 }
11051545
11061546 void ScreenFit()
....@@ -1223,9 +1663,24 @@
12231663 shadow.material = new cMaterial(obj.material);
12241664 shadow.material.diffuse = 0.0001f;
12251665 shadow.material.specular = 0.0001f;
1666
+ //shadow.projectedVertices[1].x = 300;
12261667
12271668 makeSomething(shadow);
12281669 }
1670
+
1671
+ private void ClearUnpinned()
1672
+ {
1673
+ //for (Object3D obj : listUI)
1674
+ for (int i=listUI.size(); --i>=0;)
1675
+ {
1676
+ Object3D obj = listUI.elementAt(i);
1677
+ if (!obj.pinned)
1678
+ {
1679
+ obj.CloseUI();
1680
+ listUI.remove(i);
1681
+ }
1682
+ }
1683
+ }
12291684
12301685 /**
12311686 * applyExample
....@@ -1429,9 +1884,9 @@
14291884
14301885 void Overwrite(int mask)
14311886 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1887
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14331888 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1889
+ Object3D content = Grafreed.clipboard.get(0);
14351890
14361891 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371892 content = ((cGroup)content).get(0);
....@@ -1454,6 +1909,7 @@
14541909 //
14551910 public void actionPerformed(ActionEvent event) // , Object arg)
14561911 {
1912
+ Object source = event.getSource();
14571913 /*
14581914 if (event.getSource() == nameField)
14591915 {
....@@ -1465,11 +1921,11 @@
14651921 }
14661922 else
14671923 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1924
+ if (source == lookAtItem || source == lookFromItem)
14691925 {
14701926 ScreenFit();
14711927 } else
1472
- if (event.getSource() == switchItem)
1928
+ if (source == switchViewItem)
14731929 {
14741930 cVector v1 = new cVector();
14751931 cVector v2 = new cVector();
....@@ -1478,11 +1934,11 @@
14781934 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791935 objEditor.cameraView.repaint();
14801936 } else
1481
- if (event.getSource() == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
14821938 {
14831939 makeSomething(new Box());
14841940 } else
1485
- if (event.getSource() == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
14861942 {
14871943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1959,9 @@
15031959 applyExample(particleGeom, "SMOKE");
15041960 makeSomething(particleGeom);
15051961 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1962
+ if (source == ragdollItem || source == ragdoll2Item)
15071963 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1964
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091965
15101966 ragdoll.toParent = LA.newMatrix();
15111967 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +1977,71 @@
15211977 makeSomething(ragdoll);
15221978 //makeSomething(new VehicleDemo());
15231979 } else
1524
- if (event.getSource() == gridItem)
1980
+ /*
1981
+ */
1982
+ if (source == heightFieldItem)
1983
+ {
1984
+ Object3D obj = new Object3D();
1985
+
1986
+ obj.CreateMaterial();
1987
+ obj.bRep = new BoundaryRep();
1988
+
1989
+ obj.bRep.CreateMesh(new iHeightField()
1990
+ {
1991
+ public double f(double x, double y)
1992
+ {
1993
+ // The Mandelbrot set is represented by coloring
1994
+ // each point (x,y) according to the number of
1995
+ // iterations it takes before the while loop in
1996
+ // this method ends. For points that are actually
1997
+ // in the Mandelbrot set, or very close to it, the
1998
+ // count will reach the maximum value, 80. These
1999
+ // points will be colored purple. All other colors
2000
+ // represent points that are definitely NOT in the set.
2001
+ x -= 600;
2002
+ y -= 500;
2003
+ x /= 200;
2004
+ y /= 200;
2005
+ int count = 0;
2006
+ double zx = x;
2007
+ double zy = y;
2008
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
2009
+ double new_zx = zx*zx - zy*zy + x;
2010
+ zy = 2*zx*zy + y;
2011
+ zx = new_zx;
2012
+ count++;
2013
+ }
2014
+ return count; // Math.sqrt(count);
2015
+ }
2016
+ }, 1000,1000);
2017
+
2018
+ makeSomething(obj);
2019
+ } else
2020
+ if (source == gridItem || source == gridButton)
15252021 {
15262022 makeSomething(new Grid());
15272023 } else
1528
- if (event.getSource() == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
15292025 {
15302026 makeSomething(new Sphere());
15312027 } else
1532
- if (event.getSource() == coneItem)
2028
+ if (source == coneItem || source == coneButton)
15332029 {
15342030 makeSomething(new Cone());
15352031 } else
1536
- if (event.getSource() == torusItem)
2032
+ if (source == torusItem || source == torusButton)
15372033 {
15382034 makeSomething(new Torus());
15392035 } else
1540
- if (event.getSource() == superItem)
2036
+ if (source == superItem || source == superButton)
15412037 {
15422038 makeSomething(new Superellipsoid());
15432039 } else
1544
- if (event.getSource() == blobItem)
2040
+ if (source == kleinItem || source == kleinButton)
2041
+ {
2042
+ makeSomething(new Klein());
2043
+ } else
2044
+ if (source == blobItem)
15452045 {
15462046 Blob blob = new Blob();
15472047 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2049,15 @@
15492049 //blob.retile();
15502050 makeSomething(blob);
15512051 } else
1552
- if (event.getSource() == latheItem)
2052
+ if (source == latheItem)
15532053 {
15542054 makeSomething(new Lathe());
15552055 } else
1556
- if (event.getSource() == bezierItem)
2056
+ if (source == bezierItem)
15572057 {
15582058 makeSomething(new BezierSurface());
15592059 } else
1560
- if (event.getSource() == checkerItem)
2060
+ if (source == overlayItem || source == overlayButton)
15612061 {
15622062 /*
15632063 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2070,9 @@
15702070 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712071 LA.matInvert(obj.toParent, obj.fromParent);
15722072 */
1573
- makeSomething(new CheckerIG());
2073
+ makeSomething(new Checker());
15742074 } else
1575
- if (event.getSource() == meshItem)
2075
+ if (source == meshItem)
15762076 {
15772077 Object3D itemtomake = new Object3D();
15782078 Object3D child;
....@@ -1593,35 +2093,35 @@
15932093 makeSomething(child);
15942094 }
15952095 } else
1596
- if (event.getSource() == springItem)
2096
+ if (source == springItem)
15972097 {
15982098 cSpring s = new cSpring();
15992099 s.setup();
16002100 makeSomething(s);
16012101 } else
1602
- if (event.getSource() == flagItem)
2102
+ if (source == flagItem)
16032103 {
16042104 cSpring s = new cFlag();
16052105 s.setup();
16062106 makeSomething(s);
16072107 } else
1608
- if (event.getSource() == lightItem)
2108
+ if (source == lightItem || source == lightButton)
16092109 {
16102110 makeSomething(new Light());
16112111 } else
1612
- if (event.getSource() == csgItem)
2112
+ if (source == csgItem)
16132113 {
16142114 group(new CSG());
16152115 } else
1616
- if (event.getSource() == templateItem)
2116
+ if (source == templateItem)
16172117 {
16182118 group(new cTemplate());
16192119 } else
1620
- if (event.getSource() == attributeItem)
2120
+ if (source == attributeItem)
16212121 {
16222122 makeSomething(new Attribute());
16232123 } else
1624
- if (event.getSource() == pointflowItem)
2124
+ if (source == pointflowItem)
16252125 {
16262126 makeSomething(new PointFlow());
16272127 } else
....@@ -1633,7 +2133,7 @@
16332133 } else
16342134 */
16352135
1636
- if (event.getSource() == superLoopItem)
2136
+ if (source == superLoopItem)
16372137 {
16382138 Composite g = new cGroup();
16392139 for (int i=0; i<15; i++)
....@@ -1655,30 +2155,30 @@
16552155
16562156 group(g);
16572157 } else
1658
- if (event.getSource() == loopItem)
2158
+ if (source == loopItem || source == loopButton)
16592159 {
16602160 Composite csg = new GroupLeaf();
16612161 csg.count = 5;
16622162 group(csg);
1663
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
16642164 csg.addChild(child);
16652165 child.addChild(csg);
16662166 } else
1667
- if (event.getSource() == doubleItem)
2167
+ if (source == doubleItem)
16682168 {
1669
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
16702170 csg.count = 5;
16712171 group(csg);
1672
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
16732173 csg.addChild(child);
16742174 child.addChild(csg);
1675
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
16762176 csg.addChild(child);
16772177 child.addChild(csg);
16782178 } else
1679
- if (event.getSource() == tripleItem)
2179
+ if (source == tripleItem)
16802180 {
1681
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
16822182 csg.count = 4;
16832183 group(csg);
16842184 Composite child = new cGroup();
....@@ -1691,73 +2191,98 @@
16912191 csg.addChild(child);
16922192 child.addChild(csg);
16932193 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2194
+ if (source == computeAOItem)
16962195 {
1697
- ImportGFD();
2196
+ Globals.drawMode = CameraPane.OCCLUSION;
2197
+ Globals.theRenderer.repaint();
16982198 } 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)
2199
+ if (source == recompileItem)
17172200 {
17182201 Recompile();
17192202 refreshContents();
17202203 } else
1721
- if (event.getSource() == editScriptItem)
2204
+ if (source == editScriptItem)
17222205 {
17232206 OpenDialog();
17242207 refreshContents();
17252208 } else
1726
- if (event.getSource() == invariantsItem)
2209
+ if (source == invariantsItem)
17272210 {
17282211 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2212
+ Grafreed.grafreeD.universe.invariants();
17302213 } else
1731
- if (event.getSource() == memoryItem)
2214
+ if (source == memoryItem)
17322215 {
17332216 //System.out.println("Invariants:");
17342217 PrintMemory();
17352218 } else
1736
- if (event.getSource() == pathItem)
2219
+ if (source == pathItem)
17372220 {
17382221 PrintPath();
17392222 } else
1740
- if (event.getSource() == analyzeItem)
2223
+ if (source == analyzeItem)
17412224 {
17422225 AnalyzeObject();
17432226 } else
1744
- if (event.getSource() == dumpItem)
2227
+ if (source == dumpItem)
17452228 {
17462229 DumpObject();
17472230 } else
1748
- if (event.getSource() == screenfitButton)
2231
+ if (source == minButton)
17492232 {
1750
- //Reload(lastConverter, lastFilename, true);
2233
+ Minimize();
2234
+ } else
2235
+ if (source == maxButton)
2236
+ {
2237
+ Maximize();
2238
+ } else
2239
+ if (source == fullButton)
2240
+ {
2241
+ ToggleFullScreen();
2242
+ } else
2243
+ if (source == undoButton)
2244
+ {
2245
+ // Go to previous version
2246
+ //if (!Undo())
2247
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2248
+ Undo();
2249
+ } else
2250
+ if (source == restoreButton)
2251
+ {
2252
+ // Restore current version
2253
+ Restore();
2254
+ } else
2255
+ if (source == replaceButton)
2256
+ {
2257
+ // Overwrite current version
2258
+ Replace();
2259
+ } else
2260
+ if (source == redoButton)
2261
+ {
2262
+ // Go to next version
2263
+ Redo();
2264
+ } else
2265
+ if (source == saveButton)
2266
+ {
2267
+ // Save a new version
2268
+ if (!Save(true))
2269
+ java.awt.Toolkit.getDefaultToolkit().beep();
2270
+ } else
2271
+ if (source == oneStepButton)
2272
+ {
2273
+ Globals.ONESTEP = true;
2274
+ cameraView.repaint();
2275
+ } else
2276
+ if (source == screenfitButton)
2277
+ {
17512278 ScreenFit();
17522279 } else
1753
- if (event.getSource() == screenfitpointButton)
2280
+ if (source == screenfitpointButton)
17542281 {
1755
- //Reload(lastConverter, lastFilename, true);
17562282 ScreenFitPoint();
17572283 } else
1758
- if (event.getSource() == snapobjectButton)
2284
+ if (source == snapobjectButton)
17592285 {
1760
- //Reload(lastConverter, lastFilename, true);
17612286 SnapObject();
17622287 } else
17632288 // if (event.getSource() == recompileButton)
....@@ -1766,13 +2291,13 @@
17662291 // Recompile();
17672292 // refreshContents();
17682293 // } else
1769
- if (event.getSource() == gcButton)
2294
+ if (source == gcButton)
17702295 {
17712296 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722297 System.gc();
17732298 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742299 } else
1775
- if (event.getSource() == editLeafItem)
2300
+ if (source == editLeafItem)
17762301 {
17772302 Object3D obj;
17782303 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2311,78 @@
17862311 }
17872312 refreshContents(true);
17882313 } else
1789
- if (event.getSource() == openWindowItem)
2314
+ if (source == openWindowItem)
17902315 {
17912316 EditSelection(true);
17922317 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2318
+ if (source == cutItem || source == clearButton)
17942319 {
17952320 loadClipboard(true);
17962321 } else
1797
- if (event.getSource() == duplicateItem)
2322
+ if (source == undoItem)
17982323 {
1799
- Object3D keep = GraphreeD.clipboard;
2324
+ Undo();
2325
+ } else
2326
+ if (source == redoItem)
2327
+ {
2328
+ Redo();
2329
+ } else
2330
+ if (source == duplicateItem)
2331
+ {
2332
+ Object3D keep = Grafreed.clipboard;
18002333 loadClipboard(false);
18012334 paste(false);
1802
- GraphreeD.clipboard = keep;
2335
+ Grafreed.clipboard = keep;
18032336 } else
1804
- if (event.getSource() == cloneItem)
2337
+ if (source == cloneItem)
18052338 {
18062339 CloneSelection(false);
18072340 } else
1808
- if (event.getSource() == cloneSupportItem)
2341
+ if (source == cloneSupportItem)
18092342 {
18102343 CloneSelection(true);
18112344 } else
1812
- if (event.getSource() == copyItem)
2345
+ if (source == copyItem)
18132346 {
18142347 loadClipboard(false);
18152348 } else
1816
- if (event.getSource() == pasteItem)
2349
+ if (source == pasteItem)
18172350 {
18182351 paste(false);
18192352 } else
1820
- if (event.getSource() == pasteLinkItem)
2353
+ if (source == pasteIntoItem)
18212354 {
1822
- pasteInto(false);
2355
+ pasteInto(true, false);
18232356 } else
1824
- if (event.getSource() == pasteCloneItem)
2357
+ if (source == pasteLinkItem)
18252358 {
1826
- pasteInto(true);
2359
+ pasteInto(false, false);
18272360 } else
1828
- if (event.getSource() == pasteExpandItem)
2361
+ if (source == pasteCloneItem)
2362
+ {
2363
+ pasteInto(true, true);
2364
+ } else
2365
+ if (source == pasteExpandItem)
18292366 {
18302367 paste(true);
18312368 } else
1832
- if (event.getSource() == synchronizeItem)
2369
+ if (source == synchronizeItem)
18332370 {
18342371 Overwrite(Object3D.TRANSFORM);
18352372 } else
1836
- if (event.getSource() == overwriteNameItem)
2373
+ if (source == overwriteNameItem)
18372374 {
18382375 Overwrite(Object3D.NAME);
18392376 } else
1840
- if (event.getSource() == overwriteUVItem)
2377
+ if (source == overwriteUVItem)
18412378 {
18422379 Overwrite(Object3D.UV);
18432380 } else
1844
- if (event.getSource() == overwriteMatItem)
2381
+ if (source == overwriteMatItem)
18452382 {
2383
+ /* july 2015
18462384 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2385
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482386 else
18492387 {
18502388 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2394,16 @@
18562394 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572395 }
18582396 }
2397
+ */
2398
+
2399
+ Overwrite(dropAttributes);
18592400 }
1860
- if (event.getSource() == overwriteGeoItem)
2401
+ if (source == overwriteGeoItem)
18612402 {
18622403 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2404
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642405 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2406
+// Object3D content = GrafreeD.clipboard.get(0);
18662407 //
18672408 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682409 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2415,7 @@
18742415 // refreshContents();
18752416 // }
18762417 } else
1877
- if (event.getSource() == generateMeshItem)
2418
+ if (source == generateMeshItem)
18782419 {
18792420 //if (group.selection.size() == 1)
18802421 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2426,7 @@
18852426 ResetModel();
18862427 refreshContents();
18872428 } else
1888
- if (event.getSource() == extractGeometriesItem)
2429
+ if (source == extractGeometriesItem)
18892430 {
18902431 boolean one = false;
18912432
....@@ -1912,7 +2453,7 @@
19122453 ResetModel();
19132454 refreshContents();
19142455 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2456
+ if (source == cloneGeometriesItem)
19162457 {
19172458 boolean one = false;
19182459
....@@ -1938,32 +2479,37 @@
19382479 ResetModel();
19392480 refreshContents();
19402481 } else
1941
- if (event.getSource() == shareGeometriesItem)
2482
+ if (source == shareGeometriesItem)
19422483 {
19432484 boolean one = false;
19442485
19452486 if (group.selection.size() == 1)
19462487 one = true;
19472488
2489
+ Object3D merge = null;
2490
+
19482491 Object3D content = new cGroup();
19492492
19502493 for (int i=0; i<group.selection.size(); i++)
19512494 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2495
+ merge = new Merge(group.selection.get(i));
19532496
19542497 if (one)
1955
- makeSomething(sel, false);
2498
+ makeSomething(merge, false);
19562499 else
1957
- content.addChild(sel);
2500
+ content.addChild(merge);
19582501 }
19592502
19602503 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2504
+ makeSomething(content, true);
2505
+ else
2506
+ {
2507
+ ResetModel();
2508
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2509
+ refreshContents();
2510
+ }
19652511 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2512
+ if (source == mergeGeometriesItem)
19672513 {
19682514 boolean one = false;
19692515
....@@ -1993,11 +2539,11 @@
19932539 ResetModel();
19942540 refreshContents();
19952541 } else
1996
- if (event.getSource() == linkverticesItem)
2542
+ if (source == linkverticesItem)
19972543 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2544
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992545 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2546
+// Object3D content = GrafreeD.clipboard.get(0);
20012547 //
20022548 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032549 // content = ((cGroup)content).get(0);
....@@ -2006,39 +2552,48 @@
20062552 // group.selection.get(0).setMasterThis(content); // should be identity
20072553 // refreshContents();
20082554 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2555
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20102556 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2557
+ Object3D content = Grafreed.clipboard.get(0);
20122558
20132559 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142560 content = ((cGroup)content).get(0);
20152561
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2562
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172563 for (int i=0; i<group.selection.size(); i++)
20182564 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
2565
+ boolean random = CameraPane.SWITCH;
2566
+ CameraPane.SWITCH = false; // parse all random nodes
20212567 group.selection.get(i).linkVerticesThis(content);
20222568 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
2569
+ CameraPane.SWITCH = random;
20242570 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2571
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262572 refreshContents();
20272573 }
20282574 } else
2029
- if (event.getSource() == resetsupportItem)
2575
+ if (source == resetsupportItem)
20302576 {
20312577 for (int i=0; i<group.selection.size(); i++)
20322578 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
2579
+ boolean random = CameraPane.SWITCH;
2580
+ CameraPane.SWITCH = false; // parse all random nodes
20352581 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
2582
+ CameraPane.SWITCH = random;
20372583 }
20382584
20392585 refreshContents();
20402586 } else
2041
- if (event.getSource() == resetreferencesItem)
2587
+ if (source == relinkverticesItem)
2588
+ {
2589
+ boolean random = CameraPane.SWITCH;
2590
+ CameraPane.SWITCH = false; // parse all random nodes
2591
+ group.selection.RelinkToSupport();
2592
+ CameraPane.SWITCH = random;
2593
+
2594
+ refreshContents();
2595
+ } else
2596
+ if (source == resetreferencesItem)
20422597 {
20432598 for (int i=0; i<group.selection.size(); i++)
20442599 {
....@@ -2047,11 +2602,11 @@
20472602
20482603 refreshContents();
20492604 } else
2050
- if (event.getSource() == setMasterItem)
2605
+ if (source == setMasterItem)
20512606 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2607
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20532608 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2609
+ Object3D content = Grafreed.clipboard.get(0);
20552610
20562611 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572612 content = ((cGroup)content).get(0);
....@@ -2060,13 +2615,13 @@
20602615 refreshContents();
20612616 }
20622617 } else
2063
- if (event.getSource() == poseMeshItem)
2618
+ if (source == poseMeshItem)
20642619 {
20652620 if (group.selection.size() == 1)
20662621 {
2067
- if (GraphreeD.clipboard.size() == 1)
2622
+ if (Grafreed.clipboard.size() == 1)
20682623 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2624
+ Object3D content = Grafreed.clipboard.get(0);
20702625
20712626 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722627 content = ((cGroup)content).get(0);
....@@ -2079,19 +2634,19 @@
20792634 }
20802635
20812636 } else
2082
- if (event.getSource() == revertMeshItem)
2637
+ if (source == revertMeshItem)
20832638 {
20842639 RevertMeshes();
20852640 } else
2086
- if (event.getSource() == resetMeshItem)
2641
+ if (source == resetAllItem)
20872642 {
20882643 ResetAll();
20892644 } else
2090
- if (event.getSource() == stepAllItem)
2645
+ if (source == stepAllItem)
20912646 {
20922647 StepAll();
20932648 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2649
+ if (source == clearItem) // || event.getSource() == clearButton)
20952650 {
20962651 //int indices[] = jList.getSelectedIndices();
20972652 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2654,46 @@
20992654
21002655 ClearSelection(false);
21012656 } else
2102
- if (event.getSource() == clearAllItem)
2657
+ if (source == clearAllItem)
21032658 {
21042659 ClearSelection(true);
21052660 } else
2106
- if (event.getSource() == grabItem)
2661
+ if (source == grabItem || source == groupButton)
21072662 {
2108
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
21092664 } else
2110
- if (event.getSource() == frontItem)
2665
+ if (source == hideItem)
2666
+ {
2667
+ group(new HiddenObject());
2668
+ } else
2669
+ if (source == frontItem)
21112670 {
21122671 front();
21132672 } else
2114
- if (event.getSource() == backItem)
2673
+ if (source == backItem)
21152674 {
21162675 back();
21172676 } else
2118
- if (event.getSource() == cameraItem)
2677
+ if (source == cameraItem)
21192678 {
21202679 makeSomething(new Camera());
21212680 } else
2122
- if (event.getSource() == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
21232682 {
21242683 group(new Composite());
21252684 } else
2126
- if (event.getSource() == randomItem)
2685
+ if (source == switchItem || source == switchButton)
21272686 {
21282687 RandomNode random = new RandomNode();
21292688 group(random);
21302689 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
2690
+ random.name = random.get(0).name + "Switch";
21322691 } else
2133
- if (event.getSource() == physicsItem)
2692
+ if (source == physicsItem)
21342693 {
21352694 group(new PhysicsNode());
21362695 } else
2137
- if (event.getSource() == frameselectorItem)
2696
+ if (source == frameselectorItem)
21382697 {
21392698 for (int i=0; i<group.selection.size(); i++)
21402699 {
....@@ -2146,7 +2705,7 @@
21462705 ResetModel();
21472706 refreshContents();
21482707 } else
2149
- if (event.getSource() == switchGeoItem)
2708
+ if (source == switchGeoItem)
21502709 {
21512710 for (int i=0; i<group.selection.size(); i++)
21522711 {
....@@ -2158,7 +2717,7 @@
21582717 ResetModel();
21592718 refreshContents();
21602719 } else
2161
- if (event.getSource() == switchTransfoItem)
2720
+ if (source == switchTransfoItem)
21622721 {
21632722 for (int i=0; i<group.selection.size(); i++)
21642723 {
....@@ -2170,7 +2729,7 @@
21702729 ResetModel();
21712730 refreshContents();
21722731 } else
2173
- if (event.getSource() == morphItem)
2732
+ if (source == morphItem)
21742733 {
21752734 for (int i=0; i<group.selection.size(); i++)
21762735 {
....@@ -2182,7 +2741,7 @@
21822741 ResetModel();
21832742 refreshContents();
21842743 } else
2185
- if (event.getSource() == scriptNodeItem)
2744
+ if (source == scriptNodeItem)
21862745 {
21872746 boolean atleastone = false;
21882747
....@@ -2221,191 +2780,252 @@
22212780 }
22222781 }
22232782 } else
2224
- if (event.getSource() == linkerItem)
2783
+ if (source == linkerItem)
22252784 {
22262785 group(new cLinker());
22272786 } else
2228
- if (event.getSource() == textureItem)
2787
+ if (source == textureItem || source == textureButton)
22292788 {
22302789 group(new TextureNode());
22312790 } else
2232
- if (event.getSource() == shadowXItem)
2791
+ if (source == billboardItem)
2792
+ {
2793
+ group(new BillboardNode());
2794
+ } else
2795
+ if (source == shadowXItem)
22332796 {
22342797 CastShadow(0);
22352798 } else
2236
- if (event.getSource() == shadowYItem)
2799
+ if (source == shadowYItem)
22372800 {
22382801 CastShadow(1);
22392802 } else
2240
- if (event.getSource() == shadowZItem)
2803
+ if (source == shadowZItem)
22412804 {
22422805 CastShadow(2);
22432806 } else
2244
- if (event.getSource() == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
22452808 {
2246
- ungroup();
2809
+ boolean hasRoot = false;
2810
+
2811
+ for (int i=0; i<group.selection.size(); i++)
2812
+ {
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
2818
+ }
2819
+
2820
+ if (!hasRoot)
2821
+ {
2822
+ for (int i=0; i<group.selection.size(); i++)
2823
+ {
2824
+ Ungroup(group.selection.get(i));
2825
+ }
2826
+
2827
+ ClearSelection(false);
2828
+
2829
+ refreshContents();
2830
+ }
22472831 } else
2248
- if (event.getSource() == genUVItem)
2832
+ if (source == genUVItem)
22492833 {
22502834 GenUV();
22512835 } else
2252
- if (event.getSource() == genNormalsCADItem)
2836
+ if (source == genNormalsCADItem)
22532837 {
22542838 GenNormals(true);
22552839 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2840
+ if (source == genNormalsMESHItem)
2841
+ {
2842
+ GenNormalsMESH();
2843
+ } else
2844
+ if (source == genNormalsORGANItem)
22572845 {
22582846 GenNormals(false);
22592847 } else
2260
- if (event.getSource() == stripifyItem)
2848
+ if (source == genNormalsMINEItem)
2849
+ {
2850
+ GenNormalsMINE();
2851
+ } else
2852
+ if (source == stripifyItem)
22612853 {
22622854 Stripify();
22632855 } else
2264
- if (event.getSource() == unstripifyItem)
2856
+ if (source == unstripifyItem)
22652857 {
22662858 Unstripify();
22672859 } else
2268
- if (event.getSource() == trimItem)
2860
+ if (source == trimItem)
22692861 {
22702862 Trim();
22712863 } else
2272
- if (event.getSource() == untrimItem)
2864
+ if (source == untrimItem)
22732865 {
22742866 Untrim();
22752867 } else
2276
- if (event.getSource() == clearColorsItem)
2868
+ if (source == clearColorsItem)
22772869 {
22782870 ClearColors();
22792871 } else
2280
- if (event.getSource() == clearMaterialsItem)
2872
+ if (source == clearMaterialsItem)
22812873 {
22822874 ClearMaterials();
22832875 } else
2284
- if (event.getSource() == liveleavesItem)
2876
+ if (source == liveleavesItem)
22852877 {
22862878 LiveLeaves(true);
22872879 } else
2288
- if (event.getSource() == unliveleavesItem)
2880
+ if (source == unliveleavesItem)
22892881 {
22902882 LiveLeaves(false);
22912883 } else
2292
- if (event.getSource() == supportleavesItem)
2884
+ if (source == supportleavesItem)
22932885 {
22942886 SupportLeaves(true);
22952887 } else
2296
- if (event.getSource() == unsupportleavesItem)
2888
+ if (source == unsupportleavesItem)
22972889 {
22982890 SupportLeaves(false);
22992891 } else
2300
- if (event.getSource() == hideleavesItem)
2892
+ if (source == hideleavesItem)
23012893 {
23022894 HideLeaves(true);
23032895 } else
2304
- if (event.getSource() == showleavesItem)
2896
+ if (source == showleavesItem)
23052897 {
23062898 HideLeaves(false);
23072899 } else
2308
- if (event.getSource() == markleavesItem)
2900
+ if (source == markleavesItem)
23092901 {
23102902 MarkLeaves(true);
23112903 } else
2312
- if (event.getSource() == unmarkleavesItem)
2904
+ if (source == unmarkleavesItem)
23132905 {
23142906 MarkLeaves(false);
23152907 } else
2316
- if (event.getSource() == flipVItem)
2908
+ if (source == rewindleavesItem)
2909
+ {
2910
+ RewindLeaves(true);
2911
+ } else
2912
+ if (source == unrewindleavesItem)
2913
+ {
2914
+ RewindLeaves(false);
2915
+ } else
2916
+ if (source == randomleavesItem)
2917
+ {
2918
+ RandomLeaves(true);
2919
+ } else
2920
+ if (source == unrandomleavesItem)
2921
+ {
2922
+ RandomLeaves(false);
2923
+ } else
2924
+ if (source == flipVItem)
23172925 {
23182926 FlipV(true);
23192927 } else
2320
- if (event.getSource() == unflipVItem)
2928
+ if (source == unflipVItem)
23212929 {
23222930 FlipV(false);
23232931 } else
2324
- if (event.getSource() == lowTexturesItem)
2932
+ if (source == lowTexturesItem)
23252933 {
23262934 SetTexRes(0);
23272935 } else
2328
- if (event.getSource() == normalTexturesItem)
2936
+ if (source == normalTexturesItem)
23292937 {
23302938 SetTexRes(1);
23312939 } else
2332
- if (event.getSource() == highTexturesItem)
2940
+ if (source == highTexturesItem)
23332941 {
23342942 SetTexRes(2);
23352943 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2944
+ if (source == veryhighTexturesItem)
23372945 {
23382946 SetTexRes(3);
23392947 } else
2340
- if (event.getSource() == maxTexturesItem)
2948
+ if (source == maxTexturesItem)
23412949 {
23422950 SetTexRes(4);
23432951 } else
2344
- if (event.getSource() == panoTexturesItem)
2952
+ if (source == panoTexturesItem)
23452953 {
23462954 SetTexRes(5);
23472955 } else
2348
- if (event.getSource() == reverseNormalsItem)
2956
+ if (source == reverseNormalsItem)
23492957 {
23502958 ReverseNormals();
23512959 } else
2352
- if (event.getSource() == parseverticesItem)
2960
+ if (source == parseverticesItem)
23532961 {
23542962 ParseVertices();
23552963 } else
2356
- if (event.getSource() == alignItem)
2964
+ if (source == textureFieldItem)
2965
+ {
2966
+ TextureVertices();
2967
+ } else
2968
+ if (source == alignItem)
23572969 {
23582970 Align();
23592971 } else
2360
- if (event.getSource() == mirrorItem)
2972
+ if (source == mirrorItem)
23612973 {
23622974 MirrorPoses();
23632975 } else
2364
- if (event.getSource() == reduceMorphItem)
2976
+ if (source == reduceMorphItem)
23652977 {
23662978 MeshReduction(false);
23672979 } else
2368
- if (event.getSource() == reduce34MorphItem)
2980
+ if (source == reduce34MorphItem)
23692981 {
23702982 MeshReduction(true);
23712983 } else
2372
- if (event.getSource() == reverseTrianglesItem)
2984
+ if (source == reverseTrianglesItem)
23732985 {
23742986 ReverseTriangles();
23752987 } else
2376
- if (event.getSource() == reduceMeshItem)
2988
+ if (source == reduceMeshItem)
23772989 {
23782990 ReduceMesh(false);
23792991 } else
2380
- if (event.getSource() == reduce34MeshItem)
2992
+ if (source == reduce34MeshItem)
23812993 {
23822994 ReduceMesh(true);
23832995 } else
2384
- if (event.getSource() == increaseMeshItem)
2996
+ if (source == increaseMeshItem)
23852997 {
23862998 IncreaseMesh();
23872999 } else
2388
- if (event.getSource() == clipMeshItem)
3000
+ if (source == clipMeshItem)
23893001 {
23903002 ClipMesh();
23913003 } else
2392
- if (event.getSource() == smoothMeshItem)
3004
+ if (source == smoothMeshItem)
23933005 {
23943006 SmoothMesh();
23953007 } else
2396
- if (event.getSource() == transformgeometryItem)
3008
+ if (source == transformGeometryItem)
23973009 {
23983010 TransformGeometry();
23993011 } else
2400
- if (event.getSource() == resetTransformItem)
3012
+ if (source == transformChildrenItem)
3013
+ {
3014
+ TransformChildren();
3015
+ } else
3016
+ if (source == resetTransformItem)
24013017 {
24023018 ResetTransform();
24033019 } else
2404
- if (event.getSource() == resetCentroidItem)
3020
+ if (source == resetCentroidItem)
24053021 {
2406
- ResetCentroid();
3022
+ ResetCentroid(true);
24073023 } else
2408
- if (event.getSource() == resetParentItem)
3024
+ if (source == resetCentroidXZItem)
3025
+ {
3026
+ ResetCentroid(false);
3027
+ } else
3028
+ if (source == resetParentItem)
24093029 {
24103030 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24113031 {
....@@ -2415,7 +3035,7 @@
24153035
24163036 refreshContents();
24173037 } else
2418
- if (event.getSource() == repairParentItem)
3038
+ if (source == repairParentItem)
24193039 {
24203040 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24213041 {
....@@ -2429,7 +3049,21 @@
24293049
24303050 refreshContents();
24313051 } else
2432
- if (event.getSource() == sortbysizeItem)
3052
+ if (source == repairShadowItem)
3053
+ {
3054
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3055
+ {
3056
+ Object3D obj = (Object3D)e.nextElement();
3057
+ obj.RepairShadow();
3058
+// for (int i=0; i<obj.size(); i++)
3059
+// {
3060
+// obj.get(i).parent = obj;
3061
+// }
3062
+ }
3063
+
3064
+ refreshContents();
3065
+ } else
3066
+ if (source == sortbysizeItem)
24333067 {
24343068 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353069 {
....@@ -2441,7 +3075,7 @@
24413075 ResetModel();
24423076 refreshContents();
24433077 } else
2444
- if (event.getSource() == sortbynameItem)
3078
+ if (source == sortbynameItem)
24453079 {
24463080 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473081 {
....@@ -2453,7 +3087,7 @@
24533087 ResetModel();
24543088 refreshContents();
24553089 } else
2456
- if (event.getSource() == attachPigmentItem)
3090
+ if (source == attachPigmentItem)
24573091 {
24583092 String texture = GetFile("Attach pigment");
24593093 Object3D obj;
....@@ -2465,7 +3099,7 @@
24653099
24663100 refreshContents();
24673101 } else
2468
- if (event.getSource() == detachPigmentItem)
3102
+ if (source == detachPigmentItem)
24693103 {
24703104 Object3D obj;
24713105 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3110,7 @@
24763110
24773111 refreshContents();
24783112 } else
2479
- if (event.getSource() == attachBumpItem)
3113
+ if (source == attachBumpItem)
24803114 {
24813115 String texture = GetFile("Attach bump");
24823116 Object3D obj;
....@@ -2488,7 +3122,7 @@
24883122
24893123 refreshContents();
24903124 } else
2491
- if (event.getSource() == detachBumpItem)
3125
+ if (source == detachBumpItem)
24923126 {
24933127 Object3D obj;
24943128 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +3133,7 @@
24993133
25003134 refreshContents();
25013135 } else
2502
- if (event.getSource() == pigmentBumpItem)
3136
+ if (source == pigmentBumpItem)
25033137 {
25043138 Object3D obj;
25053139 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +3144,237 @@
25103144
25113145 refreshContents();
25123146 } else
2513
- if (event.getSource() == flashSelectionButton)
3147
+ if (source == flashSelectionButton)
25143148 {
25153149 CameraPane.flash = true;
25163150 refreshContents();
25173151 } else
2518
- if (event.getSource() == oneButton)
3152
+ if (source == oneButton)
25193153 {
25203154 } else
2521
- if (event.getSource() == twoButton)
3155
+ if (source == twoButton)
25223156 {
25233157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
25243162 // bug
25253163 //gridPanel.setDividerLocation(1.0);
25263164 //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();
3165
+// bigThree.remove(scenePanel);
3166
+// bigThree.remove(centralPanel);
3167
+// bigThree.remove(XYZPanel);
3168
+// aWindowConstraints.gridx = 0;
3169
+// aWindowConstraints.gridy = 0;
3170
+// aWindowConstraints.gridwidth = 1;
3171
+// // aConstraints.gridheight = 3;
3172
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3173
+// aWindowConstraints.weightx = 0;
3174
+// aWindowConstraints.weighty = 1;
3175
+// //bigThree.add(jtp, aWindowConstraints);
3176
+// aWindowConstraints.weightx = 1;
3177
+// aWindowConstraints.gridwidth = 3;
3178
+// // aConstraints.gridheight = 3;
3179
+// aWindowConstraints.gridx = 1;
3180
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3181
+// bigThree.add(centralPanel, aWindowConstraints);
3182
+// aWindowConstraints.weightx = 0;
3183
+// aWindowConstraints.gridx = 4;
3184
+// aWindowConstraints.gridwidth = 1;
3185
+// // aConstraints.gridheight = 3;
3186
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3187
+// //bigThree.add(XYZPanel, aWindowConstraints);
3188
+// scenePanel.setVisible(false);
3189
+// centralPanel.setVisible(true);
3190
+// XYZPanel.setVisible(false);
3191
+ bigThree.ClearUI();
3192
+ bigThree.add(centralPanel);
3193
+ bigThree.FlushUI();
3194
+
3195
+ cameraView.requestFocusInWindow();
3196
+
3197
+// refreshContents(true);
3198
+//
3199
+// try
3200
+// {
3201
+// java.awt.Robot bot = new java.awt.Robot();
3202
+// int mask = InputEvent.BUTTON1_MASK;
3203
+// bot.mouseMove(100, 100);
3204
+// bot.mousePress(mask);
3205
+// bot.mouseRelease(mask);
3206
+// }
3207
+// catch (Exception e)
3208
+// {
3209
+//
3210
+// }
3211
+
25513212 } else
2552
- if (event.getSource() == threeButton)
3213
+ if (source == threeButton)
25533214 {
25543215 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();
3216
+
3217
+ if (CameraPane.FULLSCREEN)
3218
+ fullscreenLayout = radio.layout;
3219
+
3220
+// bigThree.remove(scenePanel);
3221
+// bigThree.remove(centralPanel);
3222
+// bigThree.remove(XYZPanel);
3223
+// aWindowConstraints.gridx = 0;
3224
+// aWindowConstraints.gridy = 0;
3225
+// aWindowConstraints.gridwidth = 1;
3226
+// // aConstraints.gridheight = 3;
3227
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3228
+// aWindowConstraints.weightx = 0;
3229
+// aWindowConstraints.weighty = 1;
3230
+// //bigThree.add(jtp, aWindowConstraints);
3231
+// aWindowConstraints.weightx = 1;
3232
+// aWindowConstraints.gridwidth = 3;
3233
+// // aConstraints.gridheight = 3;
3234
+// aWindowConstraints.gridx = 1;
3235
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3236
+// bigThree.add(centralPanel, aWindowConstraints);
3237
+// aWindowConstraints.weightx = 0;
3238
+// aWindowConstraints.gridx = 4;
3239
+// aWindowConstraints.gridwidth = 1;
3240
+// // aConstraints.gridheight = 3;
3241
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3242
+// bigThree.add(XYZPanel, aWindowConstraints);
3243
+// bigThree.validate();
3244
+// scenePanel.setVisible(false);
3245
+// centralPanel.setVisible(true);
3246
+// XYZPanel.setVisible(true);
3247
+ bigThree.ClearUI();
3248
+ bigThree.add(centralPanel);
3249
+ bigThree.add(XYZPanel);
3250
+ bigThree.FlushUI();
3251
+
3252
+ cameraView.requestFocusInWindow();
25793253 } else
2580
- if (event.getSource() == fourButton)
3254
+ if (source == fourButton)
25813255 {
25823256 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();
3257
+
3258
+ if (CameraPane.FULLSCREEN)
3259
+ fullscreenLayout = radio.layout;
3260
+
3261
+// bigThree.remove(scenePanel);
3262
+// bigThree.remove(centralPanel);
3263
+// bigThree.remove(XYZPanel);
3264
+// aWindowConstraints.gridx = 0;
3265
+// aWindowConstraints.gridy = 0;
3266
+// aWindowConstraints.gridwidth = 1;
3267
+// // aWindowConstraints.gridheight = 3;
3268
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3269
+// aWindowConstraints.weightx = 1;
3270
+// aWindowConstraints.weighty = 1;
3271
+// bigThree.add(scenePanel, aWindowConstraints);
3272
+// aWindowConstraints.weightx = 1;
3273
+// aWindowConstraints.gridwidth = 3;
3274
+// // aConstraints.gridheight = 3;
3275
+// aWindowConstraints.gridx = 1;
3276
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3277
+// //bigThree.add(cameraPanel, aWindowConstraints);
3278
+// aWindowConstraints.weightx = 0;
3279
+// aWindowConstraints.gridx = 4;
3280
+// aWindowConstraints.gridwidth = 1;
3281
+// // aWindowConstraints.gridheight = 3;
3282
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3283
+// //bigThree.add(XYZPanel, aWindowConstraints);
3284
+// bigThree.validate();
3285
+// scenePanel.setVisible(true);
3286
+// centralPanel.setVisible(false);
3287
+// XYZPanel.setVisible(false);
3288
+ bigThree.ClearUI();
3289
+ bigThree.add(scenePanel);
3290
+ bigThree.FlushUI();
3291
+
3292
+ cameraView.requestFocusInWindow();
26073293 } else
2608
- if (event.getSource() == sixButton)
3294
+ if (source == sixButton)
26093295 {
26103296 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();
3297
+
3298
+ if (CameraPane.FULLSCREEN)
3299
+ fullscreenLayout = radio.layout;
3300
+
3301
+// bigThree.remove(scenePanel);
3302
+// bigThree.remove(centralPanel);
3303
+// bigThree.remove(XYZPanel);
3304
+// aWindowConstraints.gridx = 0;
3305
+// aWindowConstraints.gridy = 0;
3306
+// aWindowConstraints.gridwidth = 1;
3307
+// // aConstraints.gridheight = 3;
3308
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3309
+// aWindowConstraints.weightx = 0;
3310
+// aWindowConstraints.weighty = 1;
3311
+// bigThree.add(scenePanel, aWindowConstraints);
3312
+// aWindowConstraints.weightx = 1;
3313
+// aWindowConstraints.gridwidth = 3;
3314
+// // aWindowConstraints.gridheight = 3;
3315
+// aWindowConstraints.gridx = 1;
3316
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3317
+// bigThree.add(centralPanel, aWindowConstraints);
3318
+// aWindowConstraints.weightx = 0;
3319
+// aWindowConstraints.gridx = 4;
3320
+// aWindowConstraints.gridwidth = 1;
3321
+// // aWindowConstraints.gridheight = 3;
3322
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3323
+// //bigThree.add(XYZPanel, aConstraints);
3324
+// bigThree.validate();
3325
+// scenePanel.setVisible(true);
3326
+// centralPanel.setVisible(true);
3327
+// XYZPanel.setVisible(false);
3328
+ bigThree.ClearUI();
3329
+ bigThree.add(scenePanel);
3330
+ bigThree.add(centralPanel);
3331
+ bigThree.FlushUI();
3332
+
3333
+ cameraView.requestFocusInWindow();
26353334 } else
2636
- if (event.getSource() == sevenButton)
3335
+ if (source == sevenButton)
26373336 {
26383337 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();
3338
+
3339
+ if (CameraPane.FULLSCREEN)
3340
+ fullscreenLayout = radio.layout;
3341
+
3342
+// bigThree.remove(scenePanel);
3343
+// bigThree.remove(centralPanel);
3344
+// bigThree.remove(XYZPanel);
3345
+// aWindowConstraints.gridx = 0;
3346
+// aWindowConstraints.gridy = 0;
3347
+// aWindowConstraints.gridwidth = 1;
3348
+// // aWindowConstraints.gridheight = 3;
3349
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3350
+// aWindowConstraints.weightx = 0;
3351
+// aWindowConstraints.weighty = 1;
3352
+// bigThree.add(scenePanel, aWindowConstraints);
3353
+// aWindowConstraints.weightx = 1;
3354
+// aWindowConstraints.gridwidth = 3;
3355
+// // aWindowConstraints.gridheight = 3;
3356
+// aWindowConstraints.gridx = 1;
3357
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3358
+// bigThree.add(centralPanel, aWindowConstraints);
3359
+// aWindowConstraints.weightx = 0;
3360
+// aWindowConstraints.gridx = 4;
3361
+// aWindowConstraints.gridwidth = 1;
3362
+// // aConstraints.gridheight = 3;
3363
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3364
+// bigThree.add(XYZPanel, aWindowConstraints);
3365
+// bigThree.validate();
3366
+// scenePanel.setVisible(true);
3367
+// centralPanel.setVisible(true);
3368
+// XYZPanel.setVisible(true);
3369
+ bigThree.ClearUI();
3370
+ bigThree.add(scenePanel);
3371
+ bigThree.add(centralPanel);
3372
+ bigThree.add(XYZPanel);
3373
+ bigThree.FlushUI();
3374
+
3375
+ cameraView.requestFocusInWindow();
26633376 } else
2664
- if (event.getSource() == rootButton)
3377
+ if (source == rootButton)
26653378 {
26663379 Object3D obj;
26673380 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2671,66 +3384,84 @@
26713384 EditObject(obj);
26723385 }
26733386
3387
+ cameraView.requestFocusInWindow();
26743388 refreshContents(true);
26753389 } else
2676
- if (event.getSource() == closeButton)
3390
+ if (source == closeButton)
26773391 {
26783392 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793393 cRadio ab;
26803394 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813395 {
26823396 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3397
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843398 {
3399
+ // Patch to avoid bug with transparency.
3400
+ if (!ab.hadMaterial)
3401
+ {
3402
+ ab.object.material = null;
3403
+ }
3404
+
26853405 buttonGroup.remove(ab);
26863406 radioPanel.remove(ab);
26873407
2688
- ab.GetObject().editWindow = null;
3408
+ //ab.GetObject().editWindow = null;
3409
+ ab.GetObject().manipWindow = null;
26893410 // ab.GetObject().objectUI = null; // ?????????
26903411
26913412 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923413 break;
26933414 }
26943415 }
3416
+
3417
+ cameraView.requestFocusInWindow();
26953418 refreshContents(true);
26963419 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3420
+ if (source == editItem || source == editButton)
26983421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
26993428 EditSelection(false);
27003429 } else
2701
- if (event.getSource() == uneditButton)
3430
+ if (source == uneditButton)
27023431 {
27033432 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043433 {
27053434 Object3D child = (Object3D)e.nextElement();
27063435 if(child.editWindow != null)
27073436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
27083438 child.CloseUI();
27093439 listUI.remove(child);
27103440
2711
- child.editWindow = null; // ???????????
3441
+ //child.editWindow = null; // ???????????
27123442 }
2713
- objEditor.ctrlPanel.revalidate();
3443
+ objEditor.ctrlPanel.FlushUI();
27143444 //objEditor.jTree.clearSelection();
27153445 //objEditor.ResetSliders();
27163446 refreshContents(true);
27173447 } else
2718
- if (event.getSource() == clearPanelButton)
3448
+ if (source == clearPanelButton)
27193449 {
27203450 assert(copy == group);
27213451 //copy.ClearUI();
27223452 for (Object3D obj : listUI)
27233453 {
3454
+ obj.pinned = false;
27243455 obj.CloseUI();
27253456 }
27263457 listUI.clear();
27273458 refreshContents(true);
27283459 } else
2729
- if (event.getSource() == allParamsButton)
3460
+ if (source == allParamsButton)
27303461 {
27313462 assert(copy == group);
27323463
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27343465
27353466 for (Object3D obj : listUI)
27363467 {
....@@ -2747,19 +3478,19 @@
27473478
27483479 refreshContents(true);
27493480 } else
2750
- if (event.getSource() == unselectButton)
3481
+ if (source == unselectButton)
27513482 {
27523483 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3484
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543485 objEditor.ResetSliders();
27553486 refreshContents(true);
27563487 } else
2757
- if(event.getSource() instanceof cRadio)
3488
+ if(source instanceof cRadio)
27583489 {
27593490 group.parent = keepparent;
27603491 group.attributes = 0;
27613492 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3493
+ /*cRadio*/ radio = (cRadio)source;
27633494 Object3D obj = radio.GetObject();
27643495 System.out.println("Edit " + obj);
27653496 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +3510,10 @@
27793510 }
27803511
27813512 copy = group;
2782
- //CameraPane.theRenderer.object = group;
3513
+
3514
+ SetUndoStates();
3515
+
3516
+ //Globals.theRenderer.object = group;
27833517 if(!useclient)
27843518 {
27853519 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +3522,50 @@
27883522 cameraView.cameras[cameraView.cameracount] = radio.camera;
27893523 cameraView.targetLookAt.set(radio.camera.lookAt);
27903524 cameraView.object = group;
2791
- cameraView.lighttouched = true;
3525
+ //cameraView.lighttouched = true;
3526
+ Globals.lighttouched = true;
27923527 topView.object = group;
27933528 frontView.object = group;
27943529 sideView.object = group;
27953530 }
2796
- group.editWindow = this;
3531
+
3532
+// fix "+" issue
3533
+ //group.editWindow = this;
3534
+ group.manipWindow = this;
3535
+
27973536 /*
27983537 currentLayout = radio.layout;
27993538 if (currentLayout == null)
28003539 currentLayout = sevenButton;
28013540 */
28023541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
28033547 keepparent = group.parent;
28043548 // PARENT = NULL or not???
28053549 //group.parent = null; // ROOT
28063550 //group.attributes = -1;
28073551 ResetModel();
3552
+
3553
+ cameraView.requestFocusInWindow();
28083554 refreshContents(true);
2809
- }
3555
+ } else if (event.getSource() == editCameraItem)
3556
+ {
3557
+ cameraView.ProtectCamera();
3558
+ cameraView.repaint();
3559
+ return;
3560
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3561
+ {
3562
+ cameraView.RevertCamera();
3563
+ cameraView.repaint();
3564
+ return;
3565
+ // } else if (event.getSource() == textureButton)
3566
+ // {
3567
+ // return; // true;
3568
+ }
28103569 else
28113570 {
28123571 //return super.action(event, arg);
....@@ -2815,7 +3574,6 @@
28153574 }
28163575
28173576 boolean useclient = false;
2818
- cRadio radio;
28193577
28203578 void ToggleRoot()
28213579 {
....@@ -2824,7 +3582,7 @@
28243582 if (useclient)
28253583 {
28263584 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3585
+ Globals.lighttouched = true;
28283586 //topView.object = client;
28293587 //frontView.object = client;
28303588 //sideView.object = client;
....@@ -2832,7 +3590,7 @@
28323590 else
28333591 {
28343592 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3593
+ Globals.lighttouched = true;
28363594 //topView.object = group;
28373595 //frontView.object = group;
28383596 //sideView.object = group;
....@@ -2867,6 +3625,28 @@
28673625 refreshContents();
28683626 }
28693627
3628
+ void TransformChildren()
3629
+ {
3630
+ Object3D obj;
3631
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3632
+ {
3633
+ obj = (Object3D)e.nextElement();
3634
+ obj.KeepTextureMatrices();
3635
+ obj.TransformChildren();
3636
+ obj.RestoreTextureMatrices();
3637
+
3638
+// if (obj.parent == null)
3639
+// {
3640
+// System.out.println("NULL PARENT!");
3641
+// new Exception().printStackTrace();
3642
+// }
3643
+// else
3644
+// TouchTransform(obj);
3645
+// //obj.parent.Touch();
3646
+ }
3647
+
3648
+ refreshContents();
3649
+ }
28703650
28713651 void ResetTransform()
28723652 {
....@@ -2979,7 +3759,7 @@
29793759 refreshContents();
29803760 }
29813761
2982
- void ResetCentroid()
3762
+ void ResetCentroid(boolean full)
29833763 {
29843764 Object3D obj;
29853765 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +3774,16 @@
29943774 LA.matIdentity(Object3D.mat);
29953775 obj.getBounds(minima, maxima, false);
29963776 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3777
+ if (full)
3778
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29983779 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29993780 obj.TransformMesh(Object3D.mat);
3781
+
30003782 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3783
+ if (full)
3784
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30023785 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3786
+
30033787 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30043788 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30053789 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +3812,8 @@
30283812
30293813 int size = obj.MemorySize();
30303814
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
3815
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3816
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30323817 }
30333818 }
30343819 catch (Exception e)
....@@ -3065,9 +3850,9 @@
30653850 obj = (Object3D)e.nextElement();
30663851
30673852 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3853
+ Grafreed.AnalyzeObject(obj);
30693854 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3855
+ Grafreed.AnalyzeObject(obj.bRep);
30713856
30723857 // System.err.println((size/1024) + " KB is the size of " + obj);
30733858 }
....@@ -3109,6 +3894,20 @@
31093894 void GenNormals(boolean crease)
31103895 {
31113896 group.GenNormalsS(crease);
3897
+
3898
+ refreshContents();
3899
+ }
3900
+
3901
+ void GenNormalsMESH()
3902
+ {
3903
+ group.GenNormalsMeshS();
3904
+
3905
+ refreshContents();
3906
+ }
3907
+
3908
+ void GenNormalsMINE()
3909
+ {
3910
+ group.selection.GenNormalsMINE();
31123911
31133912 refreshContents();
31143913 }
....@@ -3157,104 +3956,259 @@
31573956
31583957 //Object3D buffer;
31593958 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
-
3959
+// BoundaryRep temprep;
3960
+// Object3D nodes;
3961
+// Vector<Vertex> vertices;
3962
+//
3963
+// cGroup buffer;
3964
+//
3965
+// public void Vertex(Object3D node, Vertex v)
3966
+// {
3967
+//// vertices.add(v);
3968
+//// nodes.addElement(node);
3969
+////
3970
+//// if (temprep.GetCache(v) != null)
3971
+//// {
3972
+//// temprep.Remove(v);
3973
+//// } else
3974
+//// {
3975
+//// temprep.Remember(v);
3976
+//// }
3977
+//
3978
+// //Object3D node = nodes.get(index);
3979
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
3980
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3981
+//
3982
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3983
+//
3984
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3985
+//
3986
+// cGroup g = new cGroup();
3987
+//
3988
+// if (g.toParent == null)
3989
+// {
3990
+// g.toParent = LA.newMatrix();
3991
+// g.fromParent = LA.newMatrix();
3992
+// }
3993
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3994
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3995
+//
3996
+// g.add(GrafreeD.clipboard);
3997
+//
3998
+// buffer.add(g);
3999
+// }
4000
+//
4001
+// public void Face(Object3D node, Face f)
4002
+// {
4003
+//
4004
+// }
4005
+//
4006
+// void ParseVerticesOld() // ??
4007
+// {
4008
+// //if (group.selection.size() != 1)
4009
+// // return;
4010
+//
4011
+// temprep = new BoundaryRep();
4012
+// nodes = new Object3D();
4013
+// vertices = new Vector<Vertex>();
4014
+//
4015
+// boolean epsequal = GrafreeD.epsequal;
4016
+// GrafreeD.epsequal = true;
4017
+//
4018
+// for (int i=0; i<group.selection.size(); i++)
4019
+// {
4020
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4021
+//
4022
+// group.selection.get(i).Parse(
4023
+//this );
4024
+//
4025
+// int repsize = temprep.VertexCount();
4026
+// int tablesize = temprep.vertextable.size();
4027
+// int nodesize = nodes.size();
4028
+//
4029
+// assert(vertices.size() == nodes.size());
4030
+//
4031
+// temprep.vertextable.elements();
4032
+//
4033
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4034
+//
4035
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
4036
+// {
4037
+// cGroup g = new cGroup();
4038
+//
4039
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
4040
+//
4041
+// Object3D node = nodes.get(index);
4042
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
4043
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4044
+//
4045
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4046
+//
4047
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4048
+//
4049
+// if (g.toParent == null)
4050
+// {
4051
+// g.toParent = LA.newMatrix();
4052
+// g.fromParent = LA.newMatrix();
4053
+// }
4054
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4055
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4056
+//
4057
+// g.add(GrafreeD.clipboard);
4058
+//
4059
+// buffer.add(g);
4060
+// }
4061
+//
4062
+// makeSomething(buffer, i==group.selection.size()-1);
4063
+// }
4064
+//
4065
+// GrafreeD.epsequal = epsequal;
4066
+//
4067
+// //buffer = null;
4068
+// temprep = null;
4069
+// nodes = null;
4070
+//
4071
+// refreshContents();
4072
+// }
4073
+
31844074 void ParseVertices()
31854075 {
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;
4076
+ boolean epsequal = Grafreed.epsequal;
4077
+ Grafreed.epsequal = true;
31954078
31964079 for (int i=0; i<group.selection.size(); i++)
31974080 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4081
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994082
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4083
+ group.selection.get(i).Parse(
4084
+
4085
+ new iParse()
4086
+ {
4087
+ public void Vertex(Object3D node, Vertex v)
4088
+ {
4089
+ temp.set(v);
4090
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054091
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();
4092
+ cGroup g = new cGroup();
32114093
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4094
+ if (g.toParent == null)
4095
+ {
4096
+ g.toParent = LA.newMatrix();
4097
+ g.fromParent = LA.newMatrix();
4098
+ }
4099
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4100
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154101
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);
4102
+ g.add(Grafreed.clipboard);
32204103
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);
4104
+ buffer.add(g);
4105
+ }
32324106
3233
- g.add(GraphreeD.clipboard);
4107
+ public void Face(Object3D node, Face f)
4108
+ {
32344109
3235
- buffer.add(g);
3236
- }
4110
+ }
4111
+ }
4112
+ );
32374113
32384114 makeSomething(buffer, i==group.selection.size()-1);
32394115 }
32404116
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4117
+ Grafreed.epsequal = epsequal;
32464118
32474119 refreshContents();
32484120 }
3249
-
4121
+
4122
+ void TextureVertices()
4123
+ {
4124
+ for (int i=0; i<group.selection.size(); i++)
4125
+ {
4126
+ group.selection.get(i).Parse(
4127
+ new iParse()
4128
+ {
4129
+ public void Vertex(Object3D node, Vertex v)
4130
+ {
4131
+ cTexture tex = node.GetTextures();
4132
+ String pigment = Object3D.GetPigment(tex);
4133
+ //String bump = Object3D.GetBump(tex);
4134
+
4135
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4136
+
4137
+ try
4138
+ {
4139
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4140
+ }
4141
+ catch (Exception e)
4142
+ {
4143
+ System.err.println("FAIL: " + node);
4144
+ }
4145
+
4146
+ double s = v.s;
4147
+
4148
+ if (s == 1)
4149
+ s = 0;
4150
+
4151
+ double t = v.t;
4152
+
4153
+ if (t == 1)
4154
+ t = 0;
4155
+
4156
+ int indexs = (int) (texturedata.getWidth() * s);
4157
+ int indext = (int) (texturedata.getHeight() * t);
4158
+
4159
+ int index = indext * texturedata.getWidth() + indexs;
4160
+
4161
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4162
+
4163
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4164
+
4165
+ float scale = bytebuf.get(index*slide) & 0xFF;
4166
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4167
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4168
+ scale /= 3;
4169
+
4170
+ scale /= 0xFF;
4171
+ // c'est quoi ca? scale /= 4;
4172
+
4173
+ //v.AO = scale;
4174
+
4175
+ v.x += v.norm.x * scale;
4176
+ v.y += v.norm.y * scale;
4177
+ v.z += v.norm.z * scale;
4178
+ }
4179
+
4180
+ public void Face(Object3D node, Face f)
4181
+ {
4182
+ }
4183
+ }
4184
+ );
4185
+ }
4186
+
4187
+ refreshContents();
4188
+ }
4189
+
32504190 void Align()
32514191 {
4192
+ if (group.selection.size() == 0)
4193
+ return;
4194
+
4195
+ cVector bbmin = new cVector();
4196
+ cVector bbmax = new cVector();
4197
+
4198
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4199
+
4200
+ double dx = bbmax.x - bbmin.x;
4201
+ double dy = bbmax.y - bbmin.y;
4202
+ double dz = bbmax.z - bbmin.z;
4203
+
4204
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4205
+
32524206 for (int i=0; i<group.selection.size(); i++)
32534207 {
32544208 Object3D obj = group.selection.get(i);
32554209
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4210
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4211
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584212 }
32594213
32604214 refreshContents();
....@@ -3267,7 +4221,7 @@
32674221 // ref.SaveSupports();
32684222 // Object3D par = ref.parent;
32694223 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4224
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714225 // ref.parent = par;
32724226 // ref.RestoreSupports();
32734227
....@@ -3275,11 +4229,11 @@
32754229
32764230 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774231
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4232
+ boolean random = CameraPane.SWITCH;
4233
+ CameraPane.SWITCH = false; // parse all random nodes
32804234 lowres.linkVerticesThis(null);
32814235 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4236
+ CameraPane.SWITCH = random;
32834237
32844238 System.err.flush();
32854239
....@@ -3297,7 +4251,7 @@
32974251 // lowres.SaveSupports();
32984252 // par = lowres.parent;
32994253 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4254
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014255 Object3D newlow = CloneObject(lowres, false);
33024256 newlow.name = sn.switchobject.get(i).name;
33034257 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4273,7 @@
33194273 return;
33204274
33214275 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4276
+ Object3D ref = Grafreed.clipboard.get(0);
33234277
33244278 Object3D newgroup = new Object3D("Po:" + poses.name);
33254279
....@@ -3488,7 +4442,7 @@
34884442 group.selection.RelinkToSupport(); // july 2014
34894443 System.out.println("DONE.");
34904444 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4445
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34924446 }
34934447
34944448 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +4467,20 @@
35134467
35144468 void ClipMesh()
35154469 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4470
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35174471 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
4472
+ Object3D content = Grafreed.clipboard.get(0);
35194473
35204474 if (content instanceof cGroup && ((cGroup)content).transientlink )
35214475 content = ((cGroup)content).get(0);
35224476
35234477 // for (int i=0; i<group.selection.size(); i++)
35244478 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4479
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264480 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4481
+ group.selection.ClipMesh(Grafreed.clipboard);
35284482 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4483
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304484 System.out.println("DONE.");
35314485 refreshContents();
35324486 }
....@@ -3571,6 +4525,18 @@
35714525 void MarkLeaves(boolean hide)
35724526 {
35734527 group.selection.MarkLeaves(hide);
4528
+ refreshContents();
4529
+ }
4530
+
4531
+ void RewindLeaves(boolean hide)
4532
+ {
4533
+ group.selection.RewindLeaves(hide);
4534
+ refreshContents();
4535
+ }
4536
+
4537
+ void RandomLeaves(boolean hide)
4538
+ {
4539
+ group.selection.RandomLeaves(hide);
35744540 refreshContents();
35754541 }
35764542
....@@ -3645,10 +4611,6 @@
36454611 // }
36464612 // }
36474613
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36524614 void EditSelection(boolean newWindow)
36534615 {
36544616 // aConstraints.gridy = 0;
....@@ -3656,10 +4618,10 @@
36564618 {
36574619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36584620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36604622
36614623 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
4624
+ if(elem != group || !newWindow)
36634625 {
36644626 // if (!(elem instanceof Composite))
36654627 // newWindow = false;
....@@ -3741,7 +4703,8 @@
37414703 //new Exception().printStackTrace();
37424704
37434705 freezemodel = true;
3744
-
4706
+ ClearUnpinned();
4707
+
37454708 /**/
37464709 //switch (event.id)
37474710 {
....@@ -3749,7 +4712,6 @@
37494712 //case 702: // Event.LIST_DESELECT
37504713 group.deselectAll();
37514714 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37534715 if (tps != null)
37544716 {
37554717 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +4720,39 @@
37584720
37594721 //if (child.parent != null)
37604722 //child.parent.addSelectee(child);
4723
+ objEditor.SetMaterial(child);
37614724 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37654725 }
37664726 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
4727
+// else
4728
+// {
4729
+// objEditor.SetMaterial(group); // .GetMaterial());
4730
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4731
+// System.err.println("info : " + group.GetPath());
4732
+// }
37734733
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4734
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37774735 CameraPane.flash = true;
37784736
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4737
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37804738 // a camera
37814739 {
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;
4740
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4741
+ {
4742
+ CameraPane.camerachangeframe = 0; // don't refuse it
4743
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4744
+ }
4745
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4746
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864747 }
37874748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
37884756 refreshContents();
37894757 //return true;
37904758 }
....@@ -3793,6 +4761,35 @@
37934761
37944762 freezemodel = false;
37954763 }
4764
+
4765
+ void SetPinStates(boolean enabled)
4766
+ {
4767
+ editButton.setEnabled(enabled);
4768
+ uneditButton.setEnabled(enabled);
4769
+ unselectButton.setEnabled(enabled);
4770
+ flashSelectionButton.setEnabled(enabled);
4771
+ }
4772
+
4773
+ void refreshContents(boolean cp)
4774
+ {
4775
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4776
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4777
+ {
4778
+ objEditor.ClearInfo(); // .GetMaterial());
4779
+
4780
+ for (int i=0; i < group.selection.Size(); i++)
4781
+ {
4782
+ Object3D child = (Object3D) group.selection.get(i);
4783
+
4784
+ objEditor.AddInfo(child, this, true);
4785
+ System.err.println("info : " + child.GetPath());
4786
+ }
4787
+
4788
+ objEditor.SetText(); // jan 2014
4789
+ }
4790
+
4791
+ super.refreshContents(cp);
4792
+ }
37964793
37974794 void linkSomething(Object3D thing)
37984795 {
....@@ -3864,16 +4861,19 @@
38644861 {
38654862 if (group.selection.isEmpty())
38664863 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4864
+
4865
+ Grafreed.clipboardIsTempGroup = false;
38684866 Composite tGroup = null;
38694867 if (group.selection.size() > 0) // 1)
38704868 {
38714869 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4870
+ Grafreed.clipboardIsTempGroup = true;
38734871 }
38744872
38754873 if (cut)
38764874 {
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
38774877 //int indices[] = jList.getSelectedIndices();
38784878 //for (int i = indices.length - 1; i >= 0; i--)
38794879 //jList.remove(indices[i]);
....@@ -3909,16 +4909,16 @@
39094909 //System.out.println("cut " + child);
39104910 //System.out.println("parent = " + child.parent);
39114911 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4912
+ if (Grafreed.clipboardIsTempGroup)
39134913 tGroup.add/*Child*/(tmp);
39144914 else
3915
- GraphreeD.clipboard = tmp;
4915
+ Grafreed.clipboard = tmp;
39164916 }
39174917 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4918
+ if (Grafreed.clipboardIsTempGroup)
39194919 tGroup.add/*Child*/(child);
39204920 else
3921
- GraphreeD.clipboard = child;
4921
+ Grafreed.clipboard = child;
39224922 }
39234923
39244924 //ResetModel();
....@@ -3950,21 +4950,23 @@
39504950 //System.out.println("cut " + elem);
39514951 //System.out.println("parent = " + elem.parent);
39524952 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
39544954 tGroup.add/*Child*/(tmp);
39554955 else
3956
- GraphreeD.clipboard = tmp;
4956
+ Grafreed.clipboard = tmp;
39574957 }
39584958 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4959
+ if (Grafreed.clipboardIsTempGroup)
39604960 tGroup.add/*Child*/(child);
39614961 else
3962
- GraphreeD.clipboard = child;
4962
+ Grafreed.clipboard = child;
39634963 }
39644964
39654965 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4966
+
4967
+ if (Grafreed.clipboardIsTempGroup)
4968
+ Grafreed.clipboard = tGroup;
4969
+
39684970 if (cut)
39694971 {
39704972 ResetModel();
....@@ -3974,11 +4976,15 @@
39744976
39754977 void paste(boolean expand)
39764978 {
3977
- // if (GraphreeD.clipboard == null)
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
4983
+ // if (GrafreeD.clipboard == null)
39784984 // return;
39794985 boolean first = true;
39804986
3981
- if (GraphreeD.clipboardIsTempGroup)
4987
+ if (Grafreed.clipboardIsTempGroup)
39824988 {
39834989 Composite temp;
39844990
....@@ -3989,7 +4995,7 @@
39894995 temp = (Composite)Applet3D.clipboard.deepCopy();
39904996 */
39914997 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4998
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39934999 {
39945000 Object3D child = (Object3D)e.nextElement();
39955001
....@@ -4003,7 +5009,7 @@
40035009 else
40045010 elem = child.deepCopy(); // ?
40055011 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
5012
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40075013 // elem = elem.get(0);
40085014 makeSomething(elem, true); // ?? first);
40095015 //group.addChild(elem);
....@@ -4023,23 +5029,24 @@
40235029 //Object3D cb = Applet3D.clipboard;
40245030 //temp.addChild(cb);
40255031 //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());
5032
+ assert(Grafreed.clipboard.parent == null);
5033
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5034
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5035
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5036
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40315037 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
5038
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5039
+ Grafreed.clipboard.get(0).parent = keepparent;
40345040 }
40355041
5042
+ Globals.REPLACEONMAKE = keep;
40365043 ResetModel();
40375044 refreshContents();
40385045 }
40395046
4040
- void pasteInto(boolean copyit)
5047
+ void pasteInto(boolean copyit, boolean clone)
40415048 {
4042
-// if (GraphreeD.clipboard == null)
5049
+// if (GrafreeD.clipboard == null)
40435050 // return;
40445051
40455052 if (group.selection.size() != 1)
....@@ -4066,15 +5073,22 @@
40665073 if (copyit)
40675074 {
40685075 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5076
+ if (clone)
5077
+ {
5078
+ CloneClipboard(false); // sept 2014
5079
+ }
5080
+ else
5081
+ {
5082
+ paste(false);
5083
+ }
40705084 }
40715085 else
40725086 {
40735087 boolean first = true;
40745088
4075
- if (GraphreeD.clipboardIsTempGroup)
5089
+ if (Grafreed.clipboardIsTempGroup)
40765090 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5091
+ Composite temp = (Composite)Grafreed.clipboard;
40785092 Object3D copy;
40795093 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805094 {
....@@ -4084,7 +5098,7 @@
40845098 }
40855099 } else
40865100 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5101
+ linkSomething(Grafreed.clipboard); //.get(0));
40885102 }
40895103 }
40905104 }
....@@ -4161,6 +5175,10 @@
41615175
41625176 void group(Object3D csg, boolean grab)
41635177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
41645182 if (//false) // why??
41655183 !group.selection.isEmpty())
41665184 {
....@@ -4274,8 +5292,34 @@
42745292 //node.add(csg);
42755293 //makeSomething(node);
42765294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
42775296 }
42785297
5298
+ void Ungroup(Object3D g)
5299
+ {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
5304
+ if (g instanceof HiddenObject)
5305
+ {
5306
+ HiddenObject h = (HiddenObject) g;
5307
+
5308
+ for (int i=0; i<h.ActualSize(); i++)
5309
+ {
5310
+ objEditor.makeSomething(h.get(i), false);
5311
+ }
5312
+ }
5313
+ else
5314
+ {
5315
+ for (int i=0; i<g.Size(); i++)
5316
+ {
5317
+ objEditor.makeSomething(g.get(i), false);
5318
+ }
5319
+ }
5320
+ Globals.REPLACEONMAKE = keep;
5321
+ }
5322
+
42795323 void ungroup()
42805324 {
42815325 /*
....@@ -4469,21 +5513,6 @@
44695513 }
44705514 */
44715515
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
-
44875516 /*
44885517 public void Callback(Object obj)
44895518 {
....@@ -4507,26 +5536,9 @@
45075536 }
45085537 */
45095538
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
-
45275539 String GetFile(String dialogName)
45285540 {
4529
- if (GraphreeD.standAlone)
5541
+ if (Grafreed.standAlone)
45305542 {
45315543 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45325544 browser.show();
....@@ -4590,10 +5602,33 @@
45905602 cButton flashSelectionButton;
45915603 cButton editButton;
45925604 cButton uneditButton;
5605
+ JCheckBox allParamsButton;
45935606 cButton clearpanelButton;
4594
- cButton allParamsButton;
45955607 cButton unselectButton;
45965608
5609
+ cButton restoreCameraButton;
5610
+
5611
+ cButton saveButton;
5612
+ cButton oneStepButton;
5613
+
5614
+ cButton groupButton;
5615
+ cButton ungroupButton;
5616
+ cButton compositeButton;
5617
+ cButton switchButton;
5618
+ cButton loopButton;
5619
+ cButton textureButton;
5620
+
5621
+ cButton gridButton;
5622
+ cButton boxButton;
5623
+ cButton sphereButton;
5624
+ cButton coneButton;
5625
+ cButton torusButton;
5626
+ cButton superButton;
5627
+ cButton kleinButton;
5628
+ cButton particlesButton;
5629
+ cButton overlayButton;
5630
+ cButton lightButton;
5631
+
45975632 cButton screenfitButton;
45985633 cButton screenfitpointButton;
45995634 cButton snapobjectButton;
....@@ -4605,14 +5640,6 @@
46055640
46065641 cButton setsupportButton;
46075642
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
-
46165643 //
46175644 //Composite
46185645 Object3D // to do !!
....@@ -4622,9 +5649,11 @@
46225649 //JTree jTree;
46235650 private MenuItem lookAtItem;
46245651 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
46265653 private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
5654
+ private MenuItem undoItem;
5655
+ private MenuItem redoItem;
5656
+ private JMenuItem duplicateItem;
46285657 private MenuItem cloneItem;
46295658 private MenuItem cloneSupportItem;
46305659 private MenuItem overwriteGeoItem;
....@@ -4635,8 +5664,9 @@
46355664 private MenuItem resetsupportItem;
46365665 private MenuItem resetreferencesItem;
46375666 private MenuItem linkverticesItem;
5667
+ private MenuItem relinkverticesItem;
46385668 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
5669
+ private MenuItem resetAllItem;
46405670 private MenuItem stepAllItem;
46415671 private MenuItem revertMeshItem;
46425672 private MenuItem poseMeshItem;
....@@ -4647,14 +5677,17 @@
46475677 private MenuItem mergeGeometriesItem;
46485678 private MenuItem copyItem;
46495679 private MenuItem pasteItem;
5680
+ private MenuItem pasteIntoItem;
46505681 private MenuItem pasteLinkItem;
46515682 private MenuItem pasteCloneItem;
46525683 private MenuItem pasteExpandItem;
46535684 private MenuItem clearItem;
46545685 private MenuItem clearAllItem;
46555686 private MenuItem genUVItem;
5687
+ private MenuItem genNormalsMESHItem;
46565688 private MenuItem genNormalsCADItem;
46575689 private MenuItem genNormalsORGANItem;
5690
+ private MenuItem genNormalsMINEItem;
46585691 private MenuItem stripifyItem;
46595692 private MenuItem unstripifyItem;
46605693 private MenuItem trimItem;
....@@ -4683,6 +5716,10 @@
46835716 private MenuItem showleavesItem;
46845717 private MenuItem markleavesItem;
46855718 private MenuItem unmarkleavesItem;
5719
+ private MenuItem rewindleavesItem;
5720
+ private MenuItem unrewindleavesItem;
5721
+ private MenuItem randomleavesItem;
5722
+ private MenuItem unrandomleavesItem;
46865723
46875724 private MenuItem flipVItem;
46885725 private MenuItem unflipVItem;
....@@ -4694,14 +5731,17 @@
46945731 private MenuItem panoTexturesItem;
46955732
46965733 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
5734
+ private MenuItem resetCentroidXZItem;
46985735 private MenuItem resetTransformItem;
5736
+ private MenuItem transformGeometryItem;
5737
+ private MenuItem transformChildrenItem;
5738
+ private MenuItem hideItem;
46995739 private MenuItem grabItem;
47005740 private MenuItem backItem;
47015741 private MenuItem frontItem;
47025742 private MenuItem cameraItem;
47035743 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
47055745 private MenuItem physicsItem;
47065746 private MenuItem frameselectorItem;
47075747 private MenuItem scriptNodeItem;
....@@ -4716,6 +5756,7 @@
47165756
47175757 private MenuItem resetParentItem;
47185758 private MenuItem repairParentItem;
5759
+ private MenuItem repairShadowItem;
47195760 private MenuItem sortbysizeItem;
47205761 private MenuItem sortbynameItem;
47215762
....@@ -4728,16 +5769,19 @@
47285769 private MenuItem particleItem;
47295770 private MenuItem ragdollItem;
47305771 private MenuItem ragdoll2Item;
5772
+ private MenuItem heightFieldItem;
5773
+ private MenuItem textureFieldItem;
47315774 private MenuItem gridItem;
47325775 private MenuItem rectoidItem;
47335776 private MenuItem ellipsoidItem;
47345777 private MenuItem coneItem;
47355778 private MenuItem torusItem;
47365779 private MenuItem superItem;
5780
+ private MenuItem kleinItem;
47375781 private MenuItem blobItem;
47385782 private MenuItem latheItem;
47395783 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
5784
+ private MenuItem overlayItem;
47415785 private MenuItem meshItem;
47425786 // private MenuItem meshGroupItem;
47435787 private MenuItem springItem;
....@@ -4746,6 +5790,7 @@
47465790 private MenuItem csgItem;
47475791 private MenuItem templateItem;
47485792 private MenuItem textureItem;
5793
+ private MenuItem billboardItem;
47495794 private MenuItem shadowXItem;
47505795 private MenuItem shadowYItem;
47515796 private MenuItem shadowZItem;
....@@ -4758,11 +5803,6 @@
47585803 private MenuItem doubleItem;
47595804 private MenuItem tripleItem;
47605805
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47665806 private MenuItem computeAOItem;
47675807 private MenuItem recompileItem;
47685808 private MenuItem editScriptItem;
....@@ -4772,4 +5812,8 @@
47725812 private MenuItem analyzeItem;
47735813 private MenuItem dumpItem;
47745814 //boolean freezemodel = false;
5815
+
5816
+ Menu cameraMenu;
5817
+ MenuItem editCameraItem;
5818
+ MenuItem restoreCameraItem;
47755819 }