Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
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.SAVEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.SAVEONMAKE;
90
+ Globals.SAVEONMAKE = 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.SAVEONMAKE = 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,41 @@
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
379547 void SetupUI2(ObjEditor oe)
380548 {
549
+ // June 2019
550
+ if (oe == null)
551
+ {
552
+ //super.SetupUI2(this);
553
+ //return;
554
+ }
555
+
556
+ if (copy != group)
557
+ {
558
+ //super.SetupUI2(this);
559
+ }
560
+
381561 //new Exception().printStackTrace();
382562
383563 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -406,150 +586,217 @@
406586 oe.radioPanel.add(dummyButton);
407587 oe.buttonGroup.add(dummyButton);
408588 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
589
+ cGridBag copyOptionsPanel = new cGridBag();
590
+
591
+ copyOptionsPanel.preferredHeight = 1;
412592
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
593
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
594
+
595
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ //minButton.setToolTipText("Minimize window");
597
+ //minButton.addActionListener(this);
598
+
599
+ if (Globals.ADVANCED)
600
+ {
601
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ maxButton.setToolTipText("Maximize window");
603
+ maxButton.addActionListener(this);
604
+ }
605
+
606
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
607
+ fullButton.setToolTipText("Full-screen window");
608
+ fullButton.addActionListener(this);
609
+
610
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ screenfitButton.setToolTipText("Screen fit");
612
+ screenfitButton.addActionListener(this);
613
+
614
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ restoreCameraButton.setToolTipText("Restore viewpoint");
616
+ restoreCameraButton.addActionListener(this);
617
+
618
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ undoButton.setToolTipText("Undo changes");
620
+ undoButton.addActionListener(this);
621
+ undoButton.setEnabled(false);
622
+
623
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ redoButton.setToolTipText("Redo changes");
625
+ redoButton.addActionListener(this);
626
+ redoButton.setEnabled(false);
627
+
628
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ saveButton.setToolTipText("Save changes");
630
+ saveButton.addActionListener(this);
631
+
632
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
633
+ liveCB.setToolTipText("Enable animation");
414634 liveCB.addItemListener(this);
415635
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);
636
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637
+ oneStepButton.setToolTipText("Animate one step forward");
638
+ oneStepButton.addActionListener(this);
639
+
640
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
641
+ fastCB.setToolTipText("Fast mode");
434642 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);
643
+
644
+ //oe.toolboxPanel.Return();
645
+
646
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
647
+// trackCB.setToolTipText("Enable tracking");
648
+// trackCB.addItemListener(this);
441649
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;
482650 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
483651 // 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;
488652
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;
653
+ if (Globals.ADVANCED)
654
+ {
655
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ snapobjectButton.addActionListener(this);
657
+ snapobjectButton.setToolTipText("Snap Object");
658
+ }
659
+
660
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
499661
500
- //
501
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
+ twoButton.setToolTipText("Show center view only");
502664 twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
665
+ this.fullscreenLayout = twoButton;
666
+
667
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504668 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
669
+ fourButton.setToolTipText("Show left panel only");
670
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
+ sixButton.setToolTipText("2-column layout left");
506672 sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
673
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
+ threeButton.setToolTipText("2-column layout right");
508675 threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
677
+ sevenButton.setToolTipText("3-column layout");
510678 sevenButton.addActionListener(this);
511679 //
512680
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
681
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ rootButton.setToolTipText("Edit selection in new tab");
514683 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
684
+
685
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686
+ closeButton.setToolTipText("Close tab");
517687 closeButton.addActionListener(this);
518688 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
519689 //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;
528690
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
691
+ // INSERT
692
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ gridButton.setToolTipText("Create grid");
694
+ gridButton.addActionListener(this);
695
+
696
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697
+ boxButton.setToolTipText("Create box");
698
+ boxButton.addActionListener(this);
699
+
700
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+ sphereButton.setToolTipText("Create sphere");
702
+ sphereButton.addActionListener(this);
703
+
704
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705
+ coneButton.setToolTipText("Create cone");
706
+ coneButton.addActionListener(this);
707
+
708
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ torusButton.setToolTipText("Create torus");
710
+ torusButton.addActionListener(this);
711
+
712
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ superButton.setToolTipText("Create superellipsoid");
714
+ superButton.addActionListener(this);
715
+
716
+ if (Globals.ADVANCED)
717
+ {
718
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ kleinButton.setToolTipText("Create Klein bottle");
720
+ kleinButton.addActionListener(this);
721
+ }
722
+
723
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ particlesButton.setToolTipText("Create particle system");
725
+ particlesButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.Return();
728
+
729
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ groupButton.setToolTipText("Create group");
731
+ groupButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ compositeButton.setToolTipText("Create composite");
735
+ compositeButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ switchButton.setToolTipText("Create item switcher");
739
+ switchButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ loopButton.setToolTipText("Create loop");
743
+ loopButton.addActionListener(this);
744
+
745
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ textureButton.setToolTipText("Create texture");
747
+ textureButton.addActionListener(this);
748
+
749
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ overlayButton.setToolTipText("Create overlay");
751
+ overlayButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
+ lightButton.setToolTipText("Create light");
755
+ lightButton.addActionListener(this);
756
+
757
+ for (int i=6; --i>=0;)
758
+ {
759
+ oe.toolboxPanel.Return();
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ oe.toolboxPanel.add(new cGridBag());
762
+ oe.toolboxPanel.add(new cGridBag());
763
+ oe.toolboxPanel.add(new cGridBag());
764
+ oe.toolboxPanel.add(new cGridBag());
765
+ oe.toolboxPanel.add(new cGridBag());
766
+ oe.toolboxPanel.add(new cGridBag());
767
+ }
768
+
769
+ // EDIT panel
770
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ editButton.setToolTipText("Pin selection controls");
772
+ editButton.addActionListener(this);
773
+
774
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ uneditButton.setToolTipText("Remove selection controls");
530776 uneditButton.addActionListener(this);
531777
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);
778
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
779
+ allParamsButton.setToolTipText("Show all controle");
544780 allParamsButton.addActionListener(this);
545781
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);
782
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
783
+ clearPanelButton.setToolTipText("Clear edit panel");
784
+ clearPanelButton.addActionListener(this);
785
+
786
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
787
+ unselectButton.setToolTipText("Unselect");
551788 unselectButton.addActionListener(this);
552789
790
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
791
+ flashSelectionButton.setToolTipText("Highlight selection");
792
+ flashSelectionButton.addActionListener(this);
793
+
794
+ editCommandsPanel.preferredHeight = 1;
795
+
796
+ SetPinStates(false);
797
+// oe.treePanel.add(commandsPanel);
798
+// oe.treePanel.Return();
799
+
553800 // oe.aConstraints.gridx += 1;
554801 // oe.aConstraints.weighty = 0;
555802 // oe.aConstraints.gridwidth = 1;
....@@ -561,40 +808,22 @@
561808 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
562809 // gcButton.addActionListener(this);
563810
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;
811
+ cGridBag jSPPanel = new cGridBag();
812
+
813
+ JScrollPane jSP;
575814 //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);
815
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
577816 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;
597817
818
+ oe.treePanel.add(jSPPanel);
819
+ oe.treePanel.Return();
820
+
821
+ oe.treePanel.add(copyOptionsPanel);
822
+ oe.treePanel.Return();
823
+
824
+// mainPanel.setDividerLocation(0.5); //1.0);
825
+// mainPanel.setResizeWeight(0.5);
826
+
598827 //jList.addListSelectionListener(this);
599828 oe.jTree.addTreeSelectionListener(this);
600829 //jTree.setRootVisible(false);
....@@ -616,20 +845,157 @@
616845 radio.layout = sevenButton;
617846 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
618847 }
848
+
849
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
850
+ {
851
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
852
+ colorCB.setToolTipText("Copy color when dropped");
853
+ colorCB.addItemListener(this);
854
+
855
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
856
+ materialCB.setToolTipText("Copy material when dropped");
857
+ materialCB.addItemListener(this);
858
+
859
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
860
+ textureCB.setToolTipText("Copy texture when dropped");
861
+ textureCB.addItemListener(this);
862
+
863
+ panel.Return();
864
+
865
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
866
+ boxCB.setToolTipText("Display bounding boxes");
867
+ boxCB.addItemListener(this);
868
+
869
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
870
+ zoomBoxCB.setToolTipText("Display only for wheel");
871
+ zoomBoxCB.addItemListener(this);
872
+
873
+ if (true) // Globals.ADVANCED)
874
+ {
875
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
876
+// supportCB.setToolTipText("Enable rigging");
877
+// supportCB.addItemListener(this);
878
+
879
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
880
+ freezeCB.setToolTipText("Fast moving camera");
881
+ freezeCB.addItemListener(this);
882
+
883
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
884
+ // localCB.addItemListener(this);
885
+
886
+ panel.Return();
887
+
888
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
889
+ crowdCB.setToolTipText("Used for crowds");
890
+ crowdCB.addItemListener(this);
891
+
892
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
893
+ smoothCB.setToolTipText("Snapping delay");
894
+ smoothCB.addItemListener(this);
895
+
896
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
897
+ slowCB.setToolTipText("Smooth interpolation");
898
+ slowCB.addItemListener(this);
899
+
900
+// constraints.gridy += 1;
901
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
902
+// speakerMocapCB.addItemListener(this);
903
+
904
+ panel.Return();
905
+
906
+ if (false)
907
+ {
908
+ // handled in scripts
909
+ //constraints.gridy += 1;
910
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
911
+ speakerCameraCB.addItemListener(this);
912
+
913
+ //constraints.gridy += 1;
914
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
915
+ speakerFocusCB.addItemListener(this);
916
+
917
+ //constraints.gridy += 1;
918
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
919
+ smoothfocusCB.addItemListener(this);
920
+ panel.Return();
921
+ }
922
+
923
+//constraints.gridx += 1;
924
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
925
+// debugCB.addItemListener(this);
926
+
927
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
928
+ trackCB.setToolTipText("Enable tracking target");
929
+ trackCB.addItemListener(this);
930
+
931
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
932
+ oeilCB.setToolTipText("Move camera when tracking");
933
+ oeilCB.addItemListener(this);
934
+
935
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
936
+ shadowCB.setToolTipText("When live compute shadows");
937
+ shadowCB.addItemListener(this);
938
+
939
+ panel.Return();
940
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
941
+ toggleTextureCB.setToolTipText("Load textures");
942
+ toggleTextureCB.addItemListener(this);
943
+
944
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
945
+ toggleSwitchCB.setToolTipText("Choose a single item");
946
+ toggleSwitchCB.addItemListener(this);
947
+
948
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
949
+ autosaveCB.setToolTipText("On structure change");
950
+ autosaveCB.addItemListener(this);
951
+
952
+ panel.Return();
953
+ if (Globals.ADVANCED)
954
+ {
955
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
956
+ lookAtCB.setToolTipText("Look-at target");
957
+ lookAtCB.addItemListener(this);
958
+ }
959
+
960
+ }
961
+
962
+ cGridBag fill = new cGridBag();
963
+ fill.preferredHeight = 200;
964
+ cGridBag fill2 = new cGridBag();
965
+ fill2.preferredHeight = 200;
966
+ cGridBag fill3 = new cGridBag();
967
+ fill3.preferredHeight = 200;
968
+
969
+ panel.add(fill);
970
+ panel.add(fill2);
971
+ panel.add(fill3);
972
+
973
+ }
619974
620975 void EditObject(Object3D obj)
621976 {
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();
977
+ cRadio radioButton = new cRadio(obj.name);
978
+
979
+ // June 2019. Patch to avoid bug with transparency.
980
+ radioButton.hadMaterial = obj.material != null;
981
+ if (!radioButton.hadMaterial)
982
+ {
983
+ obj.material = new cMaterial();
984
+ }
985
+
986
+ radioButton.SetObject(obj);
987
+ radioButton.layout = sevenButton;
988
+ radioButton.SetCamera(cameraView.renderCamera, false);
989
+ radioButton.addActionListener(this);
990
+ radioPanel.add(radioButton);
991
+ buttonGroup.add(radioButton);
992
+ radioButton.doClick();
630993 }
994
+
631995 void SetupViews(ObjEditor oe)
632996 {
997
+ theFrame = this;
998
+
633999 oe.SetupViews();
6341000
6351001 System.out.println("SetupViews");
....@@ -638,22 +1004,28 @@
6381004 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6391005 }
6401006
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;
1007
+ cToggleButton liveCB;
1008
+ cCheckBox supportCB;
1009
+ cCheckBox localCB;
1010
+ cCheckBox crowdCB;
1011
+ cCheckBox smoothCB;
1012
+ cToggleButton fastCB;
1013
+ cCheckBox slowCB;
1014
+ cCheckBox boxCB;
1015
+ cCheckBox zoomBoxCB;
1016
+ cCheckBox freezeCB;
1017
+ //cToggleButton trackCB;
1018
+ cCheckBox trackCB;
1019
+ cCheckBox smoothfocusCB;
6511020 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
1021
+ cCheckBox speakerCameraCB;
1022
+ cCheckBox speakerFocusCB;
1023
+ cCheckBox debugCB;
1024
+
1025
+ cCheckBox oeilCB;
1026
+ cCheckBox shadowCB;
1027
+ cCheckBox autosaveCB;
1028
+ cCheckBox lookAtCB;
6571029
6581030 // static int COLOR = 1;
6591031 // static int MATERIAL = 2;
....@@ -661,9 +1033,9 @@
6611033
6621034 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6631035
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
1036
+ cCheckBox colorCB;
1037
+ cCheckBox materialCB;
1038
+ cCheckBox textureCB;
6671039
6681040 public void itemStateChanged(ItemEvent e)
6691041 {
....@@ -688,10 +1060,10 @@
6881060 dropAttributes |= Object3D.TEXTURE;
6891061 else
6901062 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
1063
+ } else if(e.getSource() == liveCB)
6931064 {
6941065 cameraView.ToggleLive();
1066
+ refreshContents(false);
6951067 }
6961068 else if(e.getSource() == supportCB)
6971069 {
....@@ -727,6 +1099,10 @@
7271099 cameraView.repaint();
7281100 // refreshContents();
7291101 }
1102
+ else if(e.getSource() == zoomBoxCB)
1103
+ {
1104
+ cameraView.ToggleZoomBoxMode();
1105
+ }
7301106 else if(e.getSource() == smoothfocusCB)
7311107 {
7321108 cameraView.ToggleSmoothFocus();
....@@ -752,6 +1128,18 @@
7521128 {
7531129 cameraView.ToggleOeil();
7541130 }
1131
+ else if(e.getSource() == shadowCB)
1132
+ {
1133
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1134
+ }
1135
+ else if(e.getSource() == freezeCB)
1136
+ {
1137
+ Globals.FREEZEONMOVE ^= true;
1138
+ }
1139
+ else if(e.getSource() == autosaveCB)
1140
+ {
1141
+ Globals.SAVEONMAKE ^= true;
1142
+ }
7551143 else if(e.getSource() == lookAtCB)
7561144 {
7571145 cameraView.ToggleLookAt();
....@@ -768,7 +1156,8 @@
7681156
7691157 /**/
7701158 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
771
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1159
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1160
+ TreePath path = objEditor.jTree.getSelectionPath();
7721161 if ((path == null) || (path.getPathCount() <= 1)) {
7731162 // We can't move the root node or an empty selection
7741163 return;
....@@ -831,8 +1220,6 @@
8311220 }
8321221 }
8331222
834
- String string = (String) object;
835
-
8361223 System.out.println("Transfer = " + object + "; drop : " + target);
8371224 // if( object instanceof java.io.File[])
8381225 // {
....@@ -840,7 +1227,11 @@
8401227 // objEditor.DropFile((java.io.File[]) object, true);
8411228 // return;
8421229 // }
843
- if (string.charAt(0) == '/')
1230
+
1231
+ String string = object.toString();
1232
+
1233
+ // File path for Mac and Windows
1234
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441235 {
8451236 // file(s)
8461237 String[] names = string.split("\n");
....@@ -867,7 +1258,7 @@
8671258
8681259 flashIt = false;
8691260 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1261
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711262 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721263
8731264 if (group.selection.size() == 1)
....@@ -883,23 +1274,33 @@
8831274
8841275 assert target == objEditor.jTree;
8851276 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1277
+ Object3D destinationLeaf;
8861278 try {
887
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1279
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
8881280 } catch (Exception e) {
8891281 System.out.println("destinationPath : " + destinationPath);
8901282 return;
8911283 }
8921284
893
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1285
+ for (int i=group.selection.size(); --i>=0;)
8941286 {
1287
+ Object3D child = (Object3D)group.selection.elementAt(i);
1288
+
1289
+ // Cannot move into itself
1290
+ if (child == destinationLeaf)
1291
+ return;
1292
+ }
1293
+
1294
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1295
+// {
8951296 loadClipboard(true);
8961297 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
898
- } else {
899
- loadClipboard(false);
900
- objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
902
- }
1298
+ pasteInto(false, false);
1299
+// } else {
1300
+// loadClipboard(false);
1301
+// objEditor.jTree.setSelectionPath(destinationPath);
1302
+// pasteInto(false, false); // true); // ???
1303
+// }
9031304 }
9041305 public void dropActionChanged(DropTargetDragEvent dtde)
9051306 // Called if the user has modified the current drop gesture
....@@ -1002,90 +1403,109 @@
10021403
10031404 void buildCreateMenu(Menu menu)
10041405 {
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);
1406
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1407
+ //heightFieldItem.addActionListener(this);
1408
+// gridItem = menu.add(new MenuItem("Grid"));
1409
+// gridItem.addActionListener(this);
1410
+// rectoidItem = menu.add(new MenuItem("Box"));
1411
+// rectoidItem.addActionListener(this);
1412
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1413
+// ellipsoidItem.addActionListener(this);
1414
+// coneItem = menu.add(new MenuItem("Cone"));
1415
+// coneItem.addActionListener(this);
1416
+// torusItem = menu.add(new MenuItem("Torus"));
1417
+// torusItem.addActionListener(this);
1418
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1419
+// superItem.addActionListener(this);
1420
+
1421
+ cameraItem = menu.add(new MenuItem("Camera"));
1422
+ cameraItem.addActionListener(this);
1423
+
1424
+ if (!Globals.ADVANCED)
1425
+ {
1426
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1427
+ kleinItem.addActionListener(this);
1428
+ }
1429
+
1430
+// particleItem = menu.add(new MenuItem("Particle system"));
1431
+// particleItem.addActionListener(this);
1432
+ if (Globals.ADVANCED)
1433
+ {
10191434 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201435 ragdollItem.addActionListener(this);
10211436 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221437 ragdoll2Item.addActionListener(this);
1438
+ }
10231439 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1440
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251441 meshItem.addActionListener(this);
10261442 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271443 // meshGroupItem.addActionListener(this);
1444
+ if (Globals.ADVANCED)
1445
+ {
10281446 springItem = menu.add(new MenuItem("Spring"));
10291447 springItem.addActionListener(this);
10301448 flagItem = menu.add(new MenuItem("Flag"));
10311449 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);
10361450 blobItem = menu.add(new MenuItem("Blob"));
10371451 blobItem.addActionListener(this);
10381452 latheItem = menu.add(new MenuItem("Lathe"));
10391453 latheItem.addActionListener(this);
1040
- lightItem = menu.add(new MenuItem("Light"));
1041
- lightItem.addActionListener(this);
1454
+ }
1455
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1456
+ bezierItem.addActionListener(this);
1457
+// overlayItem = menu.add(new MenuItem("Overlay"));
1458
+// overlayItem.addActionListener(this);
1459
+// lightItem = menu.add(new MenuItem("Light"));
1460
+// lightItem.addActionListener(this);
10421461 menu.add("-");
10431462 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10441463 //superLoopItem.addActionListener(this);
1045
- loopItem = menu.add(new MenuItem("Loop"));
1046
- loopItem.addActionListener(this);
1464
+// loopItem = menu.add(new MenuItem("Loop"));
1465
+// loopItem.addActionListener(this);
10471466 doubleItem = menu.add(new MenuItem("Fork"));
10481467 doubleItem.addActionListener(this);
1468
+ if (Globals.ADVANCED)
1469
+ {
10491470 tripleItem = menu.add(new MenuItem("Trident"));
10501471 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);
1472
+ }
10601473 }
10611474
10621475 void buildToolsMenu(Menu menu)
10631476 {
10641477 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651478 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1479
+ animationItem.setState(Globals.ANIMATION);
1480
+
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
10671483
10681484 menu.add("-");
10691485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701486 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1487
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1488
+ textureFieldItem.addActionListener(this);
1489
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721490 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751491 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761492 reduceMorphItem.addActionListener(this);
10771493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781494 reduce34MorphItem.addActionListener(this);
1079
-
1080
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1081
- computeAOItem.addActionListener(this);
10821495 menu.add("-");
1083
-
10841496 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851497 memoryItem.addActionListener(this);
1498
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1499
+ computeAOItem.addActionListener(this);
1500
+
1501
+ if (Globals.ADVANCED)
1502
+ {
1503
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1504
+ mirrorItem.addActionListener(this);
1505
+ menu.add("-");
10861506 menu.add(analyzeItem = new MenuItem("Analyze"));
10871507 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
1508
+ menu.add(dumpItem = new MenuItem("Print"));
10891509 dumpItem.addActionListener(this);
10901510 // menu.add(pathItem = new MenuItem("From-to path"));
10911511 // pathItem.addActionListener(this);
....@@ -1094,6 +1514,8 @@
10941514 resetParentItem.addActionListener(this);
10951515 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961516 repairParentItem.addActionListener(this);
1517
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1518
+ repairShadowItem.addActionListener(this);
10971519 menu.add(invariantsItem = new MenuItem("Invariants"));
10981520 invariantsItem.addActionListener(this);
10991521 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1523,7 @@
11011523 menu.add("-");
11021524 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031525 editScriptItem.addActionListener(this);
1526
+ }
11041527 }
11051528
11061529 void ScreenFit()
....@@ -1223,9 +1646,24 @@
12231646 shadow.material = new cMaterial(obj.material);
12241647 shadow.material.diffuse = 0.0001f;
12251648 shadow.material.specular = 0.0001f;
1649
+ //shadow.projectedVertices[1].x = 300;
12261650
12271651 makeSomething(shadow);
12281652 }
1653
+
1654
+ private void ClearUnpinned()
1655
+ {
1656
+ //for (Object3D obj : listUI)
1657
+ for (int i=listUI.size(); --i>=0;)
1658
+ {
1659
+ Object3D obj = listUI.elementAt(i);
1660
+ if (!obj.pinned)
1661
+ {
1662
+ obj.CloseUI();
1663
+ listUI.remove(i);
1664
+ }
1665
+ }
1666
+ }
12291667
12301668 /**
12311669 * applyExample
....@@ -1429,9 +1867,9 @@
14291867
14301868 void Overwrite(int mask)
14311869 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1870
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14331871 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1872
+ Object3D content = Grafreed.clipboard.get(0);
14351873
14361874 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371875 content = ((cGroup)content).get(0);
....@@ -1454,6 +1892,7 @@
14541892 //
14551893 public void actionPerformed(ActionEvent event) // , Object arg)
14561894 {
1895
+ Object source = event.getSource();
14571896 /*
14581897 if (event.getSource() == nameField)
14591898 {
....@@ -1465,11 +1904,11 @@
14651904 }
14661905 else
14671906 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1907
+ if (source == lookAtItem || source == lookFromItem)
14691908 {
14701909 ScreenFit();
14711910 } else
1472
- if (event.getSource() == switchItem)
1911
+ if (source == switchViewItem)
14731912 {
14741913 cVector v1 = new cVector();
14751914 cVector v2 = new cVector();
....@@ -1478,11 +1917,11 @@
14781917 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791918 objEditor.cameraView.repaint();
14801919 } else
1481
- if (event.getSource() == rectoidItem)
1920
+ if (source == rectoidItem || source == boxButton)
14821921 {
14831922 makeSomething(new Box());
14841923 } else
1485
- if (event.getSource() == particleItem)
1924
+ if (source == particleItem || source == particlesButton)
14861925 {
14871926 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881927 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1942,9 @@
15031942 applyExample(particleGeom, "SMOKE");
15041943 makeSomething(particleGeom);
15051944 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1945
+ if (source == ragdollItem || source == ragdoll2Item)
15071946 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1947
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091948
15101949 ragdoll.toParent = LA.newMatrix();
15111950 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +1960,71 @@
15211960 makeSomething(ragdoll);
15221961 //makeSomething(new VehicleDemo());
15231962 } else
1524
- if (event.getSource() == gridItem)
1963
+ /*
1964
+ */
1965
+ if (source == heightFieldItem)
1966
+ {
1967
+ Object3D obj = new Object3D();
1968
+
1969
+ obj.CreateMaterial();
1970
+ obj.bRep = new BoundaryRep();
1971
+
1972
+ obj.bRep.CreateMesh(new iHeightField()
1973
+ {
1974
+ public double f(double x, double y)
1975
+ {
1976
+ // The Mandelbrot set is represented by coloring
1977
+ // each point (x,y) according to the number of
1978
+ // iterations it takes before the while loop in
1979
+ // this method ends. For points that are actually
1980
+ // in the Mandelbrot set, or very close to it, the
1981
+ // count will reach the maximum value, 80. These
1982
+ // points will be colored purple. All other colors
1983
+ // represent points that are definitely NOT in the set.
1984
+ x -= 600;
1985
+ y -= 500;
1986
+ x /= 200;
1987
+ y /= 200;
1988
+ int count = 0;
1989
+ double zx = x;
1990
+ double zy = y;
1991
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
1992
+ double new_zx = zx*zx - zy*zy + x;
1993
+ zy = 2*zx*zy + y;
1994
+ zx = new_zx;
1995
+ count++;
1996
+ }
1997
+ return count; // Math.sqrt(count);
1998
+ }
1999
+ }, 1000,1000);
2000
+
2001
+ makeSomething(obj);
2002
+ } else
2003
+ if (source == gridItem || source == gridButton)
15252004 {
15262005 makeSomething(new Grid());
15272006 } else
1528
- if (event.getSource() == ellipsoidItem)
2007
+ if (source == ellipsoidItem || source == sphereButton)
15292008 {
15302009 makeSomething(new Sphere());
15312010 } else
1532
- if (event.getSource() == coneItem)
2011
+ if (source == coneItem || source == coneButton)
15332012 {
15342013 makeSomething(new Cone());
15352014 } else
1536
- if (event.getSource() == torusItem)
2015
+ if (source == torusItem || source == torusButton)
15372016 {
15382017 makeSomething(new Torus());
15392018 } else
1540
- if (event.getSource() == superItem)
2019
+ if (source == superItem || source == superButton)
15412020 {
15422021 makeSomething(new Superellipsoid());
15432022 } else
1544
- if (event.getSource() == blobItem)
2023
+ if (source == kleinItem || source == kleinButton)
2024
+ {
2025
+ makeSomething(new Klein());
2026
+ } else
2027
+ if (source == blobItem)
15452028 {
15462029 Blob blob = new Blob();
15472030 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2032,15 @@
15492032 //blob.retile();
15502033 makeSomething(blob);
15512034 } else
1552
- if (event.getSource() == latheItem)
2035
+ if (source == latheItem)
15532036 {
15542037 makeSomething(new Lathe());
15552038 } else
1556
- if (event.getSource() == bezierItem)
2039
+ if (source == bezierItem)
15572040 {
15582041 makeSomething(new BezierSurface());
15592042 } else
1560
- if (event.getSource() == checkerItem)
2043
+ if (source == overlayItem || source == overlayButton)
15612044 {
15622045 /*
15632046 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2053,9 @@
15702053 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712054 LA.matInvert(obj.toParent, obj.fromParent);
15722055 */
1573
- makeSomething(new CheckerIG());
2056
+ makeSomething(new Checker());
15742057 } else
1575
- if (event.getSource() == meshItem)
2058
+ if (source == meshItem)
15762059 {
15772060 Object3D itemtomake = new Object3D();
15782061 Object3D child;
....@@ -1593,35 +2076,35 @@
15932076 makeSomething(child);
15942077 }
15952078 } else
1596
- if (event.getSource() == springItem)
2079
+ if (source == springItem)
15972080 {
15982081 cSpring s = new cSpring();
15992082 s.setup();
16002083 makeSomething(s);
16012084 } else
1602
- if (event.getSource() == flagItem)
2085
+ if (source == flagItem)
16032086 {
16042087 cSpring s = new cFlag();
16052088 s.setup();
16062089 makeSomething(s);
16072090 } else
1608
- if (event.getSource() == lightItem)
2091
+ if (source == lightItem || source == lightButton)
16092092 {
16102093 makeSomething(new Light());
16112094 } else
1612
- if (event.getSource() == csgItem)
2095
+ if (source == csgItem)
16132096 {
16142097 group(new CSG());
16152098 } else
1616
- if (event.getSource() == templateItem)
2099
+ if (source == templateItem)
16172100 {
16182101 group(new cTemplate());
16192102 } else
1620
- if (event.getSource() == attributeItem)
2103
+ if (source == attributeItem)
16212104 {
16222105 makeSomething(new Attribute());
16232106 } else
1624
- if (event.getSource() == pointflowItem)
2107
+ if (source == pointflowItem)
16252108 {
16262109 makeSomething(new PointFlow());
16272110 } else
....@@ -1633,7 +2116,7 @@
16332116 } else
16342117 */
16352118
1636
- if (event.getSource() == superLoopItem)
2119
+ if (source == superLoopItem)
16372120 {
16382121 Composite g = new cGroup();
16392122 for (int i=0; i<15; i++)
....@@ -1655,30 +2138,30 @@
16552138
16562139 group(g);
16572140 } else
1658
- if (event.getSource() == loopItem)
2141
+ if (source == loopItem || source == loopButton)
16592142 {
16602143 Composite csg = new GroupLeaf();
16612144 csg.count = 5;
16622145 group(csg);
1663
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
16642147 csg.addChild(child);
16652148 child.addChild(csg);
16662149 } else
1667
- if (event.getSource() == doubleItem)
2150
+ if (source == doubleItem)
16682151 {
1669
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
16702153 csg.count = 5;
16712154 group(csg);
1672
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
16732156 csg.addChild(child);
16742157 child.addChild(csg);
1675
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
16762159 csg.addChild(child);
16772160 child.addChild(csg);
16782161 } else
1679
- if (event.getSource() == tripleItem)
2162
+ if (source == tripleItem)
16802163 {
1681
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
16822165 csg.count = 4;
16832166 group(csg);
16842167 Composite child = new cGroup();
....@@ -1691,73 +2174,84 @@
16912174 csg.addChild(child);
16922175 child.addChild(csg);
16932176 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2177
+ if (source == computeAOItem)
16962178 {
1697
- ImportGFD();
2179
+ Globals.drawMode = CameraPane.OCCLUSION;
2180
+ Globals.theRenderer.repaint();
16982181 } 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)
2182
+ if (source == recompileItem)
17172183 {
17182184 Recompile();
17192185 refreshContents();
17202186 } else
1721
- if (event.getSource() == editScriptItem)
2187
+ if (source == editScriptItem)
17222188 {
17232189 OpenDialog();
17242190 refreshContents();
17252191 } else
1726
- if (event.getSource() == invariantsItem)
2192
+ if (source == invariantsItem)
17272193 {
17282194 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2195
+ Grafreed.grafreeD.universe.invariants();
17302196 } else
1731
- if (event.getSource() == memoryItem)
2197
+ if (source == memoryItem)
17322198 {
17332199 //System.out.println("Invariants:");
17342200 PrintMemory();
17352201 } else
1736
- if (event.getSource() == pathItem)
2202
+ if (source == pathItem)
17372203 {
17382204 PrintPath();
17392205 } else
1740
- if (event.getSource() == analyzeItem)
2206
+ if (source == analyzeItem)
17412207 {
17422208 AnalyzeObject();
17432209 } else
1744
- if (event.getSource() == dumpItem)
2210
+ if (source == dumpItem)
17452211 {
17462212 DumpObject();
17472213 } else
1748
- if (event.getSource() == screenfitButton)
2214
+ if (source == minButton)
17492215 {
1750
- //Reload(lastConverter, lastFilename, true);
2216
+ Minimize();
2217
+ } else
2218
+ if (source == maxButton)
2219
+ {
2220
+ Maximize();
2221
+ } else
2222
+ if (source == fullButton)
2223
+ {
2224
+ ToggleFullScreen();
2225
+ } else
2226
+ if (source == undoButton)
2227
+ {
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
2230
+ } else
2231
+ if (source == redoButton)
2232
+ {
2233
+ Redo();
2234
+ } else
2235
+ if (source == saveButton)
2236
+ {
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
2239
+ } else
2240
+ if (source == oneStepButton)
2241
+ {
2242
+ Globals.ONESTEP = true;
2243
+ cameraView.repaint();
2244
+ } else
2245
+ if (source == screenfitButton)
2246
+ {
17512247 ScreenFit();
17522248 } else
1753
- if (event.getSource() == screenfitpointButton)
2249
+ if (source == screenfitpointButton)
17542250 {
1755
- //Reload(lastConverter, lastFilename, true);
17562251 ScreenFitPoint();
17572252 } else
1758
- if (event.getSource() == snapobjectButton)
2253
+ if (source == snapobjectButton)
17592254 {
1760
- //Reload(lastConverter, lastFilename, true);
17612255 SnapObject();
17622256 } else
17632257 // if (event.getSource() == recompileButton)
....@@ -1766,13 +2260,13 @@
17662260 // Recompile();
17672261 // refreshContents();
17682262 // } else
1769
- if (event.getSource() == gcButton)
2263
+ if (source == gcButton)
17702264 {
17712265 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722266 System.gc();
17732267 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742268 } else
1775
- if (event.getSource() == editLeafItem)
2269
+ if (source == editLeafItem)
17762270 {
17772271 Object3D obj;
17782272 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2280,78 @@
17862280 }
17872281 refreshContents(true);
17882282 } else
1789
- if (event.getSource() == openWindowItem)
2283
+ if (source == openWindowItem)
17902284 {
17912285 EditSelection(true);
17922286 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2287
+ if (source == cutItem || source == clearButton)
17942288 {
17952289 loadClipboard(true);
17962290 } else
1797
- if (event.getSource() == duplicateItem)
2291
+ if (source == undoItem)
17982292 {
1799
- Object3D keep = GraphreeD.clipboard;
2293
+ Undo();
2294
+ } else
2295
+ if (source == redoItem)
2296
+ {
2297
+ Redo();
2298
+ } else
2299
+ if (source == duplicateItem)
2300
+ {
2301
+ Object3D keep = Grafreed.clipboard;
18002302 loadClipboard(false);
18012303 paste(false);
1802
- GraphreeD.clipboard = keep;
2304
+ Grafreed.clipboard = keep;
18032305 } else
1804
- if (event.getSource() == cloneItem)
2306
+ if (source == cloneItem)
18052307 {
18062308 CloneSelection(false);
18072309 } else
1808
- if (event.getSource() == cloneSupportItem)
2310
+ if (source == cloneSupportItem)
18092311 {
18102312 CloneSelection(true);
18112313 } else
1812
- if (event.getSource() == copyItem)
2314
+ if (source == copyItem)
18132315 {
18142316 loadClipboard(false);
18152317 } else
1816
- if (event.getSource() == pasteItem)
2318
+ if (source == pasteItem)
18172319 {
18182320 paste(false);
18192321 } else
1820
- if (event.getSource() == pasteLinkItem)
2322
+ if (source == pasteIntoItem)
18212323 {
1822
- pasteInto(false);
2324
+ pasteInto(true, false);
18232325 } else
1824
- if (event.getSource() == pasteCloneItem)
2326
+ if (source == pasteLinkItem)
18252327 {
1826
- pasteInto(true);
2328
+ pasteInto(false, false);
18272329 } else
1828
- if (event.getSource() == pasteExpandItem)
2330
+ if (source == pasteCloneItem)
2331
+ {
2332
+ pasteInto(true, true);
2333
+ } else
2334
+ if (source == pasteExpandItem)
18292335 {
18302336 paste(true);
18312337 } else
1832
- if (event.getSource() == synchronizeItem)
2338
+ if (source == synchronizeItem)
18332339 {
18342340 Overwrite(Object3D.TRANSFORM);
18352341 } else
1836
- if (event.getSource() == overwriteNameItem)
2342
+ if (source == overwriteNameItem)
18372343 {
18382344 Overwrite(Object3D.NAME);
18392345 } else
1840
- if (event.getSource() == overwriteUVItem)
2346
+ if (source == overwriteUVItem)
18412347 {
18422348 Overwrite(Object3D.UV);
18432349 } else
1844
- if (event.getSource() == overwriteMatItem)
2350
+ if (source == overwriteMatItem)
18452351 {
2352
+ /* july 2015
18462353 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2354
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482355 else
18492356 {
18502357 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2363,16 @@
18562363 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572364 }
18582365 }
2366
+ */
2367
+
2368
+ Overwrite(dropAttributes);
18592369 }
1860
- if (event.getSource() == overwriteGeoItem)
2370
+ if (source == overwriteGeoItem)
18612371 {
18622372 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2373
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642374 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2375
+// Object3D content = GrafreeD.clipboard.get(0);
18662376 //
18672377 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682378 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2384,7 @@
18742384 // refreshContents();
18752385 // }
18762386 } else
1877
- if (event.getSource() == generateMeshItem)
2387
+ if (source == generateMeshItem)
18782388 {
18792389 //if (group.selection.size() == 1)
18802390 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2395,7 @@
18852395 ResetModel();
18862396 refreshContents();
18872397 } else
1888
- if (event.getSource() == extractGeometriesItem)
2398
+ if (source == extractGeometriesItem)
18892399 {
18902400 boolean one = false;
18912401
....@@ -1912,7 +2422,7 @@
19122422 ResetModel();
19132423 refreshContents();
19142424 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2425
+ if (source == cloneGeometriesItem)
19162426 {
19172427 boolean one = false;
19182428
....@@ -1938,32 +2448,37 @@
19382448 ResetModel();
19392449 refreshContents();
19402450 } else
1941
- if (event.getSource() == shareGeometriesItem)
2451
+ if (source == shareGeometriesItem)
19422452 {
19432453 boolean one = false;
19442454
19452455 if (group.selection.size() == 1)
19462456 one = true;
19472457
2458
+ Object3D merge = null;
2459
+
19482460 Object3D content = new cGroup();
19492461
19502462 for (int i=0; i<group.selection.size(); i++)
19512463 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2464
+ merge = new Merge(group.selection.get(i));
19532465
19542466 if (one)
1955
- makeSomething(sel, false);
2467
+ makeSomething(merge, false);
19562468 else
1957
- content.addChild(sel);
2469
+ content.addChild(merge);
19582470 }
19592471
19602472 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2473
+ makeSomething(content, true);
2474
+ else
2475
+ {
2476
+ ResetModel();
2477
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2478
+ refreshContents();
2479
+ }
19652480 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2481
+ if (source == mergeGeometriesItem)
19672482 {
19682483 boolean one = false;
19692484
....@@ -1993,11 +2508,11 @@
19932508 ResetModel();
19942509 refreshContents();
19952510 } else
1996
- if (event.getSource() == linkverticesItem)
2511
+ if (source == linkverticesItem)
19972512 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2513
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992514 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2515
+// Object3D content = GrafreeD.clipboard.get(0);
20012516 //
20022517 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032518 // content = ((cGroup)content).get(0);
....@@ -2006,39 +2521,48 @@
20062521 // group.selection.get(0).setMasterThis(content); // should be identity
20072522 // refreshContents();
20082523 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2524
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20102525 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2526
+ Object3D content = Grafreed.clipboard.get(0);
20122527
20132528 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142529 content = ((cGroup)content).get(0);
20152530
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2531
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172532 for (int i=0; i<group.selection.size(); i++)
20182533 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
2534
+ boolean random = CameraPane.SWITCH;
2535
+ CameraPane.SWITCH = false; // parse all random nodes
20212536 group.selection.get(i).linkVerticesThis(content);
20222537 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
2538
+ CameraPane.SWITCH = random;
20242539 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2540
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262541 refreshContents();
20272542 }
20282543 } else
2029
- if (event.getSource() == resetsupportItem)
2544
+ if (source == resetsupportItem)
20302545 {
20312546 for (int i=0; i<group.selection.size(); i++)
20322547 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
2548
+ boolean random = CameraPane.SWITCH;
2549
+ CameraPane.SWITCH = false; // parse all random nodes
20352550 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
2551
+ CameraPane.SWITCH = random;
20372552 }
20382553
20392554 refreshContents();
20402555 } else
2041
- if (event.getSource() == resetreferencesItem)
2556
+ if (source == relinkverticesItem)
2557
+ {
2558
+ boolean random = CameraPane.SWITCH;
2559
+ CameraPane.SWITCH = false; // parse all random nodes
2560
+ group.selection.RelinkToSupport();
2561
+ CameraPane.SWITCH = random;
2562
+
2563
+ refreshContents();
2564
+ } else
2565
+ if (source == resetreferencesItem)
20422566 {
20432567 for (int i=0; i<group.selection.size(); i++)
20442568 {
....@@ -2047,11 +2571,11 @@
20472571
20482572 refreshContents();
20492573 } else
2050
- if (event.getSource() == setMasterItem)
2574
+ if (source == setMasterItem)
20512575 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2576
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20532577 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2578
+ Object3D content = Grafreed.clipboard.get(0);
20552579
20562580 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572581 content = ((cGroup)content).get(0);
....@@ -2060,13 +2584,13 @@
20602584 refreshContents();
20612585 }
20622586 } else
2063
- if (event.getSource() == poseMeshItem)
2587
+ if (source == poseMeshItem)
20642588 {
20652589 if (group.selection.size() == 1)
20662590 {
2067
- if (GraphreeD.clipboard.size() == 1)
2591
+ if (Grafreed.clipboard.size() == 1)
20682592 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2593
+ Object3D content = Grafreed.clipboard.get(0);
20702594
20712595 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722596 content = ((cGroup)content).get(0);
....@@ -2079,19 +2603,19 @@
20792603 }
20802604
20812605 } else
2082
- if (event.getSource() == revertMeshItem)
2606
+ if (source == revertMeshItem)
20832607 {
20842608 RevertMeshes();
20852609 } else
2086
- if (event.getSource() == resetMeshItem)
2610
+ if (source == resetAllItem)
20872611 {
20882612 ResetAll();
20892613 } else
2090
- if (event.getSource() == stepAllItem)
2614
+ if (source == stepAllItem)
20912615 {
20922616 StepAll();
20932617 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2618
+ if (source == clearItem) // || event.getSource() == clearButton)
20952619 {
20962620 //int indices[] = jList.getSelectedIndices();
20972621 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2623,46 @@
20992623
21002624 ClearSelection(false);
21012625 } else
2102
- if (event.getSource() == clearAllItem)
2626
+ if (source == clearAllItem)
21032627 {
21042628 ClearSelection(true);
21052629 } else
2106
- if (event.getSource() == grabItem)
2630
+ if (source == grabItem || source == groupButton)
21072631 {
2108
- group(new cGroup(), true);
2632
+ group(new cGroup(), false); // true);
21092633 } else
2110
- if (event.getSource() == frontItem)
2634
+ if (source == hideItem)
2635
+ {
2636
+ group(new HiddenObject());
2637
+ } else
2638
+ if (source == frontItem)
21112639 {
21122640 front();
21132641 } else
2114
- if (event.getSource() == backItem)
2642
+ if (source == backItem)
21152643 {
21162644 back();
21172645 } else
2118
- if (event.getSource() == cameraItem)
2646
+ if (source == cameraItem)
21192647 {
21202648 makeSomething(new Camera());
21212649 } else
2122
- if (event.getSource() == compositeItem)
2650
+ if (source == compositeItem || source == compositeButton)
21232651 {
21242652 group(new Composite());
21252653 } else
2126
- if (event.getSource() == randomItem)
2654
+ if (source == switchItem || source == switchButton)
21272655 {
21282656 RandomNode random = new RandomNode();
21292657 group(random);
21302658 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
2659
+ random.name = random.get(0).name + "Switch";
21322660 } else
2133
- if (event.getSource() == physicsItem)
2661
+ if (source == physicsItem)
21342662 {
21352663 group(new PhysicsNode());
21362664 } else
2137
- if (event.getSource() == frameselectorItem)
2665
+ if (source == frameselectorItem)
21382666 {
21392667 for (int i=0; i<group.selection.size(); i++)
21402668 {
....@@ -2146,7 +2674,7 @@
21462674 ResetModel();
21472675 refreshContents();
21482676 } else
2149
- if (event.getSource() == switchGeoItem)
2677
+ if (source == switchGeoItem)
21502678 {
21512679 for (int i=0; i<group.selection.size(); i++)
21522680 {
....@@ -2158,7 +2686,7 @@
21582686 ResetModel();
21592687 refreshContents();
21602688 } else
2161
- if (event.getSource() == switchTransfoItem)
2689
+ if (source == switchTransfoItem)
21622690 {
21632691 for (int i=0; i<group.selection.size(); i++)
21642692 {
....@@ -2170,7 +2698,7 @@
21702698 ResetModel();
21712699 refreshContents();
21722700 } else
2173
- if (event.getSource() == morphItem)
2701
+ if (source == morphItem)
21742702 {
21752703 for (int i=0; i<group.selection.size(); i++)
21762704 {
....@@ -2182,7 +2710,7 @@
21822710 ResetModel();
21832711 refreshContents();
21842712 } else
2185
- if (event.getSource() == scriptNodeItem)
2713
+ if (source == scriptNodeItem)
21862714 {
21872715 boolean atleastone = false;
21882716
....@@ -2221,191 +2749,252 @@
22212749 }
22222750 }
22232751 } else
2224
- if (event.getSource() == linkerItem)
2752
+ if (source == linkerItem)
22252753 {
22262754 group(new cLinker());
22272755 } else
2228
- if (event.getSource() == textureItem)
2756
+ if (source == textureItem || source == textureButton)
22292757 {
22302758 group(new TextureNode());
22312759 } else
2232
- if (event.getSource() == shadowXItem)
2760
+ if (source == billboardItem)
2761
+ {
2762
+ group(new BillboardNode());
2763
+ } else
2764
+ if (source == shadowXItem)
22332765 {
22342766 CastShadow(0);
22352767 } else
2236
- if (event.getSource() == shadowYItem)
2768
+ if (source == shadowYItem)
22372769 {
22382770 CastShadow(1);
22392771 } else
2240
- if (event.getSource() == shadowZItem)
2772
+ if (source == shadowZItem)
22412773 {
22422774 CastShadow(2);
22432775 } else
2244
- if (event.getSource() == ungroupItem)
2776
+ if (source == ungroupItem || source == ungroupButton)
22452777 {
2246
- ungroup();
2778
+ boolean hasRoot = false;
2779
+
2780
+ for (int i=0; i<group.selection.size(); i++)
2781
+ {
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
2787
+ }
2788
+
2789
+ if (!hasRoot)
2790
+ {
2791
+ for (int i=0; i<group.selection.size(); i++)
2792
+ {
2793
+ Ungroup(group.selection.get(i));
2794
+ }
2795
+
2796
+ ClearSelection(false);
2797
+
2798
+ refreshContents();
2799
+ }
22472800 } else
2248
- if (event.getSource() == genUVItem)
2801
+ if (source == genUVItem)
22492802 {
22502803 GenUV();
22512804 } else
2252
- if (event.getSource() == genNormalsCADItem)
2805
+ if (source == genNormalsCADItem)
22532806 {
22542807 GenNormals(true);
22552808 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2809
+ if (source == genNormalsMESHItem)
2810
+ {
2811
+ GenNormalsMESH();
2812
+ } else
2813
+ if (source == genNormalsORGANItem)
22572814 {
22582815 GenNormals(false);
22592816 } else
2260
- if (event.getSource() == stripifyItem)
2817
+ if (source == genNormalsMINEItem)
2818
+ {
2819
+ GenNormalsMINE();
2820
+ } else
2821
+ if (source == stripifyItem)
22612822 {
22622823 Stripify();
22632824 } else
2264
- if (event.getSource() == unstripifyItem)
2825
+ if (source == unstripifyItem)
22652826 {
22662827 Unstripify();
22672828 } else
2268
- if (event.getSource() == trimItem)
2829
+ if (source == trimItem)
22692830 {
22702831 Trim();
22712832 } else
2272
- if (event.getSource() == untrimItem)
2833
+ if (source == untrimItem)
22732834 {
22742835 Untrim();
22752836 } else
2276
- if (event.getSource() == clearColorsItem)
2837
+ if (source == clearColorsItem)
22772838 {
22782839 ClearColors();
22792840 } else
2280
- if (event.getSource() == clearMaterialsItem)
2841
+ if (source == clearMaterialsItem)
22812842 {
22822843 ClearMaterials();
22832844 } else
2284
- if (event.getSource() == liveleavesItem)
2845
+ if (source == liveleavesItem)
22852846 {
22862847 LiveLeaves(true);
22872848 } else
2288
- if (event.getSource() == unliveleavesItem)
2849
+ if (source == unliveleavesItem)
22892850 {
22902851 LiveLeaves(false);
22912852 } else
2292
- if (event.getSource() == supportleavesItem)
2853
+ if (source == supportleavesItem)
22932854 {
22942855 SupportLeaves(true);
22952856 } else
2296
- if (event.getSource() == unsupportleavesItem)
2857
+ if (source == unsupportleavesItem)
22972858 {
22982859 SupportLeaves(false);
22992860 } else
2300
- if (event.getSource() == hideleavesItem)
2861
+ if (source == hideleavesItem)
23012862 {
23022863 HideLeaves(true);
23032864 } else
2304
- if (event.getSource() == showleavesItem)
2865
+ if (source == showleavesItem)
23052866 {
23062867 HideLeaves(false);
23072868 } else
2308
- if (event.getSource() == markleavesItem)
2869
+ if (source == markleavesItem)
23092870 {
23102871 MarkLeaves(true);
23112872 } else
2312
- if (event.getSource() == unmarkleavesItem)
2873
+ if (source == unmarkleavesItem)
23132874 {
23142875 MarkLeaves(false);
23152876 } else
2316
- if (event.getSource() == flipVItem)
2877
+ if (source == rewindleavesItem)
2878
+ {
2879
+ RewindLeaves(true);
2880
+ } else
2881
+ if (source == unrewindleavesItem)
2882
+ {
2883
+ RewindLeaves(false);
2884
+ } else
2885
+ if (source == randomleavesItem)
2886
+ {
2887
+ RandomLeaves(true);
2888
+ } else
2889
+ if (source == unrandomleavesItem)
2890
+ {
2891
+ RandomLeaves(false);
2892
+ } else
2893
+ if (source == flipVItem)
23172894 {
23182895 FlipV(true);
23192896 } else
2320
- if (event.getSource() == unflipVItem)
2897
+ if (source == unflipVItem)
23212898 {
23222899 FlipV(false);
23232900 } else
2324
- if (event.getSource() == lowTexturesItem)
2901
+ if (source == lowTexturesItem)
23252902 {
23262903 SetTexRes(0);
23272904 } else
2328
- if (event.getSource() == normalTexturesItem)
2905
+ if (source == normalTexturesItem)
23292906 {
23302907 SetTexRes(1);
23312908 } else
2332
- if (event.getSource() == highTexturesItem)
2909
+ if (source == highTexturesItem)
23332910 {
23342911 SetTexRes(2);
23352912 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2913
+ if (source == veryhighTexturesItem)
23372914 {
23382915 SetTexRes(3);
23392916 } else
2340
- if (event.getSource() == maxTexturesItem)
2917
+ if (source == maxTexturesItem)
23412918 {
23422919 SetTexRes(4);
23432920 } else
2344
- if (event.getSource() == panoTexturesItem)
2921
+ if (source == panoTexturesItem)
23452922 {
23462923 SetTexRes(5);
23472924 } else
2348
- if (event.getSource() == reverseNormalsItem)
2925
+ if (source == reverseNormalsItem)
23492926 {
23502927 ReverseNormals();
23512928 } else
2352
- if (event.getSource() == parseverticesItem)
2929
+ if (source == parseverticesItem)
23532930 {
23542931 ParseVertices();
23552932 } else
2356
- if (event.getSource() == alignItem)
2933
+ if (source == textureFieldItem)
2934
+ {
2935
+ TextureVertices();
2936
+ } else
2937
+ if (source == alignItem)
23572938 {
23582939 Align();
23592940 } else
2360
- if (event.getSource() == mirrorItem)
2941
+ if (source == mirrorItem)
23612942 {
23622943 MirrorPoses();
23632944 } else
2364
- if (event.getSource() == reduceMorphItem)
2945
+ if (source == reduceMorphItem)
23652946 {
23662947 MeshReduction(false);
23672948 } else
2368
- if (event.getSource() == reduce34MorphItem)
2949
+ if (source == reduce34MorphItem)
23692950 {
23702951 MeshReduction(true);
23712952 } else
2372
- if (event.getSource() == reverseTrianglesItem)
2953
+ if (source == reverseTrianglesItem)
23732954 {
23742955 ReverseTriangles();
23752956 } else
2376
- if (event.getSource() == reduceMeshItem)
2957
+ if (source == reduceMeshItem)
23772958 {
23782959 ReduceMesh(false);
23792960 } else
2380
- if (event.getSource() == reduce34MeshItem)
2961
+ if (source == reduce34MeshItem)
23812962 {
23822963 ReduceMesh(true);
23832964 } else
2384
- if (event.getSource() == increaseMeshItem)
2965
+ if (source == increaseMeshItem)
23852966 {
23862967 IncreaseMesh();
23872968 } else
2388
- if (event.getSource() == clipMeshItem)
2969
+ if (source == clipMeshItem)
23892970 {
23902971 ClipMesh();
23912972 } else
2392
- if (event.getSource() == smoothMeshItem)
2973
+ if (source == smoothMeshItem)
23932974 {
23942975 SmoothMesh();
23952976 } else
2396
- if (event.getSource() == transformgeometryItem)
2977
+ if (source == transformGeometryItem)
23972978 {
23982979 TransformGeometry();
23992980 } else
2400
- if (event.getSource() == resetTransformItem)
2981
+ if (source == transformChildrenItem)
2982
+ {
2983
+ TransformChildren();
2984
+ } else
2985
+ if (source == resetTransformItem)
24012986 {
24022987 ResetTransform();
24032988 } else
2404
- if (event.getSource() == resetCentroidItem)
2989
+ if (source == resetCentroidItem)
24052990 {
2406
- ResetCentroid();
2991
+ ResetCentroid(true);
24072992 } else
2408
- if (event.getSource() == resetParentItem)
2993
+ if (source == resetCentroidXZItem)
2994
+ {
2995
+ ResetCentroid(false);
2996
+ } else
2997
+ if (source == resetParentItem)
24092998 {
24102999 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24113000 {
....@@ -2415,7 +3004,7 @@
24153004
24163005 refreshContents();
24173006 } else
2418
- if (event.getSource() == repairParentItem)
3007
+ if (source == repairParentItem)
24193008 {
24203009 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24213010 {
....@@ -2429,7 +3018,21 @@
24293018
24303019 refreshContents();
24313020 } else
2432
- if (event.getSource() == sortbysizeItem)
3021
+ if (source == repairShadowItem)
3022
+ {
3023
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3024
+ {
3025
+ Object3D obj = (Object3D)e.nextElement();
3026
+ obj.RepairShadow();
3027
+// for (int i=0; i<obj.size(); i++)
3028
+// {
3029
+// obj.get(i).parent = obj;
3030
+// }
3031
+ }
3032
+
3033
+ refreshContents();
3034
+ } else
3035
+ if (source == sortbysizeItem)
24333036 {
24343037 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353038 {
....@@ -2441,7 +3044,7 @@
24413044 ResetModel();
24423045 refreshContents();
24433046 } else
2444
- if (event.getSource() == sortbynameItem)
3047
+ if (source == sortbynameItem)
24453048 {
24463049 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473050 {
....@@ -2453,7 +3056,7 @@
24533056 ResetModel();
24543057 refreshContents();
24553058 } else
2456
- if (event.getSource() == attachPigmentItem)
3059
+ if (source == attachPigmentItem)
24573060 {
24583061 String texture = GetFile("Attach pigment");
24593062 Object3D obj;
....@@ -2465,7 +3068,7 @@
24653068
24663069 refreshContents();
24673070 } else
2468
- if (event.getSource() == detachPigmentItem)
3071
+ if (source == detachPigmentItem)
24693072 {
24703073 Object3D obj;
24713074 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3079,7 @@
24763079
24773080 refreshContents();
24783081 } else
2479
- if (event.getSource() == attachBumpItem)
3082
+ if (source == attachBumpItem)
24803083 {
24813084 String texture = GetFile("Attach bump");
24823085 Object3D obj;
....@@ -2488,7 +3091,7 @@
24883091
24893092 refreshContents();
24903093 } else
2491
- if (event.getSource() == detachBumpItem)
3094
+ if (source == detachBumpItem)
24923095 {
24933096 Object3D obj;
24943097 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +3102,7 @@
24993102
25003103 refreshContents();
25013104 } else
2502
- if (event.getSource() == pigmentBumpItem)
3105
+ if (source == pigmentBumpItem)
25033106 {
25043107 Object3D obj;
25053108 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +3113,237 @@
25103113
25113114 refreshContents();
25123115 } else
2513
- if (event.getSource() == flashSelectionButton)
3116
+ if (source == flashSelectionButton)
25143117 {
25153118 CameraPane.flash = true;
25163119 refreshContents();
25173120 } else
2518
- if (event.getSource() == oneButton)
3121
+ if (source == oneButton)
25193122 {
25203123 } else
2521
- if (event.getSource() == twoButton)
3124
+ if (source == twoButton)
25223125 {
25233126 radio.layout = twoButton;
3127
+
3128
+ if (CameraPane.FULLSCREEN)
3129
+ fullscreenLayout = radio.layout;
3130
+
25243131 // bug
25253132 //gridPanel.setDividerLocation(1.0);
25263133 //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();
3134
+// bigThree.remove(scenePanel);
3135
+// bigThree.remove(centralPanel);
3136
+// bigThree.remove(XYZPanel);
3137
+// aWindowConstraints.gridx = 0;
3138
+// aWindowConstraints.gridy = 0;
3139
+// aWindowConstraints.gridwidth = 1;
3140
+// // aConstraints.gridheight = 3;
3141
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3142
+// aWindowConstraints.weightx = 0;
3143
+// aWindowConstraints.weighty = 1;
3144
+// //bigThree.add(jtp, aWindowConstraints);
3145
+// aWindowConstraints.weightx = 1;
3146
+// aWindowConstraints.gridwidth = 3;
3147
+// // aConstraints.gridheight = 3;
3148
+// aWindowConstraints.gridx = 1;
3149
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3150
+// bigThree.add(centralPanel, aWindowConstraints);
3151
+// aWindowConstraints.weightx = 0;
3152
+// aWindowConstraints.gridx = 4;
3153
+// aWindowConstraints.gridwidth = 1;
3154
+// // aConstraints.gridheight = 3;
3155
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3156
+// //bigThree.add(XYZPanel, aWindowConstraints);
3157
+// scenePanel.setVisible(false);
3158
+// centralPanel.setVisible(true);
3159
+// XYZPanel.setVisible(false);
3160
+ bigThree.ClearUI();
3161
+ bigThree.add(centralPanel);
3162
+ bigThree.FlushUI();
3163
+
3164
+ cameraView.requestFocusInWindow();
3165
+
3166
+// refreshContents(true);
3167
+//
3168
+// try
3169
+// {
3170
+// java.awt.Robot bot = new java.awt.Robot();
3171
+// int mask = InputEvent.BUTTON1_MASK;
3172
+// bot.mouseMove(100, 100);
3173
+// bot.mousePress(mask);
3174
+// bot.mouseRelease(mask);
3175
+// }
3176
+// catch (Exception e)
3177
+// {
3178
+//
3179
+// }
3180
+
25513181 } else
2552
- if (event.getSource() == threeButton)
3182
+ if (source == threeButton)
25533183 {
25543184 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();
3185
+
3186
+ if (CameraPane.FULLSCREEN)
3187
+ fullscreenLayout = radio.layout;
3188
+
3189
+// bigThree.remove(scenePanel);
3190
+// bigThree.remove(centralPanel);
3191
+// bigThree.remove(XYZPanel);
3192
+// aWindowConstraints.gridx = 0;
3193
+// aWindowConstraints.gridy = 0;
3194
+// aWindowConstraints.gridwidth = 1;
3195
+// // aConstraints.gridheight = 3;
3196
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3197
+// aWindowConstraints.weightx = 0;
3198
+// aWindowConstraints.weighty = 1;
3199
+// //bigThree.add(jtp, aWindowConstraints);
3200
+// aWindowConstraints.weightx = 1;
3201
+// aWindowConstraints.gridwidth = 3;
3202
+// // aConstraints.gridheight = 3;
3203
+// aWindowConstraints.gridx = 1;
3204
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3205
+// bigThree.add(centralPanel, aWindowConstraints);
3206
+// aWindowConstraints.weightx = 0;
3207
+// aWindowConstraints.gridx = 4;
3208
+// aWindowConstraints.gridwidth = 1;
3209
+// // aConstraints.gridheight = 3;
3210
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3211
+// bigThree.add(XYZPanel, aWindowConstraints);
3212
+// bigThree.validate();
3213
+// scenePanel.setVisible(false);
3214
+// centralPanel.setVisible(true);
3215
+// XYZPanel.setVisible(true);
3216
+ bigThree.ClearUI();
3217
+ bigThree.add(centralPanel);
3218
+ bigThree.add(XYZPanel);
3219
+ bigThree.FlushUI();
3220
+
3221
+ cameraView.requestFocusInWindow();
25793222 } else
2580
- if (event.getSource() == fourButton)
3223
+ if (source == fourButton)
25813224 {
25823225 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();
3226
+
3227
+ if (CameraPane.FULLSCREEN)
3228
+ fullscreenLayout = radio.layout;
3229
+
3230
+// bigThree.remove(scenePanel);
3231
+// bigThree.remove(centralPanel);
3232
+// bigThree.remove(XYZPanel);
3233
+// aWindowConstraints.gridx = 0;
3234
+// aWindowConstraints.gridy = 0;
3235
+// aWindowConstraints.gridwidth = 1;
3236
+// // aWindowConstraints.gridheight = 3;
3237
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3238
+// aWindowConstraints.weightx = 1;
3239
+// aWindowConstraints.weighty = 1;
3240
+// bigThree.add(scenePanel, aWindowConstraints);
3241
+// aWindowConstraints.weightx = 1;
3242
+// aWindowConstraints.gridwidth = 3;
3243
+// // aConstraints.gridheight = 3;
3244
+// aWindowConstraints.gridx = 1;
3245
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3246
+// //bigThree.add(cameraPanel, aWindowConstraints);
3247
+// aWindowConstraints.weightx = 0;
3248
+// aWindowConstraints.gridx = 4;
3249
+// aWindowConstraints.gridwidth = 1;
3250
+// // aWindowConstraints.gridheight = 3;
3251
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3252
+// //bigThree.add(XYZPanel, aWindowConstraints);
3253
+// bigThree.validate();
3254
+// scenePanel.setVisible(true);
3255
+// centralPanel.setVisible(false);
3256
+// XYZPanel.setVisible(false);
3257
+ bigThree.ClearUI();
3258
+ bigThree.add(scenePanel);
3259
+ bigThree.FlushUI();
3260
+
3261
+ cameraView.requestFocusInWindow();
26073262 } else
2608
- if (event.getSource() == sixButton)
3263
+ if (source == sixButton)
26093264 {
26103265 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();
3266
+
3267
+ if (CameraPane.FULLSCREEN)
3268
+ fullscreenLayout = radio.layout;
3269
+
3270
+// bigThree.remove(scenePanel);
3271
+// bigThree.remove(centralPanel);
3272
+// bigThree.remove(XYZPanel);
3273
+// aWindowConstraints.gridx = 0;
3274
+// aWindowConstraints.gridy = 0;
3275
+// aWindowConstraints.gridwidth = 1;
3276
+// // aConstraints.gridheight = 3;
3277
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3278
+// aWindowConstraints.weightx = 0;
3279
+// aWindowConstraints.weighty = 1;
3280
+// bigThree.add(scenePanel, aWindowConstraints);
3281
+// aWindowConstraints.weightx = 1;
3282
+// aWindowConstraints.gridwidth = 3;
3283
+// // aWindowConstraints.gridheight = 3;
3284
+// aWindowConstraints.gridx = 1;
3285
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3286
+// bigThree.add(centralPanel, aWindowConstraints);
3287
+// aWindowConstraints.weightx = 0;
3288
+// aWindowConstraints.gridx = 4;
3289
+// aWindowConstraints.gridwidth = 1;
3290
+// // aWindowConstraints.gridheight = 3;
3291
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3292
+// //bigThree.add(XYZPanel, aConstraints);
3293
+// bigThree.validate();
3294
+// scenePanel.setVisible(true);
3295
+// centralPanel.setVisible(true);
3296
+// XYZPanel.setVisible(false);
3297
+ bigThree.ClearUI();
3298
+ bigThree.add(scenePanel);
3299
+ bigThree.add(centralPanel);
3300
+ bigThree.FlushUI();
3301
+
3302
+ cameraView.requestFocusInWindow();
26353303 } else
2636
- if (event.getSource() == sevenButton)
3304
+ if (source == sevenButton)
26373305 {
26383306 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();
3307
+
3308
+ if (CameraPane.FULLSCREEN)
3309
+ fullscreenLayout = radio.layout;
3310
+
3311
+// bigThree.remove(scenePanel);
3312
+// bigThree.remove(centralPanel);
3313
+// bigThree.remove(XYZPanel);
3314
+// aWindowConstraints.gridx = 0;
3315
+// aWindowConstraints.gridy = 0;
3316
+// aWindowConstraints.gridwidth = 1;
3317
+// // aWindowConstraints.gridheight = 3;
3318
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3319
+// aWindowConstraints.weightx = 0;
3320
+// aWindowConstraints.weighty = 1;
3321
+// bigThree.add(scenePanel, aWindowConstraints);
3322
+// aWindowConstraints.weightx = 1;
3323
+// aWindowConstraints.gridwidth = 3;
3324
+// // aWindowConstraints.gridheight = 3;
3325
+// aWindowConstraints.gridx = 1;
3326
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3327
+// bigThree.add(centralPanel, aWindowConstraints);
3328
+// aWindowConstraints.weightx = 0;
3329
+// aWindowConstraints.gridx = 4;
3330
+// aWindowConstraints.gridwidth = 1;
3331
+// // aConstraints.gridheight = 3;
3332
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3333
+// bigThree.add(XYZPanel, aWindowConstraints);
3334
+// bigThree.validate();
3335
+// scenePanel.setVisible(true);
3336
+// centralPanel.setVisible(true);
3337
+// XYZPanel.setVisible(true);
3338
+ bigThree.ClearUI();
3339
+ bigThree.add(scenePanel);
3340
+ bigThree.add(centralPanel);
3341
+ bigThree.add(XYZPanel);
3342
+ bigThree.FlushUI();
3343
+
3344
+ cameraView.requestFocusInWindow();
26633345 } else
2664
- if (event.getSource() == rootButton)
3346
+ if (source == rootButton)
26653347 {
26663348 Object3D obj;
26673349 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2671,66 +3353,84 @@
26713353 EditObject(obj);
26723354 }
26733355
3356
+ cameraView.requestFocusInWindow();
26743357 refreshContents(true);
26753358 } else
2676
- if (event.getSource() == closeButton)
3359
+ if (source == closeButton)
26773360 {
26783361 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793362 cRadio ab;
26803363 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813364 {
26823365 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3366
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843367 {
3368
+ // Patch to avoid bug with transparency.
3369
+ if (!ab.hadMaterial)
3370
+ {
3371
+ ab.object.material = null;
3372
+ }
3373
+
26853374 buttonGroup.remove(ab);
26863375 radioPanel.remove(ab);
26873376
2688
- ab.GetObject().editWindow = null;
3377
+ //ab.GetObject().editWindow = null;
3378
+ ab.GetObject().manipWindow = null;
26893379 // ab.GetObject().objectUI = null; // ?????????
26903380
26913381 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923382 break;
26933383 }
26943384 }
3385
+
3386
+ cameraView.requestFocusInWindow();
26953387 refreshContents(true);
26963388 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3389
+ if (source == editItem || source == editButton)
26983390 {
3391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3392
+ {
3393
+ Object3D child = (Object3D)e.nextElement();
3394
+ child.pinned = true;
3395
+ }
3396
+
26993397 EditSelection(false);
27003398 } else
2701
- if (event.getSource() == uneditButton)
3399
+ if (source == uneditButton)
27023400 {
27033401 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043402 {
27053403 Object3D child = (Object3D)e.nextElement();
27063404 if(child.editWindow != null)
27073405 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3406
+ child.pinned = false;
27083407 child.CloseUI();
27093408 listUI.remove(child);
27103409
2711
- child.editWindow = null; // ???????????
3410
+ //child.editWindow = null; // ???????????
27123411 }
2713
- objEditor.ctrlPanel.revalidate();
3412
+ objEditor.ctrlPanel.FlushUI();
27143413 //objEditor.jTree.clearSelection();
27153414 //objEditor.ResetSliders();
27163415 refreshContents(true);
27173416 } else
2718
- if (event.getSource() == clearPanelButton)
3417
+ if (source == clearPanelButton)
27193418 {
27203419 assert(copy == group);
27213420 //copy.ClearUI();
27223421 for (Object3D obj : listUI)
27233422 {
3423
+ obj.pinned = false;
27243424 obj.CloseUI();
27253425 }
27263426 listUI.clear();
27273427 refreshContents(true);
27283428 } else
2729
- if (event.getSource() == allParamsButton)
3429
+ if (source == allParamsButton)
27303430 {
27313431 assert(copy == group);
27323432
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3433
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27343434
27353435 for (Object3D obj : listUI)
27363436 {
....@@ -2747,19 +3447,19 @@
27473447
27483448 refreshContents(true);
27493449 } else
2750
- if (event.getSource() == unselectButton)
3450
+ if (source == unselectButton)
27513451 {
27523452 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3453
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543454 objEditor.ResetSliders();
27553455 refreshContents(true);
27563456 } else
2757
- if(event.getSource() instanceof cRadio)
3457
+ if(source instanceof cRadio)
27583458 {
27593459 group.parent = keepparent;
27603460 group.attributes = 0;
27613461 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3462
+ /*cRadio*/ radio = (cRadio)source;
27633463 Object3D obj = radio.GetObject();
27643464 System.out.println("Edit " + obj);
27653465 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +3479,7 @@
27793479 }
27803480
27813481 copy = group;
2782
- //CameraPane.theRenderer.object = group;
3482
+ //Globals.theRenderer.object = group;
27833483 if(!useclient)
27843484 {
27853485 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +3488,50 @@
27883488 cameraView.cameras[cameraView.cameracount] = radio.camera;
27893489 cameraView.targetLookAt.set(radio.camera.lookAt);
27903490 cameraView.object = group;
2791
- cameraView.lighttouched = true;
3491
+ //cameraView.lighttouched = true;
3492
+ Globals.lighttouched = true;
27923493 topView.object = group;
27933494 frontView.object = group;
27943495 sideView.object = group;
27953496 }
2796
- group.editWindow = this;
3497
+
3498
+// fix "+" issue
3499
+ //group.editWindow = this;
3500
+ group.manipWindow = this;
3501
+
27973502 /*
27983503 currentLayout = radio.layout;
27993504 if (currentLayout == null)
28003505 currentLayout = sevenButton;
28013506 */
28023507 radio.layout.doClick();
3508
+
3509
+ ClearUnpinned();
3510
+ SetPinStates(group.selection.size() > 0);
3511
+ if (group.selection.size() == 1)
3512
+ EditSelection(false);
28033513 keepparent = group.parent;
28043514 // PARENT = NULL or not???
28053515 //group.parent = null; // ROOT
28063516 //group.attributes = -1;
28073517 ResetModel();
3518
+
3519
+ cameraView.requestFocusInWindow();
28083520 refreshContents(true);
2809
- }
3521
+ } else if (event.getSource() == editCameraItem)
3522
+ {
3523
+ cameraView.ProtectCamera();
3524
+ cameraView.repaint();
3525
+ return;
3526
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3527
+ {
3528
+ cameraView.RevertCamera();
3529
+ cameraView.repaint();
3530
+ return;
3531
+ // } else if (event.getSource() == textureButton)
3532
+ // {
3533
+ // return; // true;
3534
+ }
28103535 else
28113536 {
28123537 //return super.action(event, arg);
....@@ -2815,7 +3540,6 @@
28153540 }
28163541
28173542 boolean useclient = false;
2818
- cRadio radio;
28193543
28203544 void ToggleRoot()
28213545 {
....@@ -2824,7 +3548,7 @@
28243548 if (useclient)
28253549 {
28263550 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3551
+ Globals.lighttouched = true;
28283552 //topView.object = client;
28293553 //frontView.object = client;
28303554 //sideView.object = client;
....@@ -2832,7 +3556,7 @@
28323556 else
28333557 {
28343558 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3559
+ Globals.lighttouched = true;
28363560 //topView.object = group;
28373561 //frontView.object = group;
28383562 //sideView.object = group;
....@@ -2867,6 +3591,28 @@
28673591 refreshContents();
28683592 }
28693593
3594
+ void TransformChildren()
3595
+ {
3596
+ Object3D obj;
3597
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3598
+ {
3599
+ obj = (Object3D)e.nextElement();
3600
+ obj.KeepTextureMatrices();
3601
+ obj.TransformChildren();
3602
+ obj.RestoreTextureMatrices();
3603
+
3604
+// if (obj.parent == null)
3605
+// {
3606
+// System.out.println("NULL PARENT!");
3607
+// new Exception().printStackTrace();
3608
+// }
3609
+// else
3610
+// TouchTransform(obj);
3611
+// //obj.parent.Touch();
3612
+ }
3613
+
3614
+ refreshContents();
3615
+ }
28703616
28713617 void ResetTransform()
28723618 {
....@@ -2979,7 +3725,7 @@
29793725 refreshContents();
29803726 }
29813727
2982
- void ResetCentroid()
3728
+ void ResetCentroid(boolean full)
29833729 {
29843730 Object3D obj;
29853731 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +3740,16 @@
29943740 LA.matIdentity(Object3D.mat);
29953741 obj.getBounds(minima, maxima, false);
29963742 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3743
+ if (full)
3744
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29983745 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29993746 obj.TransformMesh(Object3D.mat);
3747
+
30003748 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3749
+ if (full)
3750
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30023751 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3752
+
30033753 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30043754 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30053755 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +3778,8 @@
30283778
30293779 int size = obj.MemorySize();
30303780
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
3781
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3782
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30323783 }
30333784 }
30343785 catch (Exception e)
....@@ -3065,9 +3816,9 @@
30653816 obj = (Object3D)e.nextElement();
30663817
30673818 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3819
+ Grafreed.AnalyzeObject(obj);
30693820 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3821
+ Grafreed.AnalyzeObject(obj.bRep);
30713822
30723823 // System.err.println((size/1024) + " KB is the size of " + obj);
30733824 }
....@@ -3109,6 +3860,20 @@
31093860 void GenNormals(boolean crease)
31103861 {
31113862 group.GenNormalsS(crease);
3863
+
3864
+ refreshContents();
3865
+ }
3866
+
3867
+ void GenNormalsMESH()
3868
+ {
3869
+ group.GenNormalsMeshS();
3870
+
3871
+ refreshContents();
3872
+ }
3873
+
3874
+ void GenNormalsMINE()
3875
+ {
3876
+ group.selection.GenNormalsMINE();
31123877
31133878 refreshContents();
31143879 }
....@@ -3157,104 +3922,259 @@
31573922
31583923 //Object3D buffer;
31593924 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
-
3925
+// BoundaryRep temprep;
3926
+// Object3D nodes;
3927
+// Vector<Vertex> vertices;
3928
+//
3929
+// cGroup buffer;
3930
+//
3931
+// public void Vertex(Object3D node, Vertex v)
3932
+// {
3933
+//// vertices.add(v);
3934
+//// nodes.addElement(node);
3935
+////
3936
+//// if (temprep.GetCache(v) != null)
3937
+//// {
3938
+//// temprep.Remove(v);
3939
+//// } else
3940
+//// {
3941
+//// temprep.Remember(v);
3942
+//// }
3943
+//
3944
+// //Object3D node = nodes.get(index);
3945
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
3946
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3947
+//
3948
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3949
+//
3950
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3951
+//
3952
+// cGroup g = new cGroup();
3953
+//
3954
+// if (g.toParent == null)
3955
+// {
3956
+// g.toParent = LA.newMatrix();
3957
+// g.fromParent = LA.newMatrix();
3958
+// }
3959
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3960
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3961
+//
3962
+// g.add(GrafreeD.clipboard);
3963
+//
3964
+// buffer.add(g);
3965
+// }
3966
+//
3967
+// public void Face(Object3D node, Face f)
3968
+// {
3969
+//
3970
+// }
3971
+//
3972
+// void ParseVerticesOld() // ??
3973
+// {
3974
+// //if (group.selection.size() != 1)
3975
+// // return;
3976
+//
3977
+// temprep = new BoundaryRep();
3978
+// nodes = new Object3D();
3979
+// vertices = new Vector<Vertex>();
3980
+//
3981
+// boolean epsequal = GrafreeD.epsequal;
3982
+// GrafreeD.epsequal = true;
3983
+//
3984
+// for (int i=0; i<group.selection.size(); i++)
3985
+// {
3986
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3987
+//
3988
+// group.selection.get(i).Parse(
3989
+//this );
3990
+//
3991
+// int repsize = temprep.VertexCount();
3992
+// int tablesize = temprep.vertextable.size();
3993
+// int nodesize = nodes.size();
3994
+//
3995
+// assert(vertices.size() == nodes.size());
3996
+//
3997
+// temprep.vertextable.elements();
3998
+//
3999
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4000
+//
4001
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
4002
+// {
4003
+// cGroup g = new cGroup();
4004
+//
4005
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
4006
+//
4007
+// Object3D node = nodes.get(index);
4008
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
4009
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4010
+//
4011
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4012
+//
4013
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4014
+//
4015
+// if (g.toParent == null)
4016
+// {
4017
+// g.toParent = LA.newMatrix();
4018
+// g.fromParent = LA.newMatrix();
4019
+// }
4020
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4021
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4022
+//
4023
+// g.add(GrafreeD.clipboard);
4024
+//
4025
+// buffer.add(g);
4026
+// }
4027
+//
4028
+// makeSomething(buffer, i==group.selection.size()-1);
4029
+// }
4030
+//
4031
+// GrafreeD.epsequal = epsequal;
4032
+//
4033
+// //buffer = null;
4034
+// temprep = null;
4035
+// nodes = null;
4036
+//
4037
+// refreshContents();
4038
+// }
4039
+
31844040 void ParseVertices()
31854041 {
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;
4042
+ boolean epsequal = Grafreed.epsequal;
4043
+ Grafreed.epsequal = true;
31954044
31964045 for (int i=0; i<group.selection.size(); i++)
31974046 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4047
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994048
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4049
+ group.selection.get(i).Parse(
4050
+
4051
+ new iParse()
4052
+ {
4053
+ public void Vertex(Object3D node, Vertex v)
4054
+ {
4055
+ temp.set(v);
4056
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054057
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();
4058
+ cGroup g = new cGroup();
32114059
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4060
+ if (g.toParent == null)
4061
+ {
4062
+ g.toParent = LA.newMatrix();
4063
+ g.fromParent = LA.newMatrix();
4064
+ }
4065
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4066
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154067
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);
4068
+ g.add(Grafreed.clipboard);
32204069
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);
4070
+ buffer.add(g);
4071
+ }
32324072
3233
- g.add(GraphreeD.clipboard);
4073
+ public void Face(Object3D node, Face f)
4074
+ {
32344075
3235
- buffer.add(g);
3236
- }
4076
+ }
4077
+ }
4078
+ );
32374079
32384080 makeSomething(buffer, i==group.selection.size()-1);
32394081 }
32404082
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4083
+ Grafreed.epsequal = epsequal;
32464084
32474085 refreshContents();
32484086 }
3249
-
4087
+
4088
+ void TextureVertices()
4089
+ {
4090
+ for (int i=0; i<group.selection.size(); i++)
4091
+ {
4092
+ group.selection.get(i).Parse(
4093
+ new iParse()
4094
+ {
4095
+ public void Vertex(Object3D node, Vertex v)
4096
+ {
4097
+ cTexture tex = node.GetTextures();
4098
+ String pigment = Object3D.GetPigment(tex);
4099
+ //String bump = Object3D.GetBump(tex);
4100
+
4101
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4102
+
4103
+ try
4104
+ {
4105
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4106
+ }
4107
+ catch (Exception e)
4108
+ {
4109
+ System.err.println("FAIL: " + node);
4110
+ }
4111
+
4112
+ double s = v.s;
4113
+
4114
+ if (s == 1)
4115
+ s = 0;
4116
+
4117
+ double t = v.t;
4118
+
4119
+ if (t == 1)
4120
+ t = 0;
4121
+
4122
+ int indexs = (int) (texturedata.getWidth() * s);
4123
+ int indext = (int) (texturedata.getHeight() * t);
4124
+
4125
+ int index = indext * texturedata.getWidth() + indexs;
4126
+
4127
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4128
+
4129
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4130
+
4131
+ float scale = bytebuf.get(index*slide) & 0xFF;
4132
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4133
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4134
+ scale /= 3;
4135
+
4136
+ scale /= 0xFF;
4137
+ // c'est quoi ca? scale /= 4;
4138
+
4139
+ //v.AO = scale;
4140
+
4141
+ v.x += v.norm.x * scale;
4142
+ v.y += v.norm.y * scale;
4143
+ v.z += v.norm.z * scale;
4144
+ }
4145
+
4146
+ public void Face(Object3D node, Face f)
4147
+ {
4148
+ }
4149
+ }
4150
+ );
4151
+ }
4152
+
4153
+ refreshContents();
4154
+ }
4155
+
32504156 void Align()
32514157 {
4158
+ if (group.selection.size() == 0)
4159
+ return;
4160
+
4161
+ cVector bbmin = new cVector();
4162
+ cVector bbmax = new cVector();
4163
+
4164
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4165
+
4166
+ double dx = bbmax.x - bbmin.x;
4167
+ double dy = bbmax.y - bbmin.y;
4168
+ double dz = bbmax.z - bbmin.z;
4169
+
4170
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4171
+
32524172 for (int i=0; i<group.selection.size(); i++)
32534173 {
32544174 Object3D obj = group.selection.get(i);
32554175
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4176
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4177
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584178 }
32594179
32604180 refreshContents();
....@@ -3267,7 +4187,7 @@
32674187 // ref.SaveSupports();
32684188 // Object3D par = ref.parent;
32694189 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4190
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714191 // ref.parent = par;
32724192 // ref.RestoreSupports();
32734193
....@@ -3275,11 +4195,11 @@
32754195
32764196 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774197
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4198
+ boolean random = CameraPane.SWITCH;
4199
+ CameraPane.SWITCH = false; // parse all random nodes
32804200 lowres.linkVerticesThis(null);
32814201 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4202
+ CameraPane.SWITCH = random;
32834203
32844204 System.err.flush();
32854205
....@@ -3297,7 +4217,7 @@
32974217 // lowres.SaveSupports();
32984218 // par = lowres.parent;
32994219 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4220
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014221 Object3D newlow = CloneObject(lowres, false);
33024222 newlow.name = sn.switchobject.get(i).name;
33034223 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4239,7 @@
33194239 return;
33204240
33214241 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4242
+ Object3D ref = Grafreed.clipboard.get(0);
33234243
33244244 Object3D newgroup = new Object3D("Po:" + poses.name);
33254245
....@@ -3488,7 +4408,7 @@
34884408 group.selection.RelinkToSupport(); // july 2014
34894409 System.out.println("DONE.");
34904410 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4411
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34924412 }
34934413
34944414 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +4433,20 @@
35134433
35144434 void ClipMesh()
35154435 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4436
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35174437 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
4438
+ Object3D content = Grafreed.clipboard.get(0);
35194439
35204440 if (content instanceof cGroup && ((cGroup)content).transientlink )
35214441 content = ((cGroup)content).get(0);
35224442
35234443 // for (int i=0; i<group.selection.size(); i++)
35244444 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4445
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264446 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4447
+ group.selection.ClipMesh(Grafreed.clipboard);
35284448 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4449
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304450 System.out.println("DONE.");
35314451 refreshContents();
35324452 }
....@@ -3571,6 +4491,18 @@
35714491 void MarkLeaves(boolean hide)
35724492 {
35734493 group.selection.MarkLeaves(hide);
4494
+ refreshContents();
4495
+ }
4496
+
4497
+ void RewindLeaves(boolean hide)
4498
+ {
4499
+ group.selection.RewindLeaves(hide);
4500
+ refreshContents();
4501
+ }
4502
+
4503
+ void RandomLeaves(boolean hide)
4504
+ {
4505
+ group.selection.RandomLeaves(hide);
35744506 refreshContents();
35754507 }
35764508
....@@ -3645,10 +4577,6 @@
36454577 // }
36464578 // }
36474579
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36524580 void EditSelection(boolean newWindow)
36534581 {
36544582 // aConstraints.gridy = 0;
....@@ -3656,10 +4584,10 @@
36564584 {
36574585 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36584586 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4587
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36604588
36614589 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
4590
+ if(elem != group || !newWindow)
36634591 {
36644592 // if (!(elem instanceof Composite))
36654593 // newWindow = false;
....@@ -3741,7 +4669,8 @@
37414669 //new Exception().printStackTrace();
37424670
37434671 freezemodel = true;
3744
-
4672
+ ClearUnpinned();
4673
+
37454674 /**/
37464675 //switch (event.id)
37474676 {
....@@ -3749,7 +4678,6 @@
37494678 //case 702: // Event.LIST_DESELECT
37504679 group.deselectAll();
37514680 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37534681 if (tps != null)
37544682 {
37554683 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +4686,39 @@
37584686
37594687 //if (child.parent != null)
37604688 //child.parent.addSelectee(child);
4689
+ objEditor.SetMaterial(child);
37614690 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37654691 }
37664692 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
4693
+// else
4694
+// {
4695
+// objEditor.SetMaterial(group); // .GetMaterial());
4696
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4697
+// System.err.println("info : " + group.GetPath());
4698
+// }
37734699
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4700
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37774701 CameraPane.flash = true;
37784702
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4703
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37804704 // a camera
37814705 {
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;
4706
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4707
+ {
4708
+ CameraPane.camerachangeframe = 0; // don't refuse it
4709
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4710
+ }
4711
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4712
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864713 }
37874714
4715
+ if (tps != null && tps.length == 1)
4716
+ {
4717
+ EditSelection(false);
4718
+ }
4719
+
4720
+ SetPinStates(tps != null && tps.length > 0);
4721
+
37884722 refreshContents();
37894723 //return true;
37904724 }
....@@ -3793,6 +4727,35 @@
37934727
37944728 freezemodel = false;
37954729 }
4730
+
4731
+ void SetPinStates(boolean enabled)
4732
+ {
4733
+ editButton.setEnabled(enabled);
4734
+ uneditButton.setEnabled(enabled);
4735
+ unselectButton.setEnabled(enabled);
4736
+ flashSelectionButton.setEnabled(enabled);
4737
+ }
4738
+
4739
+ void refreshContents(boolean cp)
4740
+ {
4741
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4743
+ {
4744
+ objEditor.ClearInfo(); // .GetMaterial());
4745
+
4746
+ for (int i=0; i < group.selection.Size(); i++)
4747
+ {
4748
+ Object3D child = (Object3D) group.selection.get(i);
4749
+
4750
+ objEditor.AddInfo(child, this, true);
4751
+ System.err.println("info : " + child.GetPath());
4752
+ }
4753
+
4754
+ objEditor.SetText(); // jan 2014
4755
+ }
4756
+
4757
+ super.refreshContents(cp);
4758
+ }
37964759
37974760 void linkSomething(Object3D thing)
37984761 {
....@@ -3864,16 +4827,19 @@
38644827 {
38654828 if (group.selection.isEmpty())
38664829 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4830
+
4831
+ Grafreed.clipboardIsTempGroup = false;
38684832 Composite tGroup = null;
38694833 if (group.selection.size() > 0) // 1)
38704834 {
38714835 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4836
+ Grafreed.clipboardIsTempGroup = true;
38734837 }
38744838
38754839 if (cut)
38764840 {
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
38774843 //int indices[] = jList.getSelectedIndices();
38784844 //for (int i = indices.length - 1; i >= 0; i--)
38794845 //jList.remove(indices[i]);
....@@ -3909,16 +4875,16 @@
39094875 //System.out.println("cut " + child);
39104876 //System.out.println("parent = " + child.parent);
39114877 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4878
+ if (Grafreed.clipboardIsTempGroup)
39134879 tGroup.add/*Child*/(tmp);
39144880 else
3915
- GraphreeD.clipboard = tmp;
4881
+ Grafreed.clipboard = tmp;
39164882 }
39174883 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4884
+ if (Grafreed.clipboardIsTempGroup)
39194885 tGroup.add/*Child*/(child);
39204886 else
3921
- GraphreeD.clipboard = child;
4887
+ Grafreed.clipboard = child;
39224888 }
39234889
39244890 //ResetModel();
....@@ -3950,21 +4916,23 @@
39504916 //System.out.println("cut " + elem);
39514917 //System.out.println("parent = " + elem.parent);
39524918 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4919
+ if (Grafreed.clipboardIsTempGroup)
39544920 tGroup.add/*Child*/(tmp);
39554921 else
3956
- GraphreeD.clipboard = tmp;
4922
+ Grafreed.clipboard = tmp;
39574923 }
39584924 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4925
+ if (Grafreed.clipboardIsTempGroup)
39604926 tGroup.add/*Child*/(child);
39614927 else
3962
- GraphreeD.clipboard = child;
4928
+ Grafreed.clipboard = child;
39634929 }
39644930
39654931 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4932
+
4933
+ if (Grafreed.clipboardIsTempGroup)
4934
+ Grafreed.clipboard = tGroup;
4935
+
39684936 if (cut)
39694937 {
39704938 ResetModel();
....@@ -3974,11 +4942,15 @@
39744942
39754943 void paste(boolean expand)
39764944 {
3977
- // if (GraphreeD.clipboard == null)
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
4949
+ // if (GrafreeD.clipboard == null)
39784950 // return;
39794951 boolean first = true;
39804952
3981
- if (GraphreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
39824954 {
39834955 Composite temp;
39844956
....@@ -3989,7 +4961,7 @@
39894961 temp = (Composite)Applet3D.clipboard.deepCopy();
39904962 */
39914963 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4964
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39934965 {
39944966 Object3D child = (Object3D)e.nextElement();
39954967
....@@ -4003,7 +4975,7 @@
40034975 else
40044976 elem = child.deepCopy(); // ?
40054977 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4978
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40074979 // elem = elem.get(0);
40084980 makeSomething(elem, true); // ?? first);
40094981 //group.addChild(elem);
....@@ -4023,23 +4995,24 @@
40234995 //Object3D cb = Applet3D.clipboard;
40244996 //temp.addChild(cb);
40254997 //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());
4998
+ assert(Grafreed.clipboard.parent == null);
4999
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5000
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5001
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5002
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40315003 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
5004
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5005
+ Grafreed.clipboard.get(0).parent = keepparent;
40345006 }
40355007
5008
+ Globals.SAVEONMAKE = keep;
40365009 ResetModel();
40375010 refreshContents();
40385011 }
40395012
4040
- void pasteInto(boolean copyit)
5013
+ void pasteInto(boolean copyit, boolean clone)
40415014 {
4042
-// if (GraphreeD.clipboard == null)
5015
+// if (GrafreeD.clipboard == null)
40435016 // return;
40445017
40455018 if (group.selection.size() != 1)
....@@ -4066,15 +5039,22 @@
40665039 if (copyit)
40675040 {
40685041 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5042
+ if (clone)
5043
+ {
5044
+ CloneClipboard(false); // sept 2014
5045
+ }
5046
+ else
5047
+ {
5048
+ paste(false);
5049
+ }
40705050 }
40715051 else
40725052 {
40735053 boolean first = true;
40745054
4075
- if (GraphreeD.clipboardIsTempGroup)
5055
+ if (Grafreed.clipboardIsTempGroup)
40765056 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5057
+ Composite temp = (Composite)Grafreed.clipboard;
40785058 Object3D copy;
40795059 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805060 {
....@@ -4084,7 +5064,7 @@
40845064 }
40855065 } else
40865066 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5067
+ linkSomething(Grafreed.clipboard); //.get(0));
40885068 }
40895069 }
40905070 }
....@@ -4161,6 +5141,10 @@
41615141
41625142 void group(Object3D csg, boolean grab)
41635143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
41645148 if (//false) // why??
41655149 !group.selection.isEmpty())
41665150 {
....@@ -4274,8 +5258,34 @@
42745258 //node.add(csg);
42755259 //makeSomething(node);
42765260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
42775262 }
42785263
5264
+ void Ungroup(Object3D g)
5265
+ {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
5270
+ if (g instanceof HiddenObject)
5271
+ {
5272
+ HiddenObject h = (HiddenObject) g;
5273
+
5274
+ for (int i=0; i<h.ActualSize(); i++)
5275
+ {
5276
+ objEditor.makeSomething(h.get(i), false);
5277
+ }
5278
+ }
5279
+ else
5280
+ {
5281
+ for (int i=0; i<g.Size(); i++)
5282
+ {
5283
+ objEditor.makeSomething(g.get(i), false);
5284
+ }
5285
+ }
5286
+ Globals.SAVEONMAKE = keep;
5287
+ }
5288
+
42795289 void ungroup()
42805290 {
42815291 /*
....@@ -4469,21 +5479,6 @@
44695479 }
44705480 */
44715481
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
-
44875482 /*
44885483 public void Callback(Object obj)
44895484 {
....@@ -4507,26 +5502,9 @@
45075502 }
45085503 */
45095504
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
-
45275505 String GetFile(String dialogName)
45285506 {
4529
- if (GraphreeD.standAlone)
5507
+ if (Grafreed.standAlone)
45305508 {
45315509 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45325510 browser.show();
....@@ -4590,10 +5568,33 @@
45905568 cButton flashSelectionButton;
45915569 cButton editButton;
45925570 cButton uneditButton;
5571
+ JCheckBox allParamsButton;
45935572 cButton clearpanelButton;
4594
- cButton allParamsButton;
45955573 cButton unselectButton;
45965574
5575
+ cButton restoreCameraButton;
5576
+
5577
+ cButton saveButton;
5578
+ cButton oneStepButton;
5579
+
5580
+ cButton groupButton;
5581
+ cButton ungroupButton;
5582
+ cButton compositeButton;
5583
+ cButton switchButton;
5584
+ cButton loopButton;
5585
+ cButton textureButton;
5586
+
5587
+ cButton gridButton;
5588
+ cButton boxButton;
5589
+ cButton sphereButton;
5590
+ cButton coneButton;
5591
+ cButton torusButton;
5592
+ cButton superButton;
5593
+ cButton kleinButton;
5594
+ cButton particlesButton;
5595
+ cButton overlayButton;
5596
+ cButton lightButton;
5597
+
45975598 cButton screenfitButton;
45985599 cButton screenfitpointButton;
45995600 cButton snapobjectButton;
....@@ -4605,14 +5606,6 @@
46055606
46065607 cButton setsupportButton;
46075608
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
-
46165609 //
46175610 //Composite
46185611 Object3D // to do !!
....@@ -4622,9 +5615,11 @@
46225615 //JTree jTree;
46235616 private MenuItem lookAtItem;
46245617 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
5618
+ private MenuItem switchViewItem;
46265619 private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
5620
+ private MenuItem undoItem;
5621
+ private MenuItem redoItem;
5622
+ private JMenuItem duplicateItem;
46285623 private MenuItem cloneItem;
46295624 private MenuItem cloneSupportItem;
46305625 private MenuItem overwriteGeoItem;
....@@ -4635,8 +5630,9 @@
46355630 private MenuItem resetsupportItem;
46365631 private MenuItem resetreferencesItem;
46375632 private MenuItem linkverticesItem;
5633
+ private MenuItem relinkverticesItem;
46385634 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
5635
+ private MenuItem resetAllItem;
46405636 private MenuItem stepAllItem;
46415637 private MenuItem revertMeshItem;
46425638 private MenuItem poseMeshItem;
....@@ -4647,14 +5643,17 @@
46475643 private MenuItem mergeGeometriesItem;
46485644 private MenuItem copyItem;
46495645 private MenuItem pasteItem;
5646
+ private MenuItem pasteIntoItem;
46505647 private MenuItem pasteLinkItem;
46515648 private MenuItem pasteCloneItem;
46525649 private MenuItem pasteExpandItem;
46535650 private MenuItem clearItem;
46545651 private MenuItem clearAllItem;
46555652 private MenuItem genUVItem;
5653
+ private MenuItem genNormalsMESHItem;
46565654 private MenuItem genNormalsCADItem;
46575655 private MenuItem genNormalsORGANItem;
5656
+ private MenuItem genNormalsMINEItem;
46585657 private MenuItem stripifyItem;
46595658 private MenuItem unstripifyItem;
46605659 private MenuItem trimItem;
....@@ -4683,6 +5682,10 @@
46835682 private MenuItem showleavesItem;
46845683 private MenuItem markleavesItem;
46855684 private MenuItem unmarkleavesItem;
5685
+ private MenuItem rewindleavesItem;
5686
+ private MenuItem unrewindleavesItem;
5687
+ private MenuItem randomleavesItem;
5688
+ private MenuItem unrandomleavesItem;
46865689
46875690 private MenuItem flipVItem;
46885691 private MenuItem unflipVItem;
....@@ -4694,14 +5697,17 @@
46945697 private MenuItem panoTexturesItem;
46955698
46965699 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
5700
+ private MenuItem resetCentroidXZItem;
46985701 private MenuItem resetTransformItem;
5702
+ private MenuItem transformGeometryItem;
5703
+ private MenuItem transformChildrenItem;
5704
+ private MenuItem hideItem;
46995705 private MenuItem grabItem;
47005706 private MenuItem backItem;
47015707 private MenuItem frontItem;
47025708 private MenuItem cameraItem;
47035709 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
5710
+ private MenuItem switchItem;
47055711 private MenuItem physicsItem;
47065712 private MenuItem frameselectorItem;
47075713 private MenuItem scriptNodeItem;
....@@ -4716,6 +5722,7 @@
47165722
47175723 private MenuItem resetParentItem;
47185724 private MenuItem repairParentItem;
5725
+ private MenuItem repairShadowItem;
47195726 private MenuItem sortbysizeItem;
47205727 private MenuItem sortbynameItem;
47215728
....@@ -4728,16 +5735,19 @@
47285735 private MenuItem particleItem;
47295736 private MenuItem ragdollItem;
47305737 private MenuItem ragdoll2Item;
5738
+ private MenuItem heightFieldItem;
5739
+ private MenuItem textureFieldItem;
47315740 private MenuItem gridItem;
47325741 private MenuItem rectoidItem;
47335742 private MenuItem ellipsoidItem;
47345743 private MenuItem coneItem;
47355744 private MenuItem torusItem;
47365745 private MenuItem superItem;
5746
+ private MenuItem kleinItem;
47375747 private MenuItem blobItem;
47385748 private MenuItem latheItem;
47395749 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
5750
+ private MenuItem overlayItem;
47415751 private MenuItem meshItem;
47425752 // private MenuItem meshGroupItem;
47435753 private MenuItem springItem;
....@@ -4746,6 +5756,7 @@
47465756 private MenuItem csgItem;
47475757 private MenuItem templateItem;
47485758 private MenuItem textureItem;
5759
+ private MenuItem billboardItem;
47495760 private MenuItem shadowXItem;
47505761 private MenuItem shadowYItem;
47515762 private MenuItem shadowZItem;
....@@ -4758,11 +5769,6 @@
47585769 private MenuItem doubleItem;
47595770 private MenuItem tripleItem;
47605771
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47665772 private MenuItem computeAOItem;
47675773 private MenuItem recompileItem;
47685774 private MenuItem editScriptItem;
....@@ -4772,4 +5778,8 @@
47725778 private MenuItem analyzeItem;
47735779 private MenuItem dumpItem;
47745780 //boolean freezemodel = false;
5781
+
5782
+ Menu cameraMenu;
5783
+ MenuItem editCameraItem;
5784
+ MenuItem restoreCameraItem;
47755785 }