Normand Briere
2019-07-21 76522bc3ee92bd50dbd946d7f865666be4ad7bac
GroupEditor.java
....@@ -12,6 +12,7 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
1718 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
....@@ -59,6 +60,12 @@
5960 this.copy = this.group = group;
6061 //selectees = this.group.selectees;
6162
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6269 if(ui)
6370 SetupUI(objEditor);
6471 }
....@@ -73,16 +80,28 @@
7380 this.copy = this.group = copy;
7481 //selectees = this.group.selectees;
7582
76
- SetupMenu2(objEditor);
83
+ SetupMenu2(this); //objEditor);
7784 SetupUI2(objEditor);
7885 objEditor.SetupUI(true);
7986 SetupViews(objEditor);
8087
8188 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
89
+
90
+ if (copy.versions == null)
91
+ {
92
+ copy.versions = new byte[100][];
93
+ copy.versionindex = -1;
94
+
95
+ Save(true);
96
+ }
8297 }
8398
8499 void CloneSelection(boolean supports)
85100 {
101
+ if (Globals.REPLACEONMAKE)
102
+ Save();
103
+ boolean keep = Globals.REPLACEONMAKE;
104
+ Globals.REPLACEONMAKE = false;
86105 // Object3D keep = GrafreeD.clipboard;
87106 //Object3D obj;
88107 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +112,19 @@
93112
94113 makeSomething(clone, i==group.selection.size()-1);
95114 }
115
+ Globals.REPLACEONMAKE = keep;
96116 }
97117
98118 void CloneClipboard(boolean supports)
99119 {
100
- assert(GrafreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
102
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
120
+ assert(Grafreed.clipboard.parent == null);
121
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
122
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
123
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
124
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105125 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
126
+ makeSomething(CloneObject(Grafreed.clipboard, false));
127
+ Grafreed.clipboard.get(0).parent = keepparent;
108128 }
109129
110130 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +138,7 @@
118138 // obj.support = null;
119139 if (!supports)
120140 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
141
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122142 obj.parent = parent;
123143 // obj.support = support;
124144 // clone.support = support; // aout 2013
....@@ -147,30 +167,29 @@
147167
148168 //JTextField nameField;
149169
150
- void SetupMenu2(ObjEditor oe)
170
+ void SetupMenu2(GroupEditor oe)
151171 {
152
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
155
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
156
- oe.cameraMenu.add("-");
157
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
158
- openWindowItem.addActionListener(this);
159
- editLeafItem.addActionListener(this);
160
- lookAtItem.addActionListener(this);
161
- //lookFromItem.addActinoListener(this);
162
- //switchItem.addActionListener(this);
172
+ oe.jTree = new cTree();
173
+
163174 Menu menu;
164175 oe.menuBar.add(menu = new Menu("Edit"));
165176 //editItem = menu.add(new MenuItem("Edit"));
166177 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
178
+
179
+// undoItem = menu.add(new MenuItem("Undo"));
180
+// undoItem.addActionListener(this);
181
+// redoItem = menu.add(new MenuItem("Redo"));
182
+// redoItem.addActionListener(this);
183
+// menu.add("-");
184
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168185 duplicateItem.addActionListener(this);
169
- menu.add("-");
170186 cloneItem = menu.add(new MenuItem("Clone"));
171187 cloneItem.addActionListener(this);
188
+ if (Globals.ADVANCED)
189
+ {
172190 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173191 cloneSupportItem.addActionListener(this);
192
+ }
174193 menu.add("-");
175194 cutItem = menu.add(new MenuItem("Cut"));
176195 cutItem.addActionListener(this);
....@@ -178,27 +197,123 @@
178197 copyItem.addActionListener(this);
179198 pasteItem = menu.add(new MenuItem("Paste"));
180199 pasteItem.addActionListener(this);
200
+
201
+ menu.add("-");
202
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
203
+ pasteIntoItem.addActionListener(this);
181204 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182205 pasteLinkItem.addActionListener(this);
183206 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184207 pasteCloneItem.addActionListener(this);
185208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186209 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
210
+ menu.add("-");
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
213
+
214
+ if (Globals.ADVANCED)
215
+ {
216
+ // Deletes the cameras...
189217 clearAllItem = menu.add(new MenuItem("Clear All"));
190218 clearAllItem.addActionListener(this);
219
+ }
220
+
221
+ menuBar.add(cameraMenu = new Menu("View"));
222
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
223
+ //zBufferItem.addActionListener(this);
224
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
225
+ //normalLensItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
228
+
229
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
230
+// toggleFullScreenItem.addItemListener(this);
231
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
232
+// cameraMenu.add("-");
233
+//
234
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
235
+// toggleTextureItem.addItemListener(this);
236
+// toggleTextureItem.setState(CameraPane.textureon);
237
+//
238
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
239
+// toggleSwitchItem.addItemListener(this);
240
+// toggleSwitchItem.setState(CameraPane.SWITCH);
241
+
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
243
+ toggleHandleItem.addItemListener(this);
244
+ toggleHandleItem.setState(CameraPane.HANDLES);
245
+
246
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
247
+ togglePaintItem.addItemListener(this);
248
+ togglePaintItem.setState(CameraPane.PAINTMODE);
249
+
250
+ if (Globals.ADVANCED)
251
+ {
252
+ cameraMenu.add("-");
253
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
254
+ toggleLiveItem.addItemListener(this);
255
+ toggleLiveItem.setState(Globals.isLIVE());
191256
257
+ cameraMenu.add(stepItem = new MenuItem("Step"));
258
+ stepItem.addActionListener(this);
259
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
260
+ // toggleDLItem.addItemListener(this);
261
+ // toggleDLItem.setState(false);
262
+
263
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
264
+ toggleRenderItem.addItemListener(this);
265
+ toggleRenderItem.setState(!CameraPane.frozen);
266
+
267
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
268
+ toggleDebugItem.addItemListener(this);
269
+ toggleDebugItem.setState(Globals.DEBUG);
270
+
271
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
272
+ toggleFrustumItem.addItemListener(this);
273
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
274
+
275
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
276
+ toggleFootContactItem.addItemListener(this);
277
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
278
+
279
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
280
+ toggleTimelineItem.addItemListener(this);
281
+ }
282
+
283
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
284
+// toggleRootItem.addItemListener(this);
285
+// toggleRootItem.setState(false);
286
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
287
+// animationItem.addItemListener(this);
288
+// animationItem.setState(CameraPane.ANIMATION);
289
+ cameraMenu.add("-");
290
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
291
+ editCameraItem.addActionListener(this);
292
+
293
+ if (Globals.ADVANCED)
294
+ {
295
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
296
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
298
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
299
+ oe.cameraMenu.add("-");
300
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
301
+ openWindowItem.addActionListener(this);
302
+ editLeafItem.addActionListener(this);
303
+ lookAtItem.addActionListener(this);
304
+ //lookFromItem.addActinoListener(this);
305
+ //switchViewItem.addActionListener(this);
306
+ }
307
+
192308 oe.menuBar.add(menu = new Menu("Setting"));
193
- resetMeshItem = menu.add(new MenuItem("Reset All"));
194
- resetMeshItem.addActionListener(this);
195
- stepAllItem = menu.add(new MenuItem("Step All"));
196
- stepAllItem.addActionListener(this);
309
+ if (Globals.ADVANCED)
310
+ {
197311 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198312 revertMeshItem.addActionListener(this);
199313 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200314 resetreferencesItem.addActionListener(this);
201315 menu.add("-");
316
+ }
202317 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203318 overwriteGeoItem.addActionListener(this);
204319 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,79 +325,104 @@
210325 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211326 overwriteUVItem.addActionListener(this);
212327 menu.add("-");
328
+ if (Globals.ADVANCED)
329
+ {
213330 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214331 generateMeshItem.addActionListener(this);
215332 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216333 poseMeshItem.addActionListener(this);
217334 menu.add("-");
335
+ }
218336 resetsupportItem = menu.add(new MenuItem("Reset support"));
219337 resetsupportItem.addActionListener(this);
220338 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221339 linkverticesItem.addActionListener(this);
222340 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223341 relinkverticesItem.addActionListener(this);
342
+
343
+ if (Globals.ADVANCED)
344
+ {
224345 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225346 setMasterItem.addActionListener(this);
347
+ }
226348
227349 oe.menuBar.add(menu = new Menu("Group"));
228
- grabItem = menu.add(new MenuItem("Grab"));
229
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
230352 backItem = menu.add(new MenuItem("Back"));
231353 backItem.addActionListener(this);
232354 frontItem = menu.add(new MenuItem("Front"));
233355 frontItem.addActionListener(this);
234
- compositeItem = menu.add(new MenuItem("Composite"));
235
- compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
361
+ hideItem = menu.add(new MenuItem("Hidden Group"));
237362 hideItem.addActionListener(this);
363
+ }
238364 ungroupItem = menu.add(new MenuItem("Ungroup"));
239365 ungroupItem.addActionListener(this);
240
- menu.add("-");
241
- randomItem = menu.add(new MenuItem("Random"));
242
- randomItem.addActionListener(this);
243
- physicsItem = menu.add(new MenuItem("Physics"));
244
- physicsItem.addActionListener(this);
245
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
246
- frameselectorItem.addActionListener(this);
366
+
367
+// menu.add("-");
368
+//
369
+// switchItem = menu.add(new MenuItem("Switch node"));
370
+// switchItem.addActionListener(this);
371
+ if (Globals.ADVANCED)
372
+ {
247373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248374 switchGeoItem.addActionListener(this);
249375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250376 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
377
+ morphItem = menu.add(new MenuItem("Morph Group"));
252378 morphItem.addActionListener(this);
379
+
380
+ menu.add("-");
381
+ physicsItem = menu.add(new MenuItem("Physics"));
382
+ physicsItem.addActionListener(this);
383
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
384
+ frameselectorItem.addActionListener(this);
253385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254386 scriptNodeItem.addActionListener(this);
255
- cameraItem = menu.add(new MenuItem("Camera"));
256
- cameraItem.addActionListener(this);
387
+ }
257388
258389 oe.menuBar.add(menu = new Menu("Object"));
259
- textureItem = menu.add(new MenuItem("Texture"));
260
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
261392 billboardItem = menu.add(new MenuItem("Billboard"));
262393 billboardItem.addActionListener(this);
263394 csgItem = menu.add(new MenuItem("CSG"));
264395 csgItem.addActionListener(this);
265
- shadowXItem = menu.add(new MenuItem("Shadow X"));
396
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
266397 shadowXItem.addActionListener(this);
267
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
398
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
268399 shadowYItem.addActionListener(this);
269
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
400
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
270401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
405
+ if (Globals.ADVANCED)
406
+ {
407
+ menu.add("-");
271408 linkerItem = menu.add(new MenuItem("Linker"));
272409 linkerItem.addActionListener(this);
273410 templateItem = menu.add(new MenuItem("Template"));
274411 templateItem.addActionListener(this);
275
- attributeItem = menu.add(new MenuItem("Attribute"));
276
- attributeItem.addActionListener(this);
277412 pointflowItem = menu.add(new MenuItem("Point Flow"));
278413 pointflowItem.addActionListener(this);
414
+ }
279415 menu.add("-");
280416 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281417 resetTransformItem.addActionListener(this);
282418 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283419 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- transformgeometryItem.addActionListener(this);
420
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
421
+ resetCentroidXZItem.addActionListener(this);
422
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
423
+ transformGeometryItem.addActionListener(this);
424
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
425
+ transformChildrenItem.addActionListener(this);
286426
287427 oe.menuBar.add(menu = new Menu("Geometry"));
288428 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +433,11 @@
293433 genNormalsCADItem.addActionListener(this);
294434 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295435 genNormalsMESHItem.addActionListener(this);
296
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
436
+ if (Globals.ADVANCED)
437
+ {
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
297439 genNormalsMINEItem.addActionListener(this);
440
+ }
298441 stripifyItem = menu.add(new MenuItem("Stripify"));
299442 stripifyItem.addActionListener(this);
300443 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +459,34 @@
316459 reduce34MeshItem.addActionListener(this);
317460 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318461 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321462 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322463 clipMeshItem.addActionListener(this);
464
+
465
+ if (Globals.ADVANCED)
466
+ {
467
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
468
+ smoothMeshItem.addActionListener(this);
469
+ }
323470
324471 oe.menuBar.add(menu = new Menu("Attributes"));
325472 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326473 clearMaterialsItem.addActionListener(this);
474
+ resetAllItem = menu.add(new MenuItem("Reset All"));
475
+ resetAllItem.addActionListener(this);
476
+ stepAllItem = menu.add(new MenuItem("Step All"));
477
+ stepAllItem.addActionListener(this);
327478 menu.add("-");
328479 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329480 liveleavesItem.addActionListener(this);
330481 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331482 unliveleavesItem.addActionListener(this);
483
+ if (Globals.ADVANCED)
484
+ {
332485 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333486 supportleavesItem.addActionListener(this);
334487 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335488 unsupportleavesItem.addActionListener(this);
489
+ }
336490 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337491 hideleavesItem.addActionListener(this);
338492 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -341,6 +495,14 @@
341495 markleavesItem.addActionListener(this);
342496 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
343497 unmarkleavesItem.addActionListener(this);
498
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
499
+ rewindleavesItem.addActionListener(this);
500
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
501
+ unrewindleavesItem.addActionListener(this);
502
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
503
+ randomleavesItem.addActionListener(this);
504
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
505
+ unrandomleavesItem.addActionListener(this);
344506 menu.add("-");
345507 flipVItem = menu.add(new MenuItem("Flip V"));
346508 flipVItem.addActionListener(this);
....@@ -376,35 +538,41 @@
376538 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377539 sortbynameItem.addActionListener(this);
378540 menu.add("-");
541
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
542
+ shareGeometriesItem.addActionListener(this);
543
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
544
+ mergeGeometriesItem.addActionListener(this);
545
+ if (Globals.ADVANCED)
546
+ {
547
+ // Pretty much the same as duplicate and clone.
379548 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380549 extractGeometriesItem.addActionListener(this);
381550 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382551 cloneGeometriesItem.addActionListener(this);
383
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
- shareGeometriesItem.addActionListener(this);
385
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
- mergeGeometriesItem.addActionListener(this);
552
+ }
387553
388554 oe.menuBar.add(menu = new Menu("Insert"));
389555 buildCreateMenu(menu);
390556
391
-
392
- oe.menuBar.add(menu = new Menu("Include"));
393
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
- importGFDItem.addActionListener(this);
395
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
- importVRMLX3DItem.addActionListener(this);
397
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
398
- importOBJItem.addActionListener(this);
399
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
- import3DSItem.addActionListener(this);
401
-
402557 oe.menuBar.add(menu = new Menu("Tools"));
403558 buildToolsMenu(menu);
404559 }
405560
561
+
406562 void SetupUI2(ObjEditor oe)
407563 {
564
+ // June 2019
565
+ if (oe == null)
566
+ {
567
+ //super.SetupUI2(this);
568
+ //return;
569
+ }
570
+
571
+ if (copy != group)
572
+ {
573
+ //super.SetupUI2(this);
574
+ }
575
+
408576 //new Exception().printStackTrace();
409577
410578 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -433,176 +601,231 @@
433601 oe.radioPanel.add(dummyButton);
434602 oe.buttonGroup.add(dummyButton);
435603 */
436
- aConstraints.gridy += 1;
437
- oe.aConstraints.gridwidth = 1;
438
- oe.aConstraints.gridx = 0;
604
+ cGridBag copyOptionsPanel = new cGridBag();
605
+
606
+ copyOptionsPanel.preferredHeight = 1;
439607
440
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
441
- liveCB.setToolTipText("Enabled animation");
442
- liveCB.addItemListener(this);
443
-
444
- oe.aConstraints.gridx += 1;
445
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
446
- fastCB.setToolTipText("Fast mode");
447
- fastCB.addItemListener(this);
448
- oe.aConstraints.gridx += 1;
449
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
450
- supportCB.setToolTipText("Enabled rigging");
451
- supportCB.addItemListener(this);
452
-
453
- // oe.aConstraints.gridx += 1;
454
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
455
- // localCB.addItemListener(this);
456
-
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD), oe.aConstraints);
459
- crowdCB.setToolTipText("Used for crowds");
460
- crowdCB.addItemListener(this);
461
-
462
- oe.aConstraints.gridx += 1;
463
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
464
- smoothCB.setToolTipText("Snapping delay");
465
- smoothCB.addItemListener(this);
466
-
467
- oe.aConstraints.gridx += 1;
468
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
469
- slowCB.setToolTipText("Smooth interpolation");
470
- slowCB.addItemListener(this);
471
- oe.aConstraints.gridx += 1;
472
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE), oe.aConstraints);
473
- boxCB.setToolTipText("Display bounding boxes");
474
- boxCB.addItemListener(this);
475
- oe.aConstraints.gridx += 1;
476
- oe.toolbarPanel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE), oe.aConstraints);
477
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
478
- zoomBoxCB.addItemListener(this);
479
-
480
-// oe.aConstraints.gridx += 1;
481
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
482
-// speakerMocapCB.addItemListener(this);
483
-
484
- if (false)
485
- {
486
- // handled in scripts
487
- oe.aConstraints.gridx += 1;
488
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
489
- speakerCameraCB.addItemListener(this);
490
-
491
- oe.aConstraints.gridx += 1;
492
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
493
- speakerFocusCB.addItemListener(this);
494
-
495
- oe.aConstraints.gridx += 1;
496
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
497
- smoothfocusCB.addItemListener(this);
498
- }
499
-
500
-//oe.aConstraints.gridx += 1;
501
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
502
-// debugCB.addItemListener(this);
503
-
504
- oe.aConstraints.gridx += 1;
505
- oe.toolbarPanel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL), oe.aConstraints);
506
- oeilCB.addItemListener(this);
507
-
508
- oe.aConstraints.gridx += 1;
509
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT), oe.aConstraints);
510
- lookAtCB.setToolTipText("Look-at target");
511
- lookAtCB.addItemListener(this);
512
-
513
- oe.aConstraints.gridx += 1;
514
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
515
- trackCB.setToolTipText("Enable tracking");
516
- trackCB.addItemListener(this);
517
-
518
- oe.aConstraints.gridx += 1;
519
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
608
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
609
+
610
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ //minButton.setToolTipText("Minimize window");
612
+ //minButton.addActionListener(this);
613
+
614
+ if (Globals.ADVANCED)
615
+ {
616
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617
+ maxButton.setToolTipText("Maximize window");
618
+ maxButton.addActionListener(this);
619
+ }
620
+
621
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
622
+ fullButton.setToolTipText("Full-screen window");
623
+ fullButton.addActionListener(this);
624
+
625
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
520626 screenfitButton.setToolTipText("Screen fit");
521627 screenfitButton.addActionListener(this);
522
- oe.aConstraints.gridx += 1;
628
+
629
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreCameraButton.setToolTipText("Restore viewpoint");
631
+ restoreCameraButton.addActionListener(this);
632
+
633
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ saveButton.setToolTipText("New version");
635
+ saveButton.addActionListener(this);
636
+
637
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
+ undoButton.setToolTipText("Previous version");
639
+ undoButton.addActionListener(this);
640
+ undoButton.setEnabled(false);
641
+
642
+ cGridBag updown = new cGridBag().setVertical(true);
643
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ restoreButton.setToolTipText("Restore current");
645
+ restoreButton.addActionListener(this);
646
+ restoreButton.setEnabled(false);
647
+
648
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ replaceButton.setToolTipText("Replace current");
650
+ replaceButton.addActionListener(this);
651
+ replaceButton.setEnabled(false);
652
+
653
+ copyOptionsPanel.add(updown);
654
+
655
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ redoButton.setToolTipText("Next version");
657
+ redoButton.addActionListener(this);
658
+ redoButton.setEnabled(false);
659
+
660
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
661
+ liveCB.setToolTipText("Enable animation");
662
+ liveCB.addItemListener(this);
663
+
664
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
+ oneStepButton.setToolTipText("Animate one step forward");
666
+ oneStepButton.addActionListener(this);
667
+
668
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
669
+ fastCB.setToolTipText("Fast mode");
670
+ fastCB.addItemListener(this);
671
+
672
+ //oe.toolboxPanel.Return();
673
+
674
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
675
+// trackCB.setToolTipText("Enable tracking");
676
+// trackCB.addItemListener(this);
677
+
523678 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
524679 // screenfitpointButton.addActionListener(this);
525
-// oe.aConstraints.gridx += 1;
526
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
527
- snapobjectButton.addActionListener(this);
528
- snapobjectButton.setToolTipText("Snap Object");
529
- oe.aConstraints.gridx += 1;
530680
531
- //aConstraints.gridx = 0;
532
- //aConstraints.gridy += 1;
533
- oe.aConstraints.weighty = 0;
534
- oe.aConstraints.gridwidth = 1;
535
-
536
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
537
- flashSelectionButton.setToolTipText("Show selection");
538
- flashSelectionButton.addActionListener(this);
681
+ if (Globals.ADVANCED)
682
+ {
683
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ snapobjectButton.addActionListener(this);
685
+ snapobjectButton.setToolTipText("Snap Object");
686
+ }
687
+
688
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
539689
540
- oe.toolbarPanel.add(new cButton(" ", false));
541
-
542
- oe.aConstraints.gridx += 1;
543
- oe.aConstraints.weighty = 0;
544
- oe.aConstraints.gridwidth = 1;
545
-
546
- //
547
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
548
- twoButton.setToolTipText("Show center view only");
549
- twoButton.addActionListener(this);
550
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
551691 fourButton.addActionListener(this);
552692 fourButton.setToolTipText("Show left panel only");
553
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
554
- sixButton.setToolTipText("2-column layout left");
693
+
694
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ twoButton.setToolTipText("Show right view only");
696
+ twoButton.addActionListener(this);
697
+ this.fullscreenLayout = twoButton;
698
+
699
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ sixButton.setToolTipText("Show left and right");
555701 sixButton.addActionListener(this);
556
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
557
- threeButton.setToolTipText("2-column layout right");
558
- threeButton.addActionListener(this);
559
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
560
- sevenButton.setToolTipText("3-column layout");
561
- sevenButton.addActionListener(this);
702
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+// threeButton.setToolTipText("2-column layout right");
704
+// threeButton.addActionListener(this);
705
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
706
+// sevenButton.setToolTipText("3-column layout");
707
+// sevenButton.addActionListener(this);
562708 //
563709
564
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
565
- rootButton.setToolTipText("Edit object in new tab");
710
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ rootButton.setToolTipText("Open selection in new tab");
566712 rootButton.addActionListener(this);
567
- oe.aConstraints.gridx += 1;
568
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
713
+
714
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569715 closeButton.setToolTipText("Close tab");
570716 closeButton.addActionListener(this);
571717 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
572718 //clearButton.addActionListener(this);
573
- oe.aConstraints.gridx += 1;
574
-
575
- oe.aConstraints.gridx = 1; //
576
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
577
- editButton.addActionListener(this);
578
- oe.aConstraints.gridx += 1;
579
- oe.aConstraints.weighty = 0;
580
- oe.aConstraints.gridwidth = 1;
581719
582
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
720
+ // INSERT
721
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
722
+ gridButton.setToolTipText("Create grid");
723
+ gridButton.addActionListener(this);
724
+
725
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
726
+ boxButton.setToolTipText("Create box");
727
+ boxButton.addActionListener(this);
728
+
729
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ sphereButton.setToolTipText("Create sphere");
731
+ sphereButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ coneButton.setToolTipText("Create cone");
735
+ coneButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ torusButton.setToolTipText("Create torus");
739
+ torusButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ superButton.setToolTipText("Create superellipsoid");
743
+ superButton.addActionListener(this);
744
+
745
+ if (Globals.ADVANCED)
746
+ {
747
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ kleinButton.setToolTipText("Create Klein bottle");
749
+ kleinButton.addActionListener(this);
750
+ }
751
+
752
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ particlesButton.setToolTipText("Create particle system");
754
+ particlesButton.addActionListener(this);
755
+
756
+ oe.toolboxPanel.Return();
757
+
758
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
759
+ groupButton.setToolTipText("Create group");
760
+ groupButton.addActionListener(this);
761
+
762
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
763
+ compositeButton.setToolTipText("Create composite");
764
+ compositeButton.addActionListener(this);
765
+
766
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
767
+ switchButton.setToolTipText("Create item switcher");
768
+ switchButton.addActionListener(this);
769
+
770
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ loopButton.setToolTipText("Create loop");
772
+ loopButton.addActionListener(this);
773
+
774
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ textureButton.setToolTipText("Create texture");
776
+ textureButton.addActionListener(this);
777
+
778
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
779
+ overlayButton.setToolTipText("Create overlay");
780
+ overlayButton.addActionListener(this);
781
+
782
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
783
+ lightButton.setToolTipText("Create light");
784
+ lightButton.addActionListener(this);
785
+
786
+ for (int i=6; --i>=0;)
787
+ {
788
+ oe.toolboxPanel.Return();
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ oe.toolboxPanel.add(new cGridBag());
794
+ oe.toolboxPanel.add(new cGridBag());
795
+ oe.toolboxPanel.add(new cGridBag());
796
+ }
797
+
798
+ // EDIT panel
799
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editButton.setToolTipText("Pin selection controls");
801
+ editButton.addActionListener(this);
802
+
803
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ uneditButton.setToolTipText("Remove selection controls");
583805 uneditButton.addActionListener(this);
584806
585
- oe.aConstraints.gridx += 1;
586
- oe.aConstraints.weighty = 0;
587
- oe.aConstraints.gridwidth = 1;
588
-
589
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
590
- clearPanelButton.addActionListener(this);
591
-
592
- oe.aConstraints.gridx += 1;
593
- oe.aConstraints.weighty = 0;
594
- oe.aConstraints.gridwidth = 1;
595
-
596
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
807
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
808
+ allParamsButton.setToolTipText("Show all controle");
597809 allParamsButton.addActionListener(this);
598810
599
- oe.aConstraints.gridx += 1;
600
- oe.aConstraints.weighty = 0;
601
- oe.aConstraints.gridwidth = 1;
602
-
603
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
811
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
812
+ clearPanelButton.setToolTipText("Clear edit panel");
813
+ clearPanelButton.addActionListener(this);
814
+
815
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
816
+ unselectButton.setToolTipText("Unselect");
604817 unselectButton.addActionListener(this);
605818
819
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
820
+ flashSelectionButton.setToolTipText("Highlight selection");
821
+ flashSelectionButton.addActionListener(this);
822
+
823
+ editCommandsPanel.preferredHeight = 1;
824
+
825
+ SetPinStates(false);
826
+// oe.treePanel.add(commandsPanel);
827
+// oe.treePanel.Return();
828
+
606829 // oe.aConstraints.gridx += 1;
607830 // oe.aConstraints.weighty = 0;
608831 // oe.aConstraints.gridwidth = 1;
....@@ -614,40 +837,25 @@
614837 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
615838 // gcButton.addActionListener(this);
616839
617
- oe.aConstraints.gridx = 0;
618
- oe.aConstraints.gridy += 1;
619
-
620
- //ctrlPanel.add(objList = new List(5, true));
621
- oe.aConstraints.gridwidth = 100;
622
- // oe.aConstraints.gridheight = 100;
623
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
624
- oe.aConstraints.gridheight = 1;
625
- oe.aConstraints.weighty = 0.5;
626
- oe.aConstraints.gridx = 0;
627
- JScrollPane jSP;
840
+ cGridBag jSPPanel = new cGridBag();
841
+
842
+ JScrollPane jSP;
628843 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
629
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
844
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
630845 ResetModel();
631
- oe.aConstraints.weighty = 0.5;
632
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
633
- oe.aConstraints.gridy += 1;
634
- oe.aConstraints.gridwidth = 1;
635
-
636
- oe.aConstraints.weighty = 0;
637
- oe.aConstraints.gridwidth = 2;
638
-
639
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
640
- colorCB.addItemListener(this);
641
- oe.aConstraints.gridx += 2;
642
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
643
- materialCB.addItemListener(this);
644
- oe.aConstraints.gridx += 2;
645
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
646
- textureCB.addItemListener(this);
647
-
648
- oe.aConstraints.gridx = 0;
649
- oe.aConstraints.gridy += 1;
650846
847
+ oe.treePanel.add(jSPPanel);
848
+ oe.treePanel.Return();
849
+
850
+ oe.treePanel.add(copyOptionsPanel);
851
+ oe.treePanel.Return();
852
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
853
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
854
+ sliderPane.preferredHeight = 1;
855
+
856
+// mainPanel.setDividerLocation(0.5); //1.0);
857
+// mainPanel.setResizeWeight(0.5);
858
+
651859 //jList.addListSelectionListener(this);
652860 oe.jTree.addTreeSelectionListener(this);
653861 //jTree.setRootVisible(false);
....@@ -666,23 +874,160 @@
666874 dgr.addDragGestureListener(this);
667875 }catch(Exception e) {}
668876 */
669
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
670878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
671879 }
880
+
881
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
882
+ {
883
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
884
+ colorCB.setToolTipText("Copy color when dropped");
885
+ colorCB.addItemListener(this);
886
+
887
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
888
+ materialCB.setToolTipText("Copy material when dropped");
889
+ materialCB.addItemListener(this);
890
+
891
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
892
+ textureCB.setToolTipText("Copy texture when dropped");
893
+ textureCB.addItemListener(this);
894
+
895
+ panel.Return();
896
+
897
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
898
+ boxCB.setToolTipText("Display bounding boxes");
899
+ boxCB.addItemListener(this);
900
+
901
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
902
+ zoomBoxCB.setToolTipText("Display only for wheel");
903
+ zoomBoxCB.addItemListener(this);
904
+
905
+ if (true) // Globals.ADVANCED)
906
+ {
907
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
908
+// supportCB.setToolTipText("Enable rigging");
909
+// supportCB.addItemListener(this);
910
+
911
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
912
+ freezeCB.setToolTipText("Fast moving camera");
913
+ freezeCB.addItemListener(this);
914
+
915
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
916
+ // localCB.addItemListener(this);
917
+
918
+ panel.Return();
919
+
920
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
921
+ crowdCB.setToolTipText("Used for crowds");
922
+ crowdCB.addItemListener(this);
923
+
924
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
925
+ smoothCB.setToolTipText("Snapping delay");
926
+ smoothCB.addItemListener(this);
927
+
928
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
929
+ slowCB.setToolTipText("Smooth interpolation");
930
+ slowCB.addItemListener(this);
931
+
932
+// constraints.gridy += 1;
933
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
934
+// speakerMocapCB.addItemListener(this);
935
+
936
+ panel.Return();
937
+
938
+ if (false)
939
+ {
940
+ // handled in scripts
941
+ //constraints.gridy += 1;
942
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
943
+ speakerCameraCB.addItemListener(this);
944
+
945
+ //constraints.gridy += 1;
946
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
947
+ speakerFocusCB.addItemListener(this);
948
+
949
+ //constraints.gridy += 1;
950
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
951
+ smoothfocusCB.addItemListener(this);
952
+ panel.Return();
953
+ }
954
+
955
+//constraints.gridx += 1;
956
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
957
+// debugCB.addItemListener(this);
958
+
959
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
960
+ trackCB.setToolTipText("Enable tracking target");
961
+ trackCB.addItemListener(this);
962
+
963
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
964
+ oeilCB.setToolTipText("Move camera when tracking");
965
+ oeilCB.addItemListener(this);
966
+
967
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
968
+ shadowCB.setToolTipText("When live compute shadows");
969
+ shadowCB.addItemListener(this);
970
+
971
+ panel.Return();
972
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
973
+ toggleTextureCB.setToolTipText("Load textures");
974
+ toggleTextureCB.addItemListener(this);
975
+
976
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
977
+ toggleSwitchCB.setToolTipText("Choose a single item");
978
+ toggleSwitchCB.addItemListener(this);
979
+
980
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
981
+ autokeepCB.setToolTipText("On structure change");
982
+ autokeepCB.addItemListener(this);
983
+
984
+ panel.Return();
985
+ if (Globals.ADVANCED)
986
+ {
987
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
988
+ lookAtCB.setToolTipText("Look-at target");
989
+ lookAtCB.addItemListener(this);
990
+ }
991
+
992
+ }
993
+
994
+ cGridBag fill = new cGridBag();
995
+ fill.preferredHeight = 200;
996
+ cGridBag fill2 = new cGridBag();
997
+ fill2.preferredHeight = 200;
998
+ cGridBag fill3 = new cGridBag();
999
+ fill3.preferredHeight = 200;
1000
+
1001
+ panel.add(fill);
1002
+ panel.add(fill2);
1003
+ panel.add(fill3);
1004
+
1005
+ }
6721006
6731007 void EditObject(Object3D obj)
6741008 {
6751009 cRadio radioButton = new cRadio(obj.name);
1010
+
1011
+ // June 2019. Patch to avoid bug with transparency.
1012
+ radioButton.hadMaterial = obj.material != null;
1013
+ if (!radioButton.hadMaterial)
1014
+ {
1015
+ obj.material = new cMaterial();
1016
+ }
1017
+
6761018 radioButton.SetObject(obj);
677
- radioButton.layout = sevenButton;
1019
+ radioButton.layout = sixButton; // sevenButton;
6781020 radioButton.SetCamera(cameraView.renderCamera, false);
6791021 radioButton.addActionListener(this);
6801022 radioPanel.add(radioButton);
6811023 buttonGroup.add(radioButton);
6821024 radioButton.doClick();
6831025 }
1026
+
6841027 void SetupViews(ObjEditor oe)
6851028 {
1029
+ theFrame = this;
1030
+
6861031 oe.SetupViews();
6871032
6881033 System.out.println("SetupViews");
....@@ -691,23 +1036,28 @@
6911036 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6921037 }
6931038
694
- JCheckBox liveCB;
695
- JCheckBox supportCB;
696
- JCheckBox localCB;
697
- JCheckBox crowdCB;
698
- JCheckBox smoothCB;
699
- JCheckBox fastCB;
700
- JCheckBox slowCB;
701
- JCheckBox boxCB;
702
- JCheckBox zoomBoxCB;
703
- JCheckBox trackCB;
704
- JCheckBox smoothfocusCB;
1039
+ cToggleButton liveCB;
1040
+ cCheckBox supportCB;
1041
+ cCheckBox localCB;
1042
+ cCheckBox crowdCB;
1043
+ cCheckBox smoothCB;
1044
+ cToggleButton fastCB;
1045
+ cCheckBox slowCB;
1046
+ cCheckBox boxCB;
1047
+ cCheckBox zoomBoxCB;
1048
+ cCheckBox freezeCB;
1049
+ //cToggleButton trackCB;
1050
+ cCheckBox trackCB;
1051
+ cCheckBox smoothfocusCB;
7051052 // JCheckBox speakerMocapCB;
706
- JCheckBox speakerCameraCB;
707
- JCheckBox speakerFocusCB;
708
- JCheckBox debugCB;
709
- JCheckBox oeilCB;
710
- JCheckBox lookAtCB;
1053
+ cCheckBox speakerCameraCB;
1054
+ cCheckBox speakerFocusCB;
1055
+ cCheckBox debugCB;
1056
+
1057
+ cCheckBox oeilCB;
1058
+ cCheckBox shadowCB;
1059
+ cCheckBox autokeepCB;
1060
+ cCheckBox lookAtCB;
7111061
7121062 // static int COLOR = 1;
7131063 // static int MATERIAL = 2;
....@@ -715,9 +1065,9 @@
7151065
7161066 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7171067
718
- JCheckBox colorCB;
719
- JCheckBox materialCB;
720
- JCheckBox textureCB;
1068
+ cCheckBox colorCB;
1069
+ cCheckBox materialCB;
1070
+ cCheckBox textureCB;
7211071
7221072 public void itemStateChanged(ItemEvent e)
7231073 {
....@@ -745,6 +1095,7 @@
7451095 } else if(e.getSource() == liveCB)
7461096 {
7471097 cameraView.ToggleLive();
1098
+ refreshContents(false);
7481099 }
7491100 else if(e.getSource() == supportCB)
7501101 {
....@@ -809,6 +1160,18 @@
8091160 {
8101161 cameraView.ToggleOeil();
8111162 }
1163
+ else if(e.getSource() == shadowCB)
1164
+ {
1165
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1166
+ }
1167
+ else if(e.getSource() == freezeCB)
1168
+ {
1169
+ Globals.FREEZEONMOVE ^= true;
1170
+ }
1171
+ else if(e.getSource() == autokeepCB)
1172
+ {
1173
+ Globals.REPLACEONMAKE ^= true;
1174
+ }
8121175 else if(e.getSource() == lookAtCB)
8131176 {
8141177 cameraView.ToggleLookAt();
....@@ -825,7 +1188,8 @@
8251188
8261189 /**/
8271190 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
828
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1191
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1192
+ TreePath path = objEditor.jTree.getSelectionPath();
8291193 if ((path == null) || (path.getPathCount() <= 1)) {
8301194 // We can't move the root node or an empty selection
8311195 return;
....@@ -888,8 +1252,6 @@
8881252 }
8891253 }
8901254
891
- String string = (String) object;
892
-
8931255 System.out.println("Transfer = " + object + "; drop : " + target);
8941256 // if( object instanceof java.io.File[])
8951257 // {
....@@ -897,7 +1259,11 @@
8971259 // objEditor.DropFile((java.io.File[]) object, true);
8981260 // return;
8991261 // }
900
- if (string.charAt(0) == '/')
1262
+
1263
+ String string = object.toString();
1264
+
1265
+ // File path for Mac and Windows
1266
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9011267 {
9021268 // file(s)
9031269 String[] names = string.split("\n");
....@@ -924,7 +1290,7 @@
9241290
9251291 flashIt = false;
9261292 CameraPane pane = (CameraPane) target;
927
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1293
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9281294 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9291295
9301296 if (group.selection.size() == 1)
....@@ -940,23 +1306,33 @@
9401306
9411307 assert target == objEditor.jTree;
9421308 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1309
+ Object3D destinationLeaf;
9431310 try {
944
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1311
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9451312 } catch (Exception e) {
9461313 System.out.println("destinationPath : " + destinationPath);
9471314 return;
9481315 }
9491316
950
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1317
+ for (int i=group.selection.size(); --i>=0;)
9511318 {
1319
+ Object3D child = (Object3D)group.selection.elementAt(i);
1320
+
1321
+ // Cannot move into itself
1322
+ if (child == destinationLeaf)
1323
+ return;
1324
+ }
1325
+
1326
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1327
+// {
9521328 loadClipboard(true);
9531329 objEditor.jTree.setSelectionPath(destinationPath);
954
- pasteInto(false);
955
- } else {
956
- loadClipboard(false);
957
- objEditor.jTree.setSelectionPath(destinationPath);
958
- pasteInto(false); // true); // ???
959
- }
1330
+ pasteInto(false, false);
1331
+// } else {
1332
+// loadClipboard(false);
1333
+// objEditor.jTree.setSelectionPath(destinationPath);
1334
+// pasteInto(false, false); // true); // ???
1335
+// }
9601336 }
9611337 public void dropActionChanged(DropTargetDragEvent dtde)
9621338 // Called if the user has modified the current drop gesture
....@@ -1061,85 +1437,107 @@
10611437 {
10621438 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10631439 //heightFieldItem.addActionListener(this);
1064
- gridItem = menu.add(new MenuItem("Grid"));
1065
- gridItem.addActionListener(this);
1066
- rectoidItem = menu.add(new MenuItem("Box"));
1067
- rectoidItem.addActionListener(this);
1068
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1069
- ellipsoidItem.addActionListener(this);
1070
- coneItem = menu.add(new MenuItem("Cone"));
1071
- coneItem.addActionListener(this);
1072
- torusItem = menu.add(new MenuItem("Torus"));
1073
- torusItem.addActionListener(this);
1074
- superItem = menu.add(new MenuItem("Superellipsoid"));
1075
- superItem.addActionListener(this);
1440
+// gridItem = menu.add(new MenuItem("Grid"));
1441
+// gridItem.addActionListener(this);
1442
+// rectoidItem = menu.add(new MenuItem("Box"));
1443
+// rectoidItem.addActionListener(this);
1444
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1445
+// ellipsoidItem.addActionListener(this);
1446
+// coneItem = menu.add(new MenuItem("Cone"));
1447
+// coneItem.addActionListener(this);
1448
+// torusItem = menu.add(new MenuItem("Torus"));
1449
+// torusItem.addActionListener(this);
1450
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1451
+// superItem.addActionListener(this);
1452
+
1453
+ cameraItem = menu.add(new MenuItem("Camera"));
1454
+ cameraItem.addActionListener(this);
1455
+
1456
+ if (!Globals.ADVANCED)
1457
+ {
10761458 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10771459 kleinItem.addActionListener(this);
1078
- particleItem = menu.add(new MenuItem("Particle system"));
1079
- particleItem.addActionListener(this);
1460
+ }
1461
+
1462
+// particleItem = menu.add(new MenuItem("Particle system"));
1463
+// particleItem.addActionListener(this);
1464
+ if (Globals.ADVANCED)
1465
+ {
10801466 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10811467 ragdollItem.addActionListener(this);
10821468 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10831469 ragdoll2Item.addActionListener(this);
1470
+ }
10841471 menu.add("-");
1085
- meshItem = menu.add(new MenuItem("Mesh"));
1472
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10861473 meshItem.addActionListener(this);
10871474 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10881475 // meshGroupItem.addActionListener(this);
1476
+ if (Globals.ADVANCED)
1477
+ {
10891478 springItem = menu.add(new MenuItem("Spring"));
10901479 springItem.addActionListener(this);
10911480 flagItem = menu.add(new MenuItem("Flag"));
10921481 flagItem.addActionListener(this);
1093
- bezierItem = menu.add(new MenuItem("Patch"));
1094
- bezierItem.addActionListener(this);
1095
- checkerItem = menu.add(new MenuItem("Checker"));
1096
- checkerItem.addActionListener(this);
10971482 blobItem = menu.add(new MenuItem("Blob"));
10981483 blobItem.addActionListener(this);
10991484 latheItem = menu.add(new MenuItem("Lathe"));
11001485 latheItem.addActionListener(this);
1101
- lightItem = menu.add(new MenuItem("Light"));
1102
- lightItem.addActionListener(this);
1486
+ }
1487
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1488
+ bezierItem.addActionListener(this);
1489
+// overlayItem = menu.add(new MenuItem("Overlay"));
1490
+// overlayItem.addActionListener(this);
1491
+// lightItem = menu.add(new MenuItem("Light"));
1492
+// lightItem.addActionListener(this);
11031493 menu.add("-");
11041494 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11051495 //superLoopItem.addActionListener(this);
1106
- loopItem = menu.add(new MenuItem("Loop"));
1107
- loopItem.addActionListener(this);
1496
+// loopItem = menu.add(new MenuItem("Loop"));
1497
+// loopItem.addActionListener(this);
11081498 doubleItem = menu.add(new MenuItem("Fork"));
11091499 doubleItem.addActionListener(this);
1500
+ if (Globals.ADVANCED)
1501
+ {
11101502 tripleItem = menu.add(new MenuItem("Trident"));
11111503 tripleItem.addActionListener(this);
1504
+ }
11121505 }
11131506
11141507 void buildToolsMenu(Menu menu)
11151508 {
11161509 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11171510 animationItem.addItemListener(this);
1118
- animationItem.setState(CameraPane.ANIMATION);
1511
+ animationItem.setState(Globals.ANIMATION);
1512
+
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
11191515
11201516 menu.add("-");
11211517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11221518 parseverticesItem.addActionListener(this);
11231519 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11241520 textureFieldItem.addActionListener(this);
1125
- alignItem = menu.add(new MenuItem("Align"));
1521
+ alignItem = menu.add(new MenuItem("Align Objects"));
11261522 alignItem.addActionListener(this);
1127
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1128
- mirrorItem.addActionListener(this);
11291523 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11301524 reduceMorphItem.addActionListener(this);
11311525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11321526 reduce34MorphItem.addActionListener(this);
1133
-
1134
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1135
- computeAOItem.addActionListener(this);
11361527 menu.add("-");
1137
-
11381528 menu.add(memoryItem = new MenuItem("Memory Usage"));
11391529 memoryItem.addActionListener(this);
1530
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1531
+ computeAOItem.addActionListener(this);
1532
+
1533
+ if (Globals.ADVANCED)
1534
+ {
1535
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1536
+ mirrorItem.addActionListener(this);
1537
+ menu.add("-");
11401538 menu.add(analyzeItem = new MenuItem("Analyze"));
11411539 analyzeItem.addActionListener(this);
1142
- menu.add(dumpItem = new MenuItem("Dump"));
1540
+ menu.add(dumpItem = new MenuItem("Print"));
11431541 dumpItem.addActionListener(this);
11441542 // menu.add(pathItem = new MenuItem("From-to path"));
11451543 // pathItem.addActionListener(this);
....@@ -1157,6 +1555,7 @@
11571555 menu.add("-");
11581556 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11591557 editScriptItem.addActionListener(this);
1558
+ }
11601559 }
11611560
11621561 void ScreenFit()
....@@ -1279,9 +1678,34 @@
12791678 shadow.material = new cMaterial(obj.material);
12801679 shadow.material.diffuse = 0.0001f;
12811680 shadow.material.specular = 0.0001f;
1681
+ //shadow.projectedVertices[1].x = 300;
12821682
12831683 makeSomething(shadow);
12841684 }
1685
+
1686
+ private void ClearUnpinned()
1687
+ {
1688
+ //for (Object3D obj : listUI)
1689
+ for (int i=listUI.size(); --i>=0;)
1690
+ {
1691
+ Object3D obj = listUI.elementAt(i);
1692
+ if (!obj.pinned)
1693
+ {
1694
+ obj.CloseUI();
1695
+ listUI.remove(i);
1696
+ }
1697
+ }
1698
+ }
1699
+
1700
+ private void EditElement(Object3D elem, boolean newWindow)
1701
+ {
1702
+ // if (!(elem instanceof Composite))
1703
+ // newWindow = false;
1704
+ listUI.add(elem);
1705
+ elem.openEditWindow(this, newWindow); //, false);
1706
+ System.out.println("edit : " + elem);
1707
+ elem.editWindow.refreshContents(true); // ? new
1708
+ }
12851709
12861710 /**
12871711 * applyExample
....@@ -1485,9 +1909,9 @@
14851909
14861910 void Overwrite(int mask)
14871911 {
1488
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1912
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14891913 {
1490
- Object3D content = GrafreeD.clipboard.get(0);
1914
+ Object3D content = Grafreed.clipboard.get(0);
14911915
14921916 if (content instanceof cGroup && ((cGroup)content).transientlink )
14931917 content = ((cGroup)content).get(0);
....@@ -1510,6 +1934,7 @@
15101934 //
15111935 public void actionPerformed(ActionEvent event) // , Object arg)
15121936 {
1937
+ Object source = event.getSource();
15131938 /*
15141939 if (event.getSource() == nameField)
15151940 {
....@@ -1521,11 +1946,11 @@
15211946 }
15221947 else
15231948 */
1524
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1949
+ if (source == lookAtItem || source == lookFromItem)
15251950 {
15261951 ScreenFit();
15271952 } else
1528
- if (event.getSource() == switchItem)
1953
+ if (source == switchViewItem)
15291954 {
15301955 cVector v1 = new cVector();
15311956 cVector v2 = new cVector();
....@@ -1534,11 +1959,11 @@
15341959 objEditor.cameraView.renderCamera.setAim(v2, v1);
15351960 objEditor.cameraView.repaint();
15361961 } else
1537
- if (event.getSource() == rectoidItem)
1962
+ if (source == rectoidItem || source == boxButton)
15381963 {
15391964 makeSomething(new Box());
15401965 } else
1541
- if (event.getSource() == particleItem)
1966
+ if (source == particleItem || source == particlesButton)
15421967 {
15431968 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15441969 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1559,9 +1984,9 @@
15591984 applyExample(particleGeom, "SMOKE");
15601985 makeSomething(particleGeom);
15611986 } else
1562
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1987
+ if (source == ragdollItem || source == ragdoll2Item)
15631988 {
1564
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1989
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15651990
15661991 ragdoll.toParent = LA.newMatrix();
15671992 ragdoll.fromParent = LA.newMatrix();
....@@ -1579,7 +2004,7 @@
15792004 } else
15802005 /*
15812006 */
1582
- if (event.getSource() == heightFieldItem)
2007
+ if (source == heightFieldItem)
15832008 {
15842009 Object3D obj = new Object3D();
15852010
....@@ -1617,31 +2042,31 @@
16172042
16182043 makeSomething(obj);
16192044 } else
1620
- if (event.getSource() == gridItem)
2045
+ if (source == gridItem || source == gridButton)
16212046 {
16222047 makeSomething(new Grid());
16232048 } else
1624
- if (event.getSource() == ellipsoidItem)
2049
+ if (source == ellipsoidItem || source == sphereButton)
16252050 {
16262051 makeSomething(new Sphere());
16272052 } else
1628
- if (event.getSource() == coneItem)
2053
+ if (source == coneItem || source == coneButton)
16292054 {
16302055 makeSomething(new Cone());
16312056 } else
1632
- if (event.getSource() == torusItem)
2057
+ if (source == torusItem || source == torusButton)
16332058 {
16342059 makeSomething(new Torus());
16352060 } else
1636
- if (event.getSource() == superItem)
2061
+ if (source == superItem || source == superButton)
16372062 {
16382063 makeSomething(new Superellipsoid());
16392064 } else
1640
- if (event.getSource() == kleinItem)
2065
+ if (source == kleinItem || source == kleinButton)
16412066 {
16422067 makeSomething(new Klein());
16432068 } else
1644
- if (event.getSource() == blobItem)
2069
+ if (source == blobItem)
16452070 {
16462071 Blob blob = new Blob();
16472072 BlobComponent comp = new BlobComponent();
....@@ -1649,15 +2074,15 @@
16492074 //blob.retile();
16502075 makeSomething(blob);
16512076 } else
1652
- if (event.getSource() == latheItem)
2077
+ if (source == latheItem)
16532078 {
16542079 makeSomething(new Lathe());
16552080 } else
1656
- if (event.getSource() == bezierItem)
2081
+ if (source == bezierItem)
16572082 {
16582083 makeSomething(new BezierSurface());
16592084 } else
1660
- if (event.getSource() == checkerItem)
2085
+ if (source == overlayItem || source == overlayButton)
16612086 {
16622087 /*
16632088 Object3D obj = new BezierSurface(5,8);
....@@ -1672,7 +2097,7 @@
16722097 */
16732098 makeSomething(new Checker());
16742099 } else
1675
- if (event.getSource() == meshItem)
2100
+ if (source == meshItem)
16762101 {
16772102 Object3D itemtomake = new Object3D();
16782103 Object3D child;
....@@ -1693,35 +2118,35 @@
16932118 makeSomething(child);
16942119 }
16952120 } else
1696
- if (event.getSource() == springItem)
2121
+ if (source == springItem)
16972122 {
16982123 cSpring s = new cSpring();
16992124 s.setup();
17002125 makeSomething(s);
17012126 } else
1702
- if (event.getSource() == flagItem)
2127
+ if (source == flagItem)
17032128 {
17042129 cSpring s = new cFlag();
17052130 s.setup();
17062131 makeSomething(s);
17072132 } else
1708
- if (event.getSource() == lightItem)
2133
+ if (source == lightItem || source == lightButton)
17092134 {
17102135 makeSomething(new Light());
17112136 } else
1712
- if (event.getSource() == csgItem)
2137
+ if (source == csgItem)
17132138 {
17142139 group(new CSG());
17152140 } else
1716
- if (event.getSource() == templateItem)
2141
+ if (source == templateItem)
17172142 {
17182143 group(new cTemplate());
17192144 } else
1720
- if (event.getSource() == attributeItem)
2145
+ if (source == attributeItem)
17212146 {
17222147 makeSomething(new Attribute());
17232148 } else
1724
- if (event.getSource() == pointflowItem)
2149
+ if (source == pointflowItem)
17252150 {
17262151 makeSomething(new PointFlow());
17272152 } else
....@@ -1733,7 +2158,7 @@
17332158 } else
17342159 */
17352160
1736
- if (event.getSource() == superLoopItem)
2161
+ if (source == superLoopItem)
17372162 {
17382163 Composite g = new cGroup();
17392164 for (int i=0; i<15; i++)
....@@ -1755,30 +2180,30 @@
17552180
17562181 group(g);
17572182 } else
1758
- if (event.getSource() == loopItem)
2183
+ if (source == loopItem || source == loopButton)
17592184 {
17602185 Composite csg = new GroupLeaf();
17612186 csg.count = 5;
17622187 group(csg);
1763
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
17642189 csg.addChild(child);
17652190 child.addChild(csg);
17662191 } else
1767
- if (event.getSource() == doubleItem)
2192
+ if (source == doubleItem)
17682193 {
1769
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
17702195 csg.count = 5;
17712196 group(csg);
1772
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
17732198 csg.addChild(child);
17742199 child.addChild(csg);
1775
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
17762201 csg.addChild(child);
17772202 child.addChild(csg);
17782203 } else
1779
- if (event.getSource() == tripleItem)
2204
+ if (source == tripleItem)
17802205 {
1781
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
17822207 csg.count = 4;
17832208 group(csg);
17842209 Composite child = new cGroup();
....@@ -1791,73 +2216,98 @@
17912216 csg.addChild(child);
17922217 child.addChild(csg);
17932218 } else
1794
-
1795
- if (event.getSource() == importGFDItem)
1796
- {
1797
- ImportGFD();
1798
- } else
1799
- if (event.getSource() == importVRMLX3DItem)
1800
- {
1801
- ImportVRMLX3D();
1802
- } else
1803
- if (event.getSource() == import3DSItem)
1804
- {
1805
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1806
- } else
1807
- if (event.getSource() == importOBJItem)
1808
- {
1809
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1810
- } else
1811
- if (event.getSource() == computeAOItem)
2219
+ if (source == computeAOItem)
18122220 {
18132221 Globals.drawMode = CameraPane.OCCLUSION;
18142222 Globals.theRenderer.repaint();
18152223 } else
1816
- if (event.getSource() == recompileItem)
2224
+ if (source == recompileItem)
18172225 {
18182226 Recompile();
18192227 refreshContents();
18202228 } else
1821
- if (event.getSource() == editScriptItem)
2229
+ if (source == editScriptItem)
18222230 {
18232231 OpenDialog();
18242232 refreshContents();
18252233 } else
1826
- if (event.getSource() == invariantsItem)
2234
+ if (source == invariantsItem)
18272235 {
18282236 System.out.println("Invariants:");
1829
- GrafreeD.grafreeD.universe.invariants();
2237
+ Grafreed.grafreeD.universe.invariants();
18302238 } else
1831
- if (event.getSource() == memoryItem)
2239
+ if (source == memoryItem)
18322240 {
18332241 //System.out.println("Invariants:");
18342242 PrintMemory();
18352243 } else
1836
- if (event.getSource() == pathItem)
2244
+ if (source == pathItem)
18372245 {
18382246 PrintPath();
18392247 } else
1840
- if (event.getSource() == analyzeItem)
2248
+ if (source == analyzeItem)
18412249 {
18422250 AnalyzeObject();
18432251 } else
1844
- if (event.getSource() == dumpItem)
2252
+ if (source == dumpItem)
18452253 {
18462254 DumpObject();
18472255 } else
1848
- if (event.getSource() == screenfitButton)
2256
+ if (source == minButton)
18492257 {
1850
- //Reload(lastConverter, lastFilename, true);
2258
+ Minimize();
2259
+ } else
2260
+ if (source == maxButton)
2261
+ {
2262
+ Maximize();
2263
+ } else
2264
+ if (source == fullButton)
2265
+ {
2266
+ ToggleFullScreen();
2267
+ } else
2268
+ if (source == undoButton)
2269
+ {
2270
+ // Go to previous version
2271
+ //if (!Undo())
2272
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2273
+ Undo();
2274
+ } else
2275
+ if (source == restoreButton)
2276
+ {
2277
+ // Restore current version
2278
+ Restore();
2279
+ } else
2280
+ if (source == replaceButton)
2281
+ {
2282
+ // Overwrite current version
2283
+ Replace();
2284
+ } else
2285
+ if (source == redoButton)
2286
+ {
2287
+ // Go to next version
2288
+ Redo();
2289
+ } else
2290
+ if (source == saveButton)
2291
+ {
2292
+ // Save a new version
2293
+ if (!Save(true))
2294
+ java.awt.Toolkit.getDefaultToolkit().beep();
2295
+ } else
2296
+ if (source == oneStepButton)
2297
+ {
2298
+ Globals.ONESTEP = true;
2299
+ cameraView.repaint();
2300
+ } else
2301
+ if (source == screenfitButton)
2302
+ {
18512303 ScreenFit();
18522304 } else
1853
- if (event.getSource() == screenfitpointButton)
2305
+ if (source == screenfitpointButton)
18542306 {
1855
- //Reload(lastConverter, lastFilename, true);
18562307 ScreenFitPoint();
18572308 } else
1858
- if (event.getSource() == snapobjectButton)
2309
+ if (source == snapobjectButton)
18592310 {
1860
- //Reload(lastConverter, lastFilename, true);
18612311 SnapObject();
18622312 } else
18632313 // if (event.getSource() == recompileButton)
....@@ -1866,13 +2316,13 @@
18662316 // Recompile();
18672317 // refreshContents();
18682318 // } else
1869
- if (event.getSource() == gcButton)
2319
+ if (source == gcButton)
18702320 {
18712321 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18722322 System.gc();
18732323 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18742324 } else
1875
- if (event.getSource() == editLeafItem)
2325
+ if (source == editLeafItem)
18762326 {
18772327 Object3D obj;
18782328 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1886,62 +2336,74 @@
18862336 }
18872337 refreshContents(true);
18882338 } else
1889
- if (event.getSource() == openWindowItem)
2339
+ if (source == openWindowItem)
18902340 {
18912341 EditSelection(true);
18922342 } else
1893
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2343
+ if (source == cutItem || source == clearButton)
18942344 {
18952345 loadClipboard(true);
18962346 } else
1897
- if (event.getSource() == duplicateItem)
2347
+ if (source == undoItem)
18982348 {
1899
- Object3D keep = GrafreeD.clipboard;
2349
+ Undo();
2350
+ } else
2351
+ if (source == redoItem)
2352
+ {
2353
+ Redo();
2354
+ } else
2355
+ if (source == duplicateItem)
2356
+ {
2357
+ Object3D keep = Grafreed.clipboard;
19002358 loadClipboard(false);
19012359 paste(false);
1902
- GrafreeD.clipboard = keep;
2360
+ Grafreed.clipboard = keep;
19032361 } else
1904
- if (event.getSource() == cloneItem)
2362
+ if (source == cloneItem)
19052363 {
19062364 CloneSelection(false);
19072365 } else
1908
- if (event.getSource() == cloneSupportItem)
2366
+ if (source == cloneSupportItem)
19092367 {
19102368 CloneSelection(true);
19112369 } else
1912
- if (event.getSource() == copyItem)
2370
+ if (source == copyItem)
19132371 {
19142372 loadClipboard(false);
19152373 } else
1916
- if (event.getSource() == pasteItem)
2374
+ if (source == pasteItem)
19172375 {
19182376 paste(false);
19192377 } else
1920
- if (event.getSource() == pasteLinkItem)
2378
+ if (source == pasteIntoItem)
19212379 {
1922
- pasteInto(false);
2380
+ pasteInto(true, false);
19232381 } else
1924
- if (event.getSource() == pasteCloneItem)
2382
+ if (source == pasteLinkItem)
19252383 {
1926
- pasteInto(true);
2384
+ pasteInto(false, false);
19272385 } else
1928
- if (event.getSource() == pasteExpandItem)
2386
+ if (source == pasteCloneItem)
2387
+ {
2388
+ pasteInto(true, true);
2389
+ } else
2390
+ if (source == pasteExpandItem)
19292391 {
19302392 paste(true);
19312393 } else
1932
- if (event.getSource() == synchronizeItem)
2394
+ if (source == synchronizeItem)
19332395 {
19342396 Overwrite(Object3D.TRANSFORM);
19352397 } else
1936
- if (event.getSource() == overwriteNameItem)
2398
+ if (source == overwriteNameItem)
19372399 {
19382400 Overwrite(Object3D.NAME);
19392401 } else
1940
- if (event.getSource() == overwriteUVItem)
2402
+ if (source == overwriteUVItem)
19412403 {
19422404 Overwrite(Object3D.UV);
19432405 } else
1944
- if (event.getSource() == overwriteMatItem)
2406
+ if (source == overwriteMatItem)
19452407 {
19462408 /* july 2015
19472409 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1961,7 +2423,7 @@
19612423
19622424 Overwrite(dropAttributes);
19632425 }
1964
- if (event.getSource() == overwriteGeoItem)
2426
+ if (source == overwriteGeoItem)
19652427 {
19662428 Overwrite(Object3D.GEOMETRY);
19672429 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1978,7 +2440,7 @@
19782440 // refreshContents();
19792441 // }
19802442 } else
1981
- if (event.getSource() == generateMeshItem)
2443
+ if (source == generateMeshItem)
19822444 {
19832445 //if (group.selection.size() == 1)
19842446 // for (int i=0; i<group.selection.size(); i++)
....@@ -1989,7 +2451,7 @@
19892451 ResetModel();
19902452 refreshContents();
19912453 } else
1992
- if (event.getSource() == extractGeometriesItem)
2454
+ if (source == extractGeometriesItem)
19932455 {
19942456 boolean one = false;
19952457
....@@ -2016,7 +2478,7 @@
20162478 ResetModel();
20172479 refreshContents();
20182480 } else
2019
- if (event.getSource() == cloneGeometriesItem)
2481
+ if (source == cloneGeometriesItem)
20202482 {
20212483 boolean one = false;
20222484
....@@ -2042,7 +2504,7 @@
20422504 ResetModel();
20432505 refreshContents();
20442506 } else
2045
- if (event.getSource() == shareGeometriesItem)
2507
+ if (source == shareGeometriesItem)
20462508 {
20472509 boolean one = false;
20482510
....@@ -2072,7 +2534,7 @@
20722534 refreshContents();
20732535 }
20742536 } else
2075
- if (event.getSource() == mergeGeometriesItem)
2537
+ if (source == mergeGeometriesItem)
20762538 {
20772539 boolean one = false;
20782540
....@@ -2102,7 +2564,7 @@
21022564 ResetModel();
21032565 refreshContents();
21042566 } else
2105
- if (event.getSource() == linkverticesItem)
2567
+ if (source == linkverticesItem)
21062568 {
21072569 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
21082570 // {
....@@ -2115,9 +2577,9 @@
21152577 // group.selection.get(0).setMasterThis(content); // should be identity
21162578 // refreshContents();
21172579 // }
2118
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2580
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21192581 {
2120
- Object3D content = GrafreeD.clipboard.get(0);
2582
+ Object3D content = Grafreed.clipboard.get(0);
21212583
21222584 if (content instanceof cGroup && ((cGroup)content).transientlink )
21232585 content = ((cGroup)content).get(0);
....@@ -2125,38 +2587,38 @@
21252587 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21262588 for (int i=0; i<group.selection.size(); i++)
21272589 {
2128
- boolean random = CameraPane.RANDOM;
2129
- CameraPane.RANDOM = false; // parse all random nodes
2590
+ boolean random = CameraPane.SWITCH;
2591
+ CameraPane.SWITCH = false; // parse all random nodes
21302592 group.selection.get(i).linkVerticesThis(content);
21312593 // group.selection.get(i).setMasterThis(content); // should be identity
2132
- CameraPane.RANDOM = random;
2594
+ CameraPane.SWITCH = random;
21332595 }
21342596 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21352597 refreshContents();
21362598 }
21372599 } else
2138
- if (event.getSource() == resetsupportItem)
2600
+ if (source == resetsupportItem)
21392601 {
21402602 for (int i=0; i<group.selection.size(); i++)
21412603 {
2142
- boolean random = CameraPane.RANDOM;
2143
- CameraPane.RANDOM = false; // parse all random nodes
2604
+ boolean random = CameraPane.SWITCH;
2605
+ CameraPane.SWITCH = false; // parse all random nodes
21442606 group.selection.get(i).linkVerticesThis(null);
2145
- CameraPane.RANDOM = random;
2607
+ CameraPane.SWITCH = random;
21462608 }
21472609
21482610 refreshContents();
21492611 } else
2150
- if (event.getSource() == relinkverticesItem)
2612
+ if (source == relinkverticesItem)
21512613 {
2152
- boolean random = CameraPane.RANDOM;
2153
- CameraPane.RANDOM = false; // parse all random nodes
2614
+ boolean random = CameraPane.SWITCH;
2615
+ CameraPane.SWITCH = false; // parse all random nodes
21542616 group.selection.RelinkToSupport();
2155
- CameraPane.RANDOM = random;
2617
+ CameraPane.SWITCH = random;
21562618
21572619 refreshContents();
21582620 } else
2159
- if (event.getSource() == resetreferencesItem)
2621
+ if (source == resetreferencesItem)
21602622 {
21612623 for (int i=0; i<group.selection.size(); i++)
21622624 {
....@@ -2165,11 +2627,11 @@
21652627
21662628 refreshContents();
21672629 } else
2168
- if (event.getSource() == setMasterItem)
2630
+ if (source == setMasterItem)
21692631 {
2170
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2632
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21712633 {
2172
- Object3D content = GrafreeD.clipboard.get(0);
2634
+ Object3D content = Grafreed.clipboard.get(0);
21732635
21742636 if (content instanceof cGroup && ((cGroup)content).transientlink )
21752637 content = ((cGroup)content).get(0);
....@@ -2178,13 +2640,13 @@
21782640 refreshContents();
21792641 }
21802642 } else
2181
- if (event.getSource() == poseMeshItem)
2643
+ if (source == poseMeshItem)
21822644 {
21832645 if (group.selection.size() == 1)
21842646 {
2185
- if (GrafreeD.clipboard.size() == 1)
2647
+ if (Grafreed.clipboard.size() == 1)
21862648 {
2187
- Object3D content = GrafreeD.clipboard.get(0);
2649
+ Object3D content = Grafreed.clipboard.get(0);
21882650
21892651 if (content instanceof cGroup && ((cGroup)content).transientlink )
21902652 content = ((cGroup)content).get(0);
....@@ -2197,19 +2659,19 @@
21972659 }
21982660
21992661 } else
2200
- if (event.getSource() == revertMeshItem)
2662
+ if (source == revertMeshItem)
22012663 {
22022664 RevertMeshes();
22032665 } else
2204
- if (event.getSource() == resetMeshItem)
2666
+ if (source == resetAllItem)
22052667 {
22062668 ResetAll();
22072669 } else
2208
- if (event.getSource() == stepAllItem)
2670
+ if (source == stepAllItem)
22092671 {
22102672 StepAll();
22112673 } else
2212
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
22132675 {
22142676 //int indices[] = jList.getSelectedIndices();
22152677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2217,46 +2679,46 @@
22172679
22182680 ClearSelection(false);
22192681 } else
2220
- if (event.getSource() == clearAllItem)
2682
+ if (source == clearAllItem)
22212683 {
22222684 ClearSelection(true);
22232685 } else
2224
- if (event.getSource() == grabItem)
2686
+ if (source == grabItem || source == groupButton)
22252687 {
2226
- group(new cGroup(), true);
2688
+ group(new cGroup(), false); // true);
22272689 } else
2228
- if (event.getSource() == hideItem)
2690
+ if (source == hideItem)
22292691 {
22302692 group(new HiddenObject());
22312693 } else
2232
- if (event.getSource() == frontItem)
2694
+ if (source == frontItem)
22332695 {
22342696 front();
22352697 } else
2236
- if (event.getSource() == backItem)
2698
+ if (source == backItem)
22372699 {
22382700 back();
22392701 } else
2240
- if (event.getSource() == cameraItem)
2702
+ if (source == cameraItem)
22412703 {
22422704 makeSomething(new Camera());
22432705 } else
2244
- if (event.getSource() == compositeItem)
2706
+ if (source == compositeItem || source == compositeButton)
22452707 {
22462708 group(new Composite());
22472709 } else
2248
- if (event.getSource() == randomItem)
2710
+ if (source == switchItem || source == switchButton)
22492711 {
22502712 RandomNode random = new RandomNode();
22512713 group(random);
22522714 if (random.size() > 0)
2253
- random.name = random.get(0).name + "Rnd";
2715
+ random.name = random.get(0).name + "Switch";
22542716 } else
2255
- if (event.getSource() == physicsItem)
2717
+ if (source == physicsItem)
22562718 {
22572719 group(new PhysicsNode());
22582720 } else
2259
- if (event.getSource() == frameselectorItem)
2721
+ if (source == frameselectorItem)
22602722 {
22612723 for (int i=0; i<group.selection.size(); i++)
22622724 {
....@@ -2268,7 +2730,7 @@
22682730 ResetModel();
22692731 refreshContents();
22702732 } else
2271
- if (event.getSource() == switchGeoItem)
2733
+ if (source == switchGeoItem)
22722734 {
22732735 for (int i=0; i<group.selection.size(); i++)
22742736 {
....@@ -2280,7 +2742,7 @@
22802742 ResetModel();
22812743 refreshContents();
22822744 } else
2283
- if (event.getSource() == switchTransfoItem)
2745
+ if (source == switchTransfoItem)
22842746 {
22852747 for (int i=0; i<group.selection.size(); i++)
22862748 {
....@@ -2292,7 +2754,7 @@
22922754 ResetModel();
22932755 refreshContents();
22942756 } else
2295
- if (event.getSource() == morphItem)
2757
+ if (source == morphItem)
22962758 {
22972759 for (int i=0; i<group.selection.size(); i++)
22982760 {
....@@ -2304,7 +2766,7 @@
23042766 ResetModel();
23052767 refreshContents();
23062768 } else
2307
- if (event.getSource() == scriptNodeItem)
2769
+ if (source == scriptNodeItem)
23082770 {
23092771 boolean atleastone = false;
23102772
....@@ -2343,215 +2805,252 @@
23432805 }
23442806 }
23452807 } else
2346
- if (event.getSource() == linkerItem)
2808
+ if (source == linkerItem)
23472809 {
23482810 group(new cLinker());
23492811 } else
2350
- if (event.getSource() == textureItem)
2812
+ if (source == textureItem || source == textureButton)
23512813 {
23522814 group(new TextureNode());
23532815 } else
2354
- if (event.getSource() == billboardItem)
2816
+ if (source == billboardItem)
23552817 {
23562818 group(new BillboardNode());
23572819 } else
2358
- if (event.getSource() == shadowXItem)
2820
+ if (source == shadowXItem)
23592821 {
23602822 CastShadow(0);
23612823 } else
2362
- if (event.getSource() == shadowYItem)
2824
+ if (source == shadowYItem)
23632825 {
23642826 CastShadow(1);
23652827 } else
2366
- if (event.getSource() == shadowZItem)
2828
+ if (source == shadowZItem)
23672829 {
23682830 CastShadow(2);
23692831 } else
2370
- if (event.getSource() == ungroupItem)
2832
+ if (source == ungroupItem || source == ungroupButton)
23712833 {
2372
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
23732836 for (int i=0; i<group.selection.size(); i++)
23742837 {
2375
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
23762843 }
23772844
2378
- ClearSelection(false);
2379
-
2380
- refreshContents();
2845
+ if (!hasRoot)
2846
+ {
2847
+ for (int i=0; i<group.selection.size(); i++)
2848
+ {
2849
+ Ungroup(group.selection.get(i));
2850
+ }
2851
+
2852
+ ClearSelection(false);
2853
+
2854
+ refreshContents();
2855
+ }
23812856 } else
2382
- if (event.getSource() == genUVItem)
2857
+ if (source == genUVItem)
23832858 {
23842859 GenUV();
23852860 } else
2386
- if (event.getSource() == genNormalsCADItem)
2861
+ if (source == genNormalsCADItem)
23872862 {
23882863 GenNormals(true);
23892864 } else
2390
- if (event.getSource() == genNormalsMESHItem)
2865
+ if (source == genNormalsMESHItem)
23912866 {
2392
- GenNormals(true); // TODO
2867
+ GenNormalsMESH();
23932868 } else
2394
- if (event.getSource() == genNormalsORGANItem)
2869
+ if (source == genNormalsORGANItem)
23952870 {
23962871 GenNormals(false);
23972872 } else
2398
- if (event.getSource() == genNormalsMINEItem)
2873
+ if (source == genNormalsMINEItem)
23992874 {
24002875 GenNormalsMINE();
24012876 } else
2402
- if (event.getSource() == stripifyItem)
2877
+ if (source == stripifyItem)
24032878 {
24042879 Stripify();
24052880 } else
2406
- if (event.getSource() == unstripifyItem)
2881
+ if (source == unstripifyItem)
24072882 {
24082883 Unstripify();
24092884 } else
2410
- if (event.getSource() == trimItem)
2885
+ if (source == trimItem)
24112886 {
24122887 Trim();
24132888 } else
2414
- if (event.getSource() == untrimItem)
2889
+ if (source == untrimItem)
24152890 {
24162891 Untrim();
24172892 } else
2418
- if (event.getSource() == clearColorsItem)
2893
+ if (source == clearColorsItem)
24192894 {
24202895 ClearColors();
24212896 } else
2422
- if (event.getSource() == clearMaterialsItem)
2897
+ if (source == clearMaterialsItem)
24232898 {
24242899 ClearMaterials();
24252900 } else
2426
- if (event.getSource() == liveleavesItem)
2901
+ if (source == liveleavesItem)
24272902 {
24282903 LiveLeaves(true);
24292904 } else
2430
- if (event.getSource() == unliveleavesItem)
2905
+ if (source == unliveleavesItem)
24312906 {
24322907 LiveLeaves(false);
24332908 } else
2434
- if (event.getSource() == supportleavesItem)
2909
+ if (source == supportleavesItem)
24352910 {
24362911 SupportLeaves(true);
24372912 } else
2438
- if (event.getSource() == unsupportleavesItem)
2913
+ if (source == unsupportleavesItem)
24392914 {
24402915 SupportLeaves(false);
24412916 } else
2442
- if (event.getSource() == hideleavesItem)
2917
+ if (source == hideleavesItem)
24432918 {
24442919 HideLeaves(true);
24452920 } else
2446
- if (event.getSource() == showleavesItem)
2921
+ if (source == showleavesItem)
24472922 {
24482923 HideLeaves(false);
24492924 } else
2450
- if (event.getSource() == markleavesItem)
2925
+ if (source == markleavesItem)
24512926 {
24522927 MarkLeaves(true);
24532928 } else
2454
- if (event.getSource() == unmarkleavesItem)
2929
+ if (source == unmarkleavesItem)
24552930 {
24562931 MarkLeaves(false);
24572932 } else
2458
- if (event.getSource() == flipVItem)
2933
+ if (source == rewindleavesItem)
2934
+ {
2935
+ RewindLeaves(true);
2936
+ } else
2937
+ if (source == unrewindleavesItem)
2938
+ {
2939
+ RewindLeaves(false);
2940
+ } else
2941
+ if (source == randomleavesItem)
2942
+ {
2943
+ RandomLeaves(true);
2944
+ } else
2945
+ if (source == unrandomleavesItem)
2946
+ {
2947
+ RandomLeaves(false);
2948
+ } else
2949
+ if (source == flipVItem)
24592950 {
24602951 FlipV(true);
24612952 } else
2462
- if (event.getSource() == unflipVItem)
2953
+ if (source == unflipVItem)
24632954 {
24642955 FlipV(false);
24652956 } else
2466
- if (event.getSource() == lowTexturesItem)
2957
+ if (source == lowTexturesItem)
24672958 {
24682959 SetTexRes(0);
24692960 } else
2470
- if (event.getSource() == normalTexturesItem)
2961
+ if (source == normalTexturesItem)
24712962 {
24722963 SetTexRes(1);
24732964 } else
2474
- if (event.getSource() == highTexturesItem)
2965
+ if (source == highTexturesItem)
24752966 {
24762967 SetTexRes(2);
24772968 } else
2478
- if (event.getSource() == veryhighTexturesItem)
2969
+ if (source == veryhighTexturesItem)
24792970 {
24802971 SetTexRes(3);
24812972 } else
2482
- if (event.getSource() == maxTexturesItem)
2973
+ if (source == maxTexturesItem)
24832974 {
24842975 SetTexRes(4);
24852976 } else
2486
- if (event.getSource() == panoTexturesItem)
2977
+ if (source == panoTexturesItem)
24872978 {
24882979 SetTexRes(5);
24892980 } else
2490
- if (event.getSource() == reverseNormalsItem)
2981
+ if (source == reverseNormalsItem)
24912982 {
24922983 ReverseNormals();
24932984 } else
2494
- if (event.getSource() == parseverticesItem)
2985
+ if (source == parseverticesItem)
24952986 {
24962987 ParseVertices();
24972988 } else
2498
- if (event.getSource() == textureFieldItem)
2989
+ if (source == textureFieldItem)
24992990 {
25002991 TextureVertices();
25012992 } else
2502
- if (event.getSource() == alignItem)
2993
+ if (source == alignItem)
25032994 {
25042995 Align();
25052996 } else
2506
- if (event.getSource() == mirrorItem)
2997
+ if (source == mirrorItem)
25072998 {
25082999 MirrorPoses();
25093000 } else
2510
- if (event.getSource() == reduceMorphItem)
3001
+ if (source == reduceMorphItem)
25113002 {
25123003 MeshReduction(false);
25133004 } else
2514
- if (event.getSource() == reduce34MorphItem)
3005
+ if (source == reduce34MorphItem)
25153006 {
25163007 MeshReduction(true);
25173008 } else
2518
- if (event.getSource() == reverseTrianglesItem)
3009
+ if (source == reverseTrianglesItem)
25193010 {
25203011 ReverseTriangles();
25213012 } else
2522
- if (event.getSource() == reduceMeshItem)
3013
+ if (source == reduceMeshItem)
25233014 {
25243015 ReduceMesh(false);
25253016 } else
2526
- if (event.getSource() == reduce34MeshItem)
3017
+ if (source == reduce34MeshItem)
25273018 {
25283019 ReduceMesh(true);
25293020 } else
2530
- if (event.getSource() == increaseMeshItem)
3021
+ if (source == increaseMeshItem)
25313022 {
25323023 IncreaseMesh();
25333024 } else
2534
- if (event.getSource() == clipMeshItem)
3025
+ if (source == clipMeshItem)
25353026 {
25363027 ClipMesh();
25373028 } else
2538
- if (event.getSource() == smoothMeshItem)
3029
+ if (source == smoothMeshItem)
25393030 {
25403031 SmoothMesh();
25413032 } else
2542
- if (event.getSource() == transformgeometryItem)
3033
+ if (source == transformGeometryItem)
25433034 {
25443035 TransformGeometry();
25453036 } else
2546
- if (event.getSource() == resetTransformItem)
3037
+ if (source == transformChildrenItem)
3038
+ {
3039
+ TransformChildren();
3040
+ } else
3041
+ if (source == resetTransformItem)
25473042 {
25483043 ResetTransform();
25493044 } else
2550
- if (event.getSource() == resetCentroidItem)
3045
+ if (source == resetCentroidItem)
25513046 {
2552
- ResetCentroid();
3047
+ ResetCentroid(true);
25533048 } else
2554
- if (event.getSource() == resetParentItem)
3049
+ if (source == resetCentroidXZItem)
3050
+ {
3051
+ ResetCentroid(false);
3052
+ } else
3053
+ if (source == resetParentItem)
25553054 {
25563055 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25573056 {
....@@ -2561,7 +3060,7 @@
25613060
25623061 refreshContents();
25633062 } else
2564
- if (event.getSource() == repairParentItem)
3063
+ if (source == repairParentItem)
25653064 {
25663065 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25673066 {
....@@ -2575,7 +3074,7 @@
25753074
25763075 refreshContents();
25773076 } else
2578
- if (event.getSource() == repairShadowItem)
3077
+ if (source == repairShadowItem)
25793078 {
25803079 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25813080 {
....@@ -2589,7 +3088,7 @@
25893088
25903089 refreshContents();
25913090 } else
2592
- if (event.getSource() == sortbysizeItem)
3091
+ if (source == sortbysizeItem)
25933092 {
25943093 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25953094 {
....@@ -2601,7 +3100,7 @@
26013100 ResetModel();
26023101 refreshContents();
26033102 } else
2604
- if (event.getSource() == sortbynameItem)
3103
+ if (source == sortbynameItem)
26053104 {
26063105 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26073106 {
....@@ -2613,7 +3112,7 @@
26133112 ResetModel();
26143113 refreshContents();
26153114 } else
2616
- if (event.getSource() == attachPigmentItem)
3115
+ if (source == attachPigmentItem)
26173116 {
26183117 String texture = GetFile("Attach pigment");
26193118 Object3D obj;
....@@ -2625,7 +3124,7 @@
26253124
26263125 refreshContents();
26273126 } else
2628
- if (event.getSource() == detachPigmentItem)
3127
+ if (source == detachPigmentItem)
26293128 {
26303129 Object3D obj;
26313130 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2636,7 +3135,7 @@
26363135
26373136 refreshContents();
26383137 } else
2639
- if (event.getSource() == attachBumpItem)
3138
+ if (source == attachBumpItem)
26403139 {
26413140 String texture = GetFile("Attach bump");
26423141 Object3D obj;
....@@ -2648,7 +3147,7 @@
26483147
26493148 refreshContents();
26503149 } else
2651
- if (event.getSource() == detachBumpItem)
3150
+ if (source == detachBumpItem)
26523151 {
26533152 Object3D obj;
26543153 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2659,7 +3158,7 @@
26593158
26603159 refreshContents();
26613160 } else
2662
- if (event.getSource() == pigmentBumpItem)
3161
+ if (source == pigmentBumpItem)
26633162 {
26643163 Object3D obj;
26653164 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2670,158 +3169,237 @@
26703169
26713170 refreshContents();
26723171 } else
2673
- if (event.getSource() == flashSelectionButton)
3172
+ if (source == flashSelectionButton)
26743173 {
26753174 CameraPane.flash = true;
26763175 refreshContents();
26773176 } else
2678
- if (event.getSource() == oneButton)
3177
+ if (source == oneButton)
26793178 {
26803179 } else
2681
- if (event.getSource() == twoButton)
3180
+ if (source == twoButton)
26823181 {
26833182 radio.layout = twoButton;
3183
+
3184
+ if (CameraPane.FULLSCREEN)
3185
+ fullscreenLayout = radio.layout;
3186
+
26843187 // bug
26853188 //gridPanel.setDividerLocation(1.0);
26863189 //bigPanel.setDividerLocation(0.0);
2687
- bigThree.remove(scenePanel);
2688
- bigThree.remove(centralPanel);
2689
- bigThree.remove(XYZPanel);
2690
- aWindowConstraints.gridx = 0;
2691
- aWindowConstraints.gridy = 0;
2692
- aWindowConstraints.gridwidth = 1;
2693
- // aConstraints.gridheight = 3;
2694
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2695
- aWindowConstraints.weightx = 0;
2696
- aWindowConstraints.weighty = 1;
2697
- //bigThree.add(jtp, aWindowConstraints);
2698
- aWindowConstraints.weightx = 1;
2699
- aWindowConstraints.gridwidth = 3;
2700
- // aConstraints.gridheight = 3;
2701
- aWindowConstraints.gridx = 1;
2702
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2703
- bigThree.add(centralPanel, aWindowConstraints);
2704
- aWindowConstraints.weightx = 0;
2705
- aWindowConstraints.gridx = 4;
2706
- aWindowConstraints.gridwidth = 1;
2707
- // aConstraints.gridheight = 3;
2708
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2709
- //bigThree.add(XYZPanel, aWindowConstraints);
2710
- bigThree.revalidate();
3190
+// bigThree.remove(scenePanel);
3191
+// bigThree.remove(centralPanel);
3192
+// bigThree.remove(XYZPanel);
3193
+// aWindowConstraints.gridx = 0;
3194
+// aWindowConstraints.gridy = 0;
3195
+// aWindowConstraints.gridwidth = 1;
3196
+// // aConstraints.gridheight = 3;
3197
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3198
+// aWindowConstraints.weightx = 0;
3199
+// aWindowConstraints.weighty = 1;
3200
+// //bigThree.add(jtp, aWindowConstraints);
3201
+// aWindowConstraints.weightx = 1;
3202
+// aWindowConstraints.gridwidth = 3;
3203
+// // aConstraints.gridheight = 3;
3204
+// aWindowConstraints.gridx = 1;
3205
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3206
+// bigThree.add(centralPanel, aWindowConstraints);
3207
+// aWindowConstraints.weightx = 0;
3208
+// aWindowConstraints.gridx = 4;
3209
+// aWindowConstraints.gridwidth = 1;
3210
+// // aConstraints.gridheight = 3;
3211
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3212
+// //bigThree.add(XYZPanel, aWindowConstraints);
3213
+// scenePanel.setVisible(false);
3214
+// centralPanel.setVisible(true);
3215
+// XYZPanel.setVisible(false);
3216
+ bigThree.ClearUI();
3217
+ bigThree.add(centralPanel);
3218
+ bigThree.FlushUI();
3219
+
3220
+ cameraView.requestFocusInWindow();
3221
+
3222
+// refreshContents(true);
3223
+//
3224
+// try
3225
+// {
3226
+// java.awt.Robot bot = new java.awt.Robot();
3227
+// int mask = InputEvent.BUTTON1_MASK;
3228
+// bot.mouseMove(100, 100);
3229
+// bot.mousePress(mask);
3230
+// bot.mouseRelease(mask);
3231
+// }
3232
+// catch (Exception e)
3233
+// {
3234
+//
3235
+// }
3236
+
27113237 } else
2712
- if (event.getSource() == threeButton)
3238
+ if (source == threeButton)
27133239 {
27143240 radio.layout = threeButton;
2715
- bigThree.remove(scenePanel);
2716
- bigThree.remove(centralPanel);
2717
- bigThree.remove(XYZPanel);
2718
- aWindowConstraints.gridx = 0;
2719
- aWindowConstraints.gridy = 0;
2720
- aWindowConstraints.gridwidth = 1;
2721
- // aConstraints.gridheight = 3;
2722
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2723
- aWindowConstraints.weightx = 0;
2724
- aWindowConstraints.weighty = 1;
2725
- //bigThree.add(jtp, aWindowConstraints);
2726
- aWindowConstraints.weightx = 1;
2727
- aWindowConstraints.gridwidth = 3;
2728
- // aConstraints.gridheight = 3;
2729
- aWindowConstraints.gridx = 1;
2730
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2731
- bigThree.add(centralPanel, aWindowConstraints);
2732
- aWindowConstraints.weightx = 0;
2733
- aWindowConstraints.gridx = 4;
2734
- aWindowConstraints.gridwidth = 1;
2735
- // aConstraints.gridheight = 3;
2736
- aConstraints.fill = GridBagConstraints.VERTICAL;
2737
- bigThree.add(XYZPanel, aWindowConstraints);
2738
- bigThree.revalidate();
3241
+
3242
+ if (CameraPane.FULLSCREEN)
3243
+ fullscreenLayout = radio.layout;
3244
+
3245
+// bigThree.remove(scenePanel);
3246
+// bigThree.remove(centralPanel);
3247
+// bigThree.remove(XYZPanel);
3248
+// aWindowConstraints.gridx = 0;
3249
+// aWindowConstraints.gridy = 0;
3250
+// aWindowConstraints.gridwidth = 1;
3251
+// // aConstraints.gridheight = 3;
3252
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3253
+// aWindowConstraints.weightx = 0;
3254
+// aWindowConstraints.weighty = 1;
3255
+// //bigThree.add(jtp, aWindowConstraints);
3256
+// aWindowConstraints.weightx = 1;
3257
+// aWindowConstraints.gridwidth = 3;
3258
+// // aConstraints.gridheight = 3;
3259
+// aWindowConstraints.gridx = 1;
3260
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3261
+// bigThree.add(centralPanel, aWindowConstraints);
3262
+// aWindowConstraints.weightx = 0;
3263
+// aWindowConstraints.gridx = 4;
3264
+// aWindowConstraints.gridwidth = 1;
3265
+// // aConstraints.gridheight = 3;
3266
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3267
+// bigThree.add(XYZPanel, aWindowConstraints);
3268
+// bigThree.validate();
3269
+// scenePanel.setVisible(false);
3270
+// centralPanel.setVisible(true);
3271
+// XYZPanel.setVisible(true);
3272
+ bigThree.ClearUI();
3273
+ bigThree.add(centralPanel);
3274
+ bigThree.add(XYZPanel);
3275
+ bigThree.FlushUI();
3276
+
3277
+ cameraView.requestFocusInWindow();
27393278 } else
2740
- if (event.getSource() == fourButton)
3279
+ if (source == fourButton)
27413280 {
27423281 radio.layout = fourButton;
2743
- bigThree.remove(scenePanel);
2744
- bigThree.remove(centralPanel);
2745
- bigThree.remove(XYZPanel);
2746
- aWindowConstraints.gridx = 0;
2747
- aWindowConstraints.gridy = 0;
2748
- aWindowConstraints.gridwidth = 1;
2749
- // aWindowConstraints.gridheight = 3;
2750
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2751
- aWindowConstraints.weightx = 1;
2752
- aWindowConstraints.weighty = 1;
2753
- bigThree.add(scenePanel, aWindowConstraints);
2754
- aWindowConstraints.weightx = 1;
2755
- aWindowConstraints.gridwidth = 3;
2756
- // aConstraints.gridheight = 3;
2757
- aWindowConstraints.gridx = 1;
2758
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2759
- //bigThree.add(cameraPanel, aWindowConstraints);
2760
- aWindowConstraints.weightx = 0;
2761
- aWindowConstraints.gridx = 4;
2762
- aWindowConstraints.gridwidth = 1;
2763
- // aWindowConstraints.gridheight = 3;
2764
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2765
- //bigThree.add(XYZPanel, aWindowConstraints);
2766
- bigThree.revalidate();
3282
+
3283
+ if (CameraPane.FULLSCREEN)
3284
+ fullscreenLayout = radio.layout;
3285
+
3286
+// bigThree.remove(scenePanel);
3287
+// bigThree.remove(centralPanel);
3288
+// bigThree.remove(XYZPanel);
3289
+// aWindowConstraints.gridx = 0;
3290
+// aWindowConstraints.gridy = 0;
3291
+// aWindowConstraints.gridwidth = 1;
3292
+// // aWindowConstraints.gridheight = 3;
3293
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3294
+// aWindowConstraints.weightx = 1;
3295
+// aWindowConstraints.weighty = 1;
3296
+// bigThree.add(scenePanel, aWindowConstraints);
3297
+// aWindowConstraints.weightx = 1;
3298
+// aWindowConstraints.gridwidth = 3;
3299
+// // aConstraints.gridheight = 3;
3300
+// aWindowConstraints.gridx = 1;
3301
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3302
+// //bigThree.add(cameraPanel, aWindowConstraints);
3303
+// aWindowConstraints.weightx = 0;
3304
+// aWindowConstraints.gridx = 4;
3305
+// aWindowConstraints.gridwidth = 1;
3306
+// // aWindowConstraints.gridheight = 3;
3307
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3308
+// //bigThree.add(XYZPanel, aWindowConstraints);
3309
+// bigThree.validate();
3310
+// scenePanel.setVisible(true);
3311
+// centralPanel.setVisible(false);
3312
+// XYZPanel.setVisible(false);
3313
+ bigThree.ClearUI();
3314
+ bigThree.add(scenePanel);
3315
+ bigThree.FlushUI();
3316
+
3317
+ cameraView.requestFocusInWindow();
27673318 } else
2768
- if (event.getSource() == sixButton)
3319
+ if (source == sixButton)
27693320 {
27703321 radio.layout = sixButton;
2771
- bigThree.remove(scenePanel);
2772
- bigThree.remove(centralPanel);
2773
- bigThree.remove(XYZPanel);
2774
- aWindowConstraints.gridx = 0;
2775
- aWindowConstraints.gridy = 0;
2776
- aWindowConstraints.gridwidth = 1;
2777
- // aConstraints.gridheight = 3;
2778
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2779
- aWindowConstraints.weightx = 0;
2780
- aWindowConstraints.weighty = 1;
2781
- bigThree.add(scenePanel, aWindowConstraints);
2782
- aWindowConstraints.weightx = 1;
2783
- aWindowConstraints.gridwidth = 3;
2784
- // aWindowConstraints.gridheight = 3;
2785
- aWindowConstraints.gridx = 1;
2786
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2787
- bigThree.add(centralPanel, aWindowConstraints);
2788
- aWindowConstraints.weightx = 0;
2789
- aWindowConstraints.gridx = 4;
2790
- aWindowConstraints.gridwidth = 1;
2791
- // aWindowConstraints.gridheight = 3;
2792
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2793
- //bigThree.add(XYZPanel, aConstraints);
2794
- bigThree.revalidate();
3322
+
3323
+ if (CameraPane.FULLSCREEN)
3324
+ fullscreenLayout = radio.layout;
3325
+
3326
+// bigThree.remove(scenePanel);
3327
+// bigThree.remove(centralPanel);
3328
+// bigThree.remove(XYZPanel);
3329
+// aWindowConstraints.gridx = 0;
3330
+// aWindowConstraints.gridy = 0;
3331
+// aWindowConstraints.gridwidth = 1;
3332
+// // aConstraints.gridheight = 3;
3333
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3334
+// aWindowConstraints.weightx = 0;
3335
+// aWindowConstraints.weighty = 1;
3336
+// bigThree.add(scenePanel, aWindowConstraints);
3337
+// aWindowConstraints.weightx = 1;
3338
+// aWindowConstraints.gridwidth = 3;
3339
+// // aWindowConstraints.gridheight = 3;
3340
+// aWindowConstraints.gridx = 1;
3341
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3342
+// bigThree.add(centralPanel, aWindowConstraints);
3343
+// aWindowConstraints.weightx = 0;
3344
+// aWindowConstraints.gridx = 4;
3345
+// aWindowConstraints.gridwidth = 1;
3346
+// // aWindowConstraints.gridheight = 3;
3347
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3348
+// //bigThree.add(XYZPanel, aConstraints);
3349
+// bigThree.validate();
3350
+// scenePanel.setVisible(true);
3351
+// centralPanel.setVisible(true);
3352
+// XYZPanel.setVisible(false);
3353
+ bigThree.ClearUI();
3354
+ bigThree.add(scenePanel);
3355
+ bigThree.add(centralPanel);
3356
+ bigThree.FlushUI();
3357
+
3358
+ cameraView.requestFocusInWindow();
27953359 } else
2796
- if (event.getSource() == sevenButton)
3360
+ if (source == sevenButton)
27973361 {
27983362 radio.layout = sevenButton;
2799
- bigThree.remove(scenePanel);
2800
- bigThree.remove(centralPanel);
2801
- bigThree.remove(XYZPanel);
2802
- aWindowConstraints.gridx = 0;
2803
- aWindowConstraints.gridy = 0;
2804
- aWindowConstraints.gridwidth = 1;
2805
- // aWindowConstraints.gridheight = 3;
2806
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2807
- aWindowConstraints.weightx = 0;
2808
- aWindowConstraints.weighty = 1;
2809
- bigThree.add(scenePanel, aWindowConstraints);
2810
- aWindowConstraints.weightx = 1;
2811
- aWindowConstraints.gridwidth = 3;
2812
- // aWindowConstraints.gridheight = 3;
2813
- aWindowConstraints.gridx = 1;
2814
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2815
- bigThree.add(centralPanel, aWindowConstraints);
2816
- aWindowConstraints.weightx = 0;
2817
- aWindowConstraints.gridx = 4;
2818
- aWindowConstraints.gridwidth = 1;
2819
- // aConstraints.gridheight = 3;
2820
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2821
- bigThree.add(XYZPanel, aWindowConstraints);
2822
- bigThree.revalidate();
3363
+
3364
+ if (CameraPane.FULLSCREEN)
3365
+ fullscreenLayout = radio.layout;
3366
+
3367
+// bigThree.remove(scenePanel);
3368
+// bigThree.remove(centralPanel);
3369
+// bigThree.remove(XYZPanel);
3370
+// aWindowConstraints.gridx = 0;
3371
+// aWindowConstraints.gridy = 0;
3372
+// aWindowConstraints.gridwidth = 1;
3373
+// // aWindowConstraints.gridheight = 3;
3374
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3375
+// aWindowConstraints.weightx = 0;
3376
+// aWindowConstraints.weighty = 1;
3377
+// bigThree.add(scenePanel, aWindowConstraints);
3378
+// aWindowConstraints.weightx = 1;
3379
+// aWindowConstraints.gridwidth = 3;
3380
+// // aWindowConstraints.gridheight = 3;
3381
+// aWindowConstraints.gridx = 1;
3382
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3383
+// bigThree.add(centralPanel, aWindowConstraints);
3384
+// aWindowConstraints.weightx = 0;
3385
+// aWindowConstraints.gridx = 4;
3386
+// aWindowConstraints.gridwidth = 1;
3387
+// // aConstraints.gridheight = 3;
3388
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3389
+// bigThree.add(XYZPanel, aWindowConstraints);
3390
+// bigThree.validate();
3391
+// scenePanel.setVisible(true);
3392
+// centralPanel.setVisible(true);
3393
+// XYZPanel.setVisible(true);
3394
+ bigThree.ClearUI();
3395
+ bigThree.add(scenePanel);
3396
+ bigThree.add(centralPanel);
3397
+ bigThree.add(XYZPanel);
3398
+ bigThree.FlushUI();
3399
+
3400
+ cameraView.requestFocusInWindow();
28233401 } else
2824
- if (event.getSource() == rootButton)
3402
+ if (source == rootButton)
28253403 {
28263404 Object3D obj;
28273405 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2831,66 +3409,84 @@
28313409 EditObject(obj);
28323410 }
28333411
3412
+ cameraView.requestFocusInWindow();
28343413 refreshContents(true);
28353414 } else
2836
- if (event.getSource() == closeButton)
3415
+ if (source == closeButton)
28373416 {
28383417 //System.out.println("CLOSE: " + buttonGroup.getSelection());
28393418 cRadio ab;
28403419 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28413420 {
28423421 ab = (cRadio)e.nextElement();
2843
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3422
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28443423 {
3424
+ // Patch to avoid bug with transparency.
3425
+ if (!ab.hadMaterial)
3426
+ {
3427
+ ab.object.material = null;
3428
+ }
3429
+
28453430 buttonGroup.remove(ab);
28463431 radioPanel.remove(ab);
28473432
2848
- ab.GetObject().editWindow = null;
3433
+ //ab.GetObject().editWindow = null;
3434
+ ab.GetObject().manipWindow = null;
28493435 // ab.GetObject().objectUI = null; // ?????????
28503436
28513437 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28523438 break;
28533439 }
28543440 }
3441
+
3442
+ cameraView.requestFocusInWindow();
28553443 refreshContents(true);
28563444 } else
2857
- if (event.getSource() == editItem || event.getSource() == editButton)
3445
+ if (source == editItem || source == editButton)
28583446 {
3447
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3448
+ {
3449
+ Object3D child = (Object3D)e.nextElement();
3450
+ child.pinned = true;
3451
+ }
3452
+
28593453 EditSelection(false);
28603454 } else
2861
- if (event.getSource() == uneditButton)
3455
+ if (source == uneditButton)
28623456 {
28633457 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28643458 {
28653459 Object3D child = (Object3D)e.nextElement();
28663460 if(child.editWindow != null)
28673461 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3462
+ child.pinned = false;
28683463 child.CloseUI();
28693464 listUI.remove(child);
28703465
2871
- child.editWindow = null; // ???????????
3466
+ //child.editWindow = null; // ???????????
28723467 }
2873
- objEditor.ctrlPanel.revalidate();
3468
+ objEditor.ctrlPanel.FlushUI();
28743469 //objEditor.jTree.clearSelection();
28753470 //objEditor.ResetSliders();
28763471 refreshContents(true);
28773472 } else
2878
- if (event.getSource() == clearPanelButton)
3473
+ if (source == clearPanelButton)
28793474 {
28803475 assert(copy == group);
28813476 //copy.ClearUI();
28823477 for (Object3D obj : listUI)
28833478 {
3479
+ obj.pinned = false;
28843480 obj.CloseUI();
28853481 }
28863482 listUI.clear();
28873483 refreshContents(true);
28883484 } else
2889
- if (event.getSource() == allParamsButton)
3485
+ if (source == allParamsButton)
28903486 {
28913487 assert(copy == group);
28923488
2893
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3489
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28943490
28953491 for (Object3D obj : listUI)
28963492 {
....@@ -2907,19 +3503,19 @@
29073503
29083504 refreshContents(true);
29093505 } else
2910
- if (event.getSource() == unselectButton)
3506
+ if (source == unselectButton)
29113507 {
29123508 objEditor.jTree.clearSelection();
29133509 // ?? oct 2012 GrafreeD.clipboard.clear();
29143510 objEditor.ResetSliders();
29153511 refreshContents(true);
29163512 } else
2917
- if(event.getSource() instanceof cRadio)
3513
+ if(source instanceof cRadio)
29183514 {
29193515 group.parent = keepparent;
29203516 group.attributes = 0;
29213517 //group.editWindow = null;
2922
- /*cRadio*/ radio = (cRadio)event.getSource();
3518
+ /*cRadio*/ radio = (cRadio)source;
29233519 Object3D obj = radio.GetObject();
29243520 System.out.println("Edit " + obj);
29253521 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2939,6 +3535,9 @@
29393535 }
29403536
29413537 copy = group;
3538
+
3539
+ SetUndoStates();
3540
+
29423541 //Globals.theRenderer.object = group;
29433542 if(!useclient)
29443543 {
....@@ -2954,20 +3553,46 @@
29543553 frontView.object = group;
29553554 sideView.object = group;
29563555 }
2957
- group.editWindow = this;
3556
+
3557
+// fix "+" issue
3558
+ //group.editWindow = this;
3559
+ group.manipWindow = this;
3560
+
29583561 /*
29593562 currentLayout = radio.layout;
29603563 if (currentLayout == null)
29613564 currentLayout = sevenButton;
29623565 */
29633566 radio.layout.doClick();
3567
+
3568
+ ClearUnpinned();
3569
+ //Grafreed.Assert(group != null);
3570
+ //Grafreed.Assert(group.selection != null);
3571
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3572
+ if (group.selection == null || group.selection.size() == 1)
3573
+ EditSelection(false);
29643574 keepparent = group.parent;
29653575 // PARENT = NULL or not???
29663576 //group.parent = null; // ROOT
29673577 //group.attributes = -1;
29683578 ResetModel();
3579
+
3580
+ cameraView.requestFocusInWindow();
29693581 refreshContents(true);
2970
- }
3582
+ } else if (event.getSource() == editCameraItem)
3583
+ {
3584
+ cameraView.ProtectCamera();
3585
+ cameraView.repaint();
3586
+ return;
3587
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3588
+ {
3589
+ cameraView.RevertCamera();
3590
+ cameraView.repaint();
3591
+ return;
3592
+ // } else if (event.getSource() == textureButton)
3593
+ // {
3594
+ // return; // true;
3595
+ }
29713596 else
29723597 {
29733598 //return super.action(event, arg);
....@@ -2976,7 +3601,6 @@
29763601 }
29773602
29783603 boolean useclient = false;
2979
- cRadio radio;
29803604
29813605 void ToggleRoot()
29823606 {
....@@ -3028,6 +3652,28 @@
30283652 refreshContents();
30293653 }
30303654
3655
+ void TransformChildren()
3656
+ {
3657
+ Object3D obj;
3658
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3659
+ {
3660
+ obj = (Object3D)e.nextElement();
3661
+ obj.KeepTextureMatrices();
3662
+ obj.TransformChildren();
3663
+ obj.RestoreTextureMatrices();
3664
+
3665
+// if (obj.parent == null)
3666
+// {
3667
+// System.out.println("NULL PARENT!");
3668
+// new Exception().printStackTrace();
3669
+// }
3670
+// else
3671
+// TouchTransform(obj);
3672
+// //obj.parent.Touch();
3673
+ }
3674
+
3675
+ refreshContents();
3676
+ }
30313677
30323678 void ResetTransform()
30333679 {
....@@ -3140,7 +3786,7 @@
31403786 refreshContents();
31413787 }
31423788
3143
- void ResetCentroid()
3789
+ void ResetCentroid(boolean full)
31443790 {
31453791 Object3D obj;
31463792 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3155,12 +3801,16 @@
31553801 LA.matIdentity(Object3D.mat);
31563802 obj.getBounds(minima, maxima, false);
31573803 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3158
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3804
+ if (full)
3805
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31593806 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31603807 obj.TransformMesh(Object3D.mat);
3808
+
31613809 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3162
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3810
+ if (full)
3811
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31633812 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3813
+
31643814 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31653815 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31663816 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3189,7 +3839,8 @@
31893839
31903840 int size = obj.MemorySize();
31913841
3192
- System.err.println((size/1024) + " KB is the size of " + obj);
3842
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3843
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
31933844 }
31943845 }
31953846 catch (Exception e)
....@@ -3226,9 +3877,9 @@
32263877 obj = (Object3D)e.nextElement();
32273878
32283879 System.out.println("Object is: " + obj);
3229
- GrafreeD.AnalyzeObject(obj);
3880
+ Grafreed.AnalyzeObject(obj);
32303881 System.out.println("Boundary rep: " + obj.bRep);
3231
- GrafreeD.AnalyzeObject(obj.bRep);
3882
+ Grafreed.AnalyzeObject(obj.bRep);
32323883
32333884 // System.err.println((size/1024) + " KB is the size of " + obj);
32343885 }
....@@ -3270,6 +3921,13 @@
32703921 void GenNormals(boolean crease)
32713922 {
32723923 group.GenNormalsS(crease);
3924
+
3925
+ refreshContents();
3926
+ }
3927
+
3928
+ void GenNormalsMESH()
3929
+ {
3930
+ group.GenNormalsMeshS();
32733931
32743932 refreshContents();
32753933 }
....@@ -3442,8 +4100,8 @@
34424100
34434101 void ParseVertices()
34444102 {
3445
- boolean epsequal = GrafreeD.epsequal;
3446
- GrafreeD.epsequal = true;
4103
+ boolean epsequal = Grafreed.epsequal;
4104
+ Grafreed.epsequal = true;
34474105
34484106 for (int i=0; i<group.selection.size(); i++)
34494107 {
....@@ -3468,7 +4126,7 @@
34684126 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34694127 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34704128
3471
- g.add(GrafreeD.clipboard);
4129
+ g.add(Grafreed.clipboard);
34724130
34734131 buffer.add(g);
34744132 }
....@@ -3483,7 +4141,7 @@
34834141 makeSomething(buffer, i==group.selection.size()-1);
34844142 }
34854143
3486
- GrafreeD.epsequal = epsequal;
4144
+ Grafreed.epsequal = epsequal;
34874145
34884146 refreshContents();
34894147 }
....@@ -3501,7 +4159,16 @@
35014159 String pigment = Object3D.GetPigment(tex);
35024160 //String bump = Object3D.GetBump(tex);
35034161
3504
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4162
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4163
+
4164
+ try
4165
+ {
4166
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4167
+ }
4168
+ catch (Exception e)
4169
+ {
4170
+ System.err.println("FAIL: " + node);
4171
+ }
35054172
35064173 double s = v.s;
35074174
....@@ -3589,11 +4256,11 @@
35894256
35904257 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35914258
3592
- boolean random = CameraPane.RANDOM;
3593
- CameraPane.RANDOM = false; // parse all random nodes
4259
+ boolean random = CameraPane.SWITCH;
4260
+ CameraPane.SWITCH = false; // parse all random nodes
35944261 lowres.linkVerticesThis(null);
35954262 lowres.linkVerticesThis(sn);
3596
- CameraPane.RANDOM = random;
4263
+ CameraPane.SWITCH = random;
35974264
35984265 System.err.flush();
35994266
....@@ -3633,7 +4300,7 @@
36334300 return;
36344301
36354302 Object3D poses = group.selection.get(0);
3636
- Object3D ref = GrafreeD.clipboard.get(0);
4303
+ Object3D ref = Grafreed.clipboard.get(0);
36374304
36384305 Object3D newgroup = new Object3D("Po:" + poses.name);
36394306
....@@ -3827,9 +4494,9 @@
38274494
38284495 void ClipMesh()
38294496 {
3830
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4497
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38314498 {
3832
- Object3D content = GrafreeD.clipboard.get(0);
4499
+ Object3D content = Grafreed.clipboard.get(0);
38334500
38344501 if (content instanceof cGroup && ((cGroup)content).transientlink )
38354502 content = ((cGroup)content).get(0);
....@@ -3838,7 +4505,7 @@
38384505 // {
38394506 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38404507 // }
3841
- group.selection.ClipMesh(GrafreeD.clipboard);
4508
+ group.selection.ClipMesh(Grafreed.clipboard);
38424509 }
38434510 // group.selection.ClipMesh(GrafreeD.clipboard);
38444511 System.out.println("DONE.");
....@@ -3885,6 +4552,18 @@
38854552 void MarkLeaves(boolean hide)
38864553 {
38874554 group.selection.MarkLeaves(hide);
4555
+ refreshContents();
4556
+ }
4557
+
4558
+ void RewindLeaves(boolean hide)
4559
+ {
4560
+ group.selection.RewindLeaves(hide);
4561
+ refreshContents();
4562
+ }
4563
+
4564
+ void RandomLeaves(boolean hide)
4565
+ {
4566
+ group.selection.RandomLeaves(hide);
38884567 refreshContents();
38894568 }
38904569
....@@ -3959,28 +4638,25 @@
39594638 // }
39604639 // }
39614640
3962
- static boolean allparams = true;
3963
-
3964
- static Vector<Object3D> listUI = new Vector<Object3D>();
3965
-
39664641 void EditSelection(boolean newWindow)
39674642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
39684649 // aConstraints.gridy = 0;
39694650 for (int i=0; i<group.selection.size(); i++)
39704651 {
39714652 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39724653 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3973
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4654
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39744655
39754656 Object3D elem = (Object3D)group.selection.elementAt(i);
3976
- if(elem != group)
4657
+ if(elem != group || !newWindow)
39774658 {
3978
- // if (!(elem instanceof Composite))
3979
- // newWindow = false;
3980
- listUI.add(elem);
3981
- elem.openEditWindow(this, newWindow); //, false);
3982
- System.out.println("edit : " + elem);
3983
- elem.editWindow.refreshContents(true); // ? new
4659
+ EditElement(elem, newWindow); // ? new
39844660 }
39854661 }
39864662 }
....@@ -4055,7 +4731,8 @@
40554731 //new Exception().printStackTrace();
40564732
40574733 freezemodel = true;
4058
-
4734
+ ClearUnpinned();
4735
+
40594736 /**/
40604737 //switch (event.id)
40614738 {
....@@ -4063,7 +4740,6 @@
40634740 //case 702: // Event.LIST_DESELECT
40644741 group.deselectAll();
40654742 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4066
- objEditor.ClearInfo(); // .GetMaterial());
40674743 if (tps != null)
40684744 {
40694745 for (int i=0; i < tps.length; i++)
....@@ -4072,33 +4748,39 @@
40724748
40734749 //if (child.parent != null)
40744750 //child.parent.addSelectee(child);
4751
+ objEditor.SetMaterial(child);
40754752 group.addSelectee(child);
4076
- objEditor.SetMaterial(child); // .GetMaterial());
4077
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4078
- System.err.println("info : " + child.GetPath());
40794753 }
40804754 }
4081
- else
4082
- {
4083
- objEditor.SetMaterial(group); // .GetMaterial());
4084
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4085
- System.err.println("info : " + group.GetPath());
4086
- }
4755
+// else
4756
+// {
4757
+// objEditor.SetMaterial(group); // .GetMaterial());
4758
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4759
+// System.err.println("info : " + group.GetPath());
4760
+// }
40874761
4088
- objEditor.SetText(); // jan 2014
4089
-
4090
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4762
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
40914763 CameraPane.flash = true;
40924764
4093
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4765
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40944766 // a camera
40954767 {
4096
- CameraPane.camerachangeframe = 0; // don't refuse it
4097
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4768
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4769
+ {
4770
+ CameraPane.camerachangeframe = 0; // don't refuse it
4771
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4772
+ }
40984773 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
40994774 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41004775 }
41014776
4777
+ if (tps != null && tps.length == 1)
4778
+ {
4779
+ EditSelection(false);
4780
+ }
4781
+
4782
+ SetPinStates(tps != null && tps.length > 0);
4783
+
41024784 refreshContents();
41034785 //return true;
41044786 }
....@@ -4107,6 +4789,35 @@
41074789
41084790 freezemodel = false;
41094791 }
4792
+
4793
+ void SetPinStates(boolean enabled)
4794
+ {
4795
+ editButton.setEnabled(enabled);
4796
+ uneditButton.setEnabled(enabled);
4797
+ unselectButton.setEnabled(enabled);
4798
+ flashSelectionButton.setEnabled(enabled);
4799
+ }
4800
+
4801
+ void refreshContents(boolean cp)
4802
+ {
4803
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4804
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4805
+ {
4806
+ objEditor.ClearInfo(); // .GetMaterial());
4807
+
4808
+ for (int i=0; i < group.selection.Size(); i++)
4809
+ {
4810
+ Object3D child = (Object3D) group.selection.get(i);
4811
+
4812
+ objEditor.AddInfo(child, this, true);
4813
+ System.err.println("info : " + child.GetPath());
4814
+ }
4815
+
4816
+ objEditor.SetText(); // jan 2014
4817
+ }
4818
+
4819
+ super.refreshContents(cp);
4820
+ }
41104821
41114822 void linkSomething(Object3D thing)
41124823 {
....@@ -4178,16 +4889,19 @@
41784889 {
41794890 if (group.selection.isEmpty())
41804891 return;
4181
- GrafreeD.clipboardIsTempGroup = false;
4892
+
4893
+ Grafreed.clipboardIsTempGroup = false;
41824894 Composite tGroup = null;
41834895 if (group.selection.size() > 0) // 1)
41844896 {
41854897 tGroup = new cGroup();
4186
- GrafreeD.clipboardIsTempGroup = true;
4898
+ Grafreed.clipboardIsTempGroup = true;
41874899 }
41884900
41894901 if (cut)
41904902 {
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
41914905 //int indices[] = jList.getSelectedIndices();
41924906 //for (int i = indices.length - 1; i >= 0; i--)
41934907 //jList.remove(indices[i]);
....@@ -4223,16 +4937,16 @@
42234937 //System.out.println("cut " + child);
42244938 //System.out.println("parent = " + child.parent);
42254939 // tmp.addChild(child);
4226
- if (GrafreeD.clipboardIsTempGroup)
4940
+ if (Grafreed.clipboardIsTempGroup)
42274941 tGroup.add/*Child*/(tmp);
42284942 else
4229
- GrafreeD.clipboard = tmp;
4943
+ Grafreed.clipboard = tmp;
42304944 }
42314945 else
4232
- if (GrafreeD.clipboardIsTempGroup)
4946
+ if (Grafreed.clipboardIsTempGroup)
42334947 tGroup.add/*Child*/(child);
42344948 else
4235
- GrafreeD.clipboard = child;
4949
+ Grafreed.clipboard = child;
42364950 }
42374951
42384952 //ResetModel();
....@@ -4264,21 +4978,23 @@
42644978 //System.out.println("cut " + elem);
42654979 //System.out.println("parent = " + elem.parent);
42664980 // tmp.addChild(elem);
4267
- if (GrafreeD.clipboardIsTempGroup)
4981
+ if (Grafreed.clipboardIsTempGroup)
42684982 tGroup.add/*Child*/(tmp);
42694983 else
4270
- GrafreeD.clipboard = tmp;
4984
+ Grafreed.clipboard = tmp;
42714985 }
42724986 else
4273
- if (GrafreeD.clipboardIsTempGroup)
4987
+ if (Grafreed.clipboardIsTempGroup)
42744988 tGroup.add/*Child*/(child);
42754989 else
4276
- GrafreeD.clipboard = child;
4990
+ Grafreed.clipboard = child;
42774991 }
42784992
42794993 }
4280
- if (GrafreeD.clipboardIsTempGroup)
4281
- GrafreeD.clipboard = tGroup;
4994
+
4995
+ if (Grafreed.clipboardIsTempGroup)
4996
+ Grafreed.clipboard = tGroup;
4997
+
42824998 if (cut)
42834999 {
42845000 ResetModel();
....@@ -4288,11 +5004,15 @@
42885004
42895005 void paste(boolean expand)
42905006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
42915011 // if (GrafreeD.clipboard == null)
42925012 // return;
42935013 boolean first = true;
42945014
4295
- if (GrafreeD.clipboardIsTempGroup)
5015
+ if (Grafreed.clipboardIsTempGroup)
42965016 {
42975017 Composite temp;
42985018
....@@ -4303,7 +5023,7 @@
43035023 temp = (Composite)Applet3D.clipboard.deepCopy();
43045024 */
43055025 Object3D elem;
4306
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5026
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43075027 {
43085028 Object3D child = (Object3D)e.nextElement();
43095029
....@@ -4337,21 +5057,22 @@
43375057 //Object3D cb = Applet3D.clipboard;
43385058 //temp.addChild(cb);
43395059 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4340
- assert(GrafreeD.clipboard.parent == null);
4341
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4342
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4343
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4344
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5060
+ assert(Grafreed.clipboard.parent == null);
5061
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5062
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5063
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5064
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43455065 else
4346
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4347
- GrafreeD.clipboard.get(0).parent = keepparent;
5066
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5067
+ Grafreed.clipboard.get(0).parent = keepparent;
43485068 }
43495069
5070
+ Globals.REPLACEONMAKE = keep;
43505071 ResetModel();
43515072 refreshContents();
43525073 }
43535074
4354
- void pasteInto(boolean copyit)
5075
+ void pasteInto(boolean copyit, boolean clone)
43555076 {
43565077 // if (GrafreeD.clipboard == null)
43575078 // return;
....@@ -4380,15 +5101,22 @@
43805101 if (copyit)
43815102 {
43825103 // paste(false);
4383
- CloneClipboard(false); // sept 2014
5104
+ if (clone)
5105
+ {
5106
+ CloneClipboard(false); // sept 2014
5107
+ }
5108
+ else
5109
+ {
5110
+ paste(false);
5111
+ }
43845112 }
43855113 else
43865114 {
43875115 boolean first = true;
43885116
4389
- if (GrafreeD.clipboardIsTempGroup)
5117
+ if (Grafreed.clipboardIsTempGroup)
43905118 {
4391
- Composite temp = (Composite)GrafreeD.clipboard;
5119
+ Composite temp = (Composite)Grafreed.clipboard;
43925120 Object3D copy;
43935121 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43945122 {
....@@ -4398,7 +5126,7 @@
43985126 }
43995127 } else
44005128 {
4401
- linkSomething(GrafreeD.clipboard); //.get(0));
5129
+ linkSomething(Grafreed.clipboard); //.get(0));
44025130 }
44035131 }
44045132 }
....@@ -4475,6 +5203,10 @@
44755203
44765204 void group(Object3D csg, boolean grab)
44775205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
44785210 if (//false) // why??
44795211 !group.selection.isEmpty())
44805212 {
....@@ -4588,10 +5320,15 @@
45885320 //node.add(csg);
45895321 //makeSomething(node);
45905322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
45915324 }
45925325
45935326 void Ungroup(Object3D g)
45945327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
45955332 if (g instanceof HiddenObject)
45965333 {
45975334 HiddenObject h = (HiddenObject) g;
....@@ -4608,6 +5345,7 @@
46085345 objEditor.makeSomething(g.get(i), false);
46095346 }
46105347 }
5348
+ Globals.REPLACEONMAKE = keep;
46115349 }
46125350
46135351 void ungroup()
....@@ -4803,21 +5541,6 @@
48035541 }
48045542 */
48055543
4806
- void ImportGFD()
4807
- {
4808
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4809
- browser.show();
4810
- String filename = browser.getFile();
4811
- if (filename != null && filename.length() > 0)
4812
- {
4813
- String fullname = browser.getDirectory() + filename;
4814
-
4815
- //Object3D readobj =
4816
- objEditor.ReadGFD(fullname, objEditor);
4817
- //makeSomething(readobj);
4818
- }
4819
- }
4820
-
48215544 /*
48225545 public void Callback(Object obj)
48235546 {
....@@ -4841,26 +5564,9 @@
48415564 }
48425565 */
48435566
4844
- void ImportVRMLX3D()
4845
- {
4846
- if (GrafreeD.standAlone)
4847
- {
4848
- /**/
4849
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4850
- browser.show();
4851
- String filename = browser.getFile();
4852
- if (filename != null && filename.length() > 0)
4853
- {
4854
- String fullname = browser.getDirectory() + filename;
4855
- LoadVRMLX3D(fullname);
4856
- }
4857
- /**/
4858
- }
4859
- }
4860
-
48615567 String GetFile(String dialogName)
48625568 {
4863
- if (GrafreeD.standAlone)
5569
+ if (Grafreed.standAlone)
48645570 {
48655571 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48665572 browser.show();
....@@ -4924,10 +5630,33 @@
49245630 cButton flashSelectionButton;
49255631 cButton editButton;
49265632 cButton uneditButton;
5633
+ JCheckBox allParamsButton;
49275634 cButton clearpanelButton;
4928
- cButton allParamsButton;
49295635 cButton unselectButton;
49305636
5637
+ cButton restoreCameraButton;
5638
+
5639
+ cButton saveButton;
5640
+ cButton oneStepButton;
5641
+
5642
+ cButton groupButton;
5643
+ cButton ungroupButton;
5644
+ cButton compositeButton;
5645
+ cButton switchButton;
5646
+ cButton loopButton;
5647
+ cButton textureButton;
5648
+
5649
+ cButton gridButton;
5650
+ cButton boxButton;
5651
+ cButton sphereButton;
5652
+ cButton coneButton;
5653
+ cButton torusButton;
5654
+ cButton superButton;
5655
+ cButton kleinButton;
5656
+ cButton particlesButton;
5657
+ cButton overlayButton;
5658
+ cButton lightButton;
5659
+
49315660 cButton screenfitButton;
49325661 cButton screenfitpointButton;
49335662 cButton snapobjectButton;
....@@ -4939,14 +5668,6 @@
49395668
49405669 cButton setsupportButton;
49415670
4942
- cButton twoButton;
4943
- cButton sixButton;
4944
- cButton threeButton;
4945
- cButton sevenButton;
4946
- cButton fourButton; // full panel
4947
- cButton oneButton; // full XYZ
4948
- //cButton currentLayout;
4949
-
49505671 //
49515672 //Composite
49525673 Object3D // to do !!
....@@ -4956,9 +5677,11 @@
49565677 //JTree jTree;
49575678 private MenuItem lookAtItem;
49585679 private MenuItem lookFromItem;
4959
- private MenuItem switchItem;
5680
+ private MenuItem switchViewItem;
49605681 private MenuItem cutItem;
4961
- private MenuItem duplicateItem;
5682
+ private MenuItem undoItem;
5683
+ private MenuItem redoItem;
5684
+ private JMenuItem duplicateItem;
49625685 private MenuItem cloneItem;
49635686 private MenuItem cloneSupportItem;
49645687 private MenuItem overwriteGeoItem;
....@@ -4971,7 +5694,7 @@
49715694 private MenuItem linkverticesItem;
49725695 private MenuItem relinkverticesItem;
49735696 private MenuItem setMasterItem;
4974
- private MenuItem resetMeshItem;
5697
+ private MenuItem resetAllItem;
49755698 private MenuItem stepAllItem;
49765699 private MenuItem revertMeshItem;
49775700 private MenuItem poseMeshItem;
....@@ -4982,10 +5705,11 @@
49825705 private MenuItem mergeGeometriesItem;
49835706 private MenuItem copyItem;
49845707 private MenuItem pasteItem;
5708
+ private MenuItem pasteIntoItem;
49855709 private MenuItem pasteLinkItem;
49865710 private MenuItem pasteCloneItem;
49875711 private MenuItem pasteExpandItem;
4988
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
49895713 private MenuItem clearAllItem;
49905714 private MenuItem genUVItem;
49915715 private MenuItem genNormalsMESHItem;
....@@ -5020,6 +5744,10 @@
50205744 private MenuItem showleavesItem;
50215745 private MenuItem markleavesItem;
50225746 private MenuItem unmarkleavesItem;
5747
+ private MenuItem rewindleavesItem;
5748
+ private MenuItem unrewindleavesItem;
5749
+ private MenuItem randomleavesItem;
5750
+ private MenuItem unrandomleavesItem;
50235751
50245752 private MenuItem flipVItem;
50255753 private MenuItem unflipVItem;
....@@ -5031,15 +5759,17 @@
50315759 private MenuItem panoTexturesItem;
50325760
50335761 private MenuItem resetCentroidItem;
5034
- private MenuItem transformgeometryItem;
5762
+ private MenuItem resetCentroidXZItem;
50355763 private MenuItem resetTransformItem;
5764
+ private MenuItem transformGeometryItem;
5765
+ private MenuItem transformChildrenItem;
50365766 private MenuItem hideItem;
50375767 private MenuItem grabItem;
50385768 private MenuItem backItem;
50395769 private MenuItem frontItem;
50405770 private MenuItem cameraItem;
50415771 private MenuItem compositeItem;
5042
- private MenuItem randomItem;
5772
+ private MenuItem switchItem;
50435773 private MenuItem physicsItem;
50445774 private MenuItem frameselectorItem;
50455775 private MenuItem scriptNodeItem;
....@@ -5079,7 +5809,7 @@
50795809 private MenuItem blobItem;
50805810 private MenuItem latheItem;
50815811 private MenuItem bezierItem;
5082
- private MenuItem checkerItem;
5812
+ private MenuItem overlayItem;
50835813 private MenuItem meshItem;
50845814 // private MenuItem meshGroupItem;
50855815 private MenuItem springItem;
....@@ -5101,11 +5831,6 @@
51015831 private MenuItem doubleItem;
51025832 private MenuItem tripleItem;
51035833
5104
- private MenuItem importGFDItem;
5105
- private MenuItem importVRMLX3DItem;
5106
- private MenuItem import3DSItem;
5107
- private MenuItem importOBJItem;
5108
-
51095834 private MenuItem computeAOItem;
51105835 private MenuItem recompileItem;
51115836 private MenuItem editScriptItem;
....@@ -5115,4 +5840,8 @@
51155840 private MenuItem analyzeItem;
51165841 private MenuItem dumpItem;
51175842 //boolean freezemodel = false;
5843
+
5844
+ Menu cameraMenu;
5845
+ MenuItem editCameraItem;
5846
+ MenuItem restoreCameraItem;
51185847 }