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,153 +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", CameraPane.isLIVE()), 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);
626
+ screenfitButton.setToolTipText("Screen fit");
627
+ screenfitButton.addActionListener(this);
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");
441662 liveCB.addItemListener(this);
442663
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
445
- supportCB.addItemListener(this);
446
-
447
- // oe.aConstraints.gridx += 1;
448
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
449
- // localCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
453
- crowdCB.addItemListener(this);
454
-
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
457
- smoothCB.addItemListener(this);
458
-
459
- oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
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");
461670 fastCB.addItemListener(this);
462
- oe.aConstraints.gridx += 1;
463
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
464
- slowCB.addItemListener(this);
465
- oe.aConstraints.gridx += 1;
466
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
467
- boxCB.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);
468677
469
-// oe.aConstraints.gridx += 1;
470
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
471
-// speakerMocapCB.addItemListener(this);
472
-
473
- if (false)
474
- {
475
- // handled in scripts
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
478
- speakerCameraCB.addItemListener(this);
479
-
480
- oe.aConstraints.gridx += 1;
481
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
482
- speakerFocusCB.addItemListener(this);
483
-
484
- oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
486
- smoothfocusCB.addItemListener(this);
487
- }
488
-
489
-//oe.aConstraints.gridx += 1;
490
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
491
-// debugCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
495
- oeilCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
499
- lookAtCB.addItemListener(this);
500
-
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
503
- trackCB.addItemListener(this);
504
-
505
- oe.aConstraints.gridx += 1;
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
507
- screenfitButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
509678 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
510679 // screenfitpointButton.addActionListener(this);
511
-// oe.aConstraints.gridx += 1;
512
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
513
- snapobjectButton.addActionListener(this);
514
- oe.aConstraints.gridx += 1;
515680
516
- //aConstraints.gridx = 0;
517
- //aConstraints.gridy += 1;
518
- oe.aConstraints.weighty = 0;
519
- oe.aConstraints.gridwidth = 1;
520
-
521
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
522
- 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));
523689
524
- oe.toolbarPanel.add(new cButton(" ", false));
525
-
526
- oe.aConstraints.gridx += 1;
527
- oe.aConstraints.weighty = 0;
528
- oe.aConstraints.gridwidth = 1;
529
-
530
- //
531
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
532
- twoButton.addActionListener(this);
533
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
534691 fourButton.addActionListener(this);
535
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
692
+ fourButton.setToolTipText("Show left panel only");
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");
536701 sixButton.addActionListener(this);
537
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
538
- threeButton.addActionListener(this);
539
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
540
- 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);
541708 //
542709
543
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
710
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ rootButton.setToolTipText("Open selection in new tab");
544712 rootButton.addActionListener(this);
545
- oe.aConstraints.gridx += 1;
546
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
713
+
714
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ closeButton.setToolTipText("Close tab");
547716 closeButton.addActionListener(this);
548717 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
549718 //clearButton.addActionListener(this);
550
- oe.aConstraints.gridx += 1;
551
-
552
- oe.aConstraints.gridx = 1; //
553
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
554
- editButton.addActionListener(this);
555
- oe.aConstraints.gridx += 1;
556
- oe.aConstraints.weighty = 0;
557
- oe.aConstraints.gridwidth = 1;
558719
559
- 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");
560805 uneditButton.addActionListener(this);
561806
562
- oe.aConstraints.gridx += 1;
563
- oe.aConstraints.weighty = 0;
564
- oe.aConstraints.gridwidth = 1;
565
-
566
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
567
- clearPanelButton.addActionListener(this);
568
-
569
- oe.aConstraints.gridx += 1;
570
- oe.aConstraints.weighty = 0;
571
- oe.aConstraints.gridwidth = 1;
572
-
573
- 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");
574809 allParamsButton.addActionListener(this);
575810
576
- oe.aConstraints.gridx += 1;
577
- oe.aConstraints.weighty = 0;
578
- oe.aConstraints.gridwidth = 1;
579
-
580
- 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");
581817 unselectButton.addActionListener(this);
582818
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
+
583829 // oe.aConstraints.gridx += 1;
584830 // oe.aConstraints.weighty = 0;
585831 // oe.aConstraints.gridwidth = 1;
....@@ -591,40 +837,25 @@
591837 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
592838 // gcButton.addActionListener(this);
593839
594
- oe.aConstraints.gridx = 0;
595
- oe.aConstraints.gridy += 1;
596
-
597
- //ctrlPanel.add(objList = new List(5, true));
598
- oe.aConstraints.gridwidth = 100;
599
- // oe.aConstraints.gridheight = 100;
600
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
601
- oe.aConstraints.gridheight = 1;
602
- oe.aConstraints.weighty = 0.5;
603
- oe.aConstraints.gridx = 0;
604
- JScrollPane jSP;
840
+ cGridBag jSPPanel = new cGridBag();
841
+
842
+ JScrollPane jSP;
605843 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
606
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
844
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
607845 ResetModel();
608
- oe.aConstraints.weighty = 0.5;
609
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
610
- oe.aConstraints.gridy += 1;
611
- oe.aConstraints.gridwidth = 1;
612
-
613
- oe.aConstraints.weighty = 0;
614
- oe.aConstraints.gridwidth = 2;
615
-
616
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
617
- colorCB.addItemListener(this);
618
- oe.aConstraints.gridx += 2;
619
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
620
- materialCB.addItemListener(this);
621
- oe.aConstraints.gridx += 2;
622
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
623
- textureCB.addItemListener(this);
624
-
625
- oe.aConstraints.gridx = 0;
626
- oe.aConstraints.gridy += 1;
627846
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
+
628859 //jList.addListSelectionListener(this);
629860 oe.jTree.addTreeSelectionListener(this);
630861 //jTree.setRootVisible(false);
....@@ -643,23 +874,160 @@
643874 dgr.addDragGestureListener(this);
644875 }catch(Exception e) {}
645876 */
646
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
647878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
648879 }
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
+ }
6491006
6501007 void EditObject(Object3D obj)
6511008 {
6521009 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
+
6531018 radioButton.SetObject(obj);
654
- radioButton.layout = sevenButton;
1019
+ radioButton.layout = sixButton; // sevenButton;
6551020 radioButton.SetCamera(cameraView.renderCamera, false);
6561021 radioButton.addActionListener(this);
6571022 radioPanel.add(radioButton);
6581023 buttonGroup.add(radioButton);
6591024 radioButton.doClick();
6601025 }
1026
+
6611027 void SetupViews(ObjEditor oe)
6621028 {
1029
+ theFrame = this;
1030
+
6631031 oe.SetupViews();
6641032
6651033 System.out.println("SetupViews");
....@@ -668,22 +1036,28 @@
6681036 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6691037 }
6701038
671
- JCheckBox liveCB;
672
- JCheckBox supportCB;
673
- JCheckBox localCB;
674
- JCheckBox crowdCB;
675
- JCheckBox smoothCB;
676
- JCheckBox fastCB;
677
- JCheckBox slowCB;
678
- JCheckBox boxCB;
679
- JCheckBox trackCB;
680
- 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;
6811052 // JCheckBox speakerMocapCB;
682
- JCheckBox speakerCameraCB;
683
- JCheckBox speakerFocusCB;
684
- JCheckBox debugCB;
685
- JCheckBox oeilCB;
686
- JCheckBox lookAtCB;
1053
+ cCheckBox speakerCameraCB;
1054
+ cCheckBox speakerFocusCB;
1055
+ cCheckBox debugCB;
1056
+
1057
+ cCheckBox oeilCB;
1058
+ cCheckBox shadowCB;
1059
+ cCheckBox autokeepCB;
1060
+ cCheckBox lookAtCB;
6871061
6881062 // static int COLOR = 1;
6891063 // static int MATERIAL = 2;
....@@ -691,9 +1065,9 @@
6911065
6921066 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6931067
694
- JCheckBox colorCB;
695
- JCheckBox materialCB;
696
- JCheckBox textureCB;
1068
+ cCheckBox colorCB;
1069
+ cCheckBox materialCB;
1070
+ cCheckBox textureCB;
6971071
6981072 public void itemStateChanged(ItemEvent e)
6991073 {
....@@ -721,6 +1095,7 @@
7211095 } else if(e.getSource() == liveCB)
7221096 {
7231097 cameraView.ToggleLive();
1098
+ refreshContents(false);
7241099 }
7251100 else if(e.getSource() == supportCB)
7261101 {
....@@ -756,6 +1131,10 @@
7561131 cameraView.repaint();
7571132 // refreshContents();
7581133 }
1134
+ else if(e.getSource() == zoomBoxCB)
1135
+ {
1136
+ cameraView.ToggleZoomBoxMode();
1137
+ }
7591138 else if(e.getSource() == smoothfocusCB)
7601139 {
7611140 cameraView.ToggleSmoothFocus();
....@@ -781,6 +1160,18 @@
7811160 {
7821161 cameraView.ToggleOeil();
7831162 }
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
+ }
7841175 else if(e.getSource() == lookAtCB)
7851176 {
7861177 cameraView.ToggleLookAt();
....@@ -797,7 +1188,8 @@
7971188
7981189 /**/
7991190 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
800
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1191
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1192
+ TreePath path = objEditor.jTree.getSelectionPath();
8011193 if ((path == null) || (path.getPathCount() <= 1)) {
8021194 // We can't move the root node or an empty selection
8031195 return;
....@@ -860,8 +1252,6 @@
8601252 }
8611253 }
8621254
863
- String string = (String) object;
864
-
8651255 System.out.println("Transfer = " + object + "; drop : " + target);
8661256 // if( object instanceof java.io.File[])
8671257 // {
....@@ -869,7 +1259,11 @@
8691259 // objEditor.DropFile((java.io.File[]) object, true);
8701260 // return;
8711261 // }
872
- 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) == ':')
8731267 {
8741268 // file(s)
8751269 String[] names = string.split("\n");
....@@ -896,7 +1290,7 @@
8961290
8971291 flashIt = false;
8981292 CameraPane pane = (CameraPane) target;
899
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1293
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9001294 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9011295
9021296 if (group.selection.size() == 1)
....@@ -912,23 +1306,33 @@
9121306
9131307 assert target == objEditor.jTree;
9141308 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1309
+ Object3D destinationLeaf;
9151310 try {
916
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1311
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9171312 } catch (Exception e) {
9181313 System.out.println("destinationPath : " + destinationPath);
9191314 return;
9201315 }
9211316
922
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1317
+ for (int i=group.selection.size(); --i>=0;)
9231318 {
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
+// {
9241328 loadClipboard(true);
9251329 objEditor.jTree.setSelectionPath(destinationPath);
926
- pasteInto(false);
927
- } else {
928
- loadClipboard(false);
929
- objEditor.jTree.setSelectionPath(destinationPath);
930
- pasteInto(false); // true); // ???
931
- }
1330
+ pasteInto(false, false);
1331
+// } else {
1332
+// loadClipboard(false);
1333
+// objEditor.jTree.setSelectionPath(destinationPath);
1334
+// pasteInto(false, false); // true); // ???
1335
+// }
9321336 }
9331337 public void dropActionChanged(DropTargetDragEvent dtde)
9341338 // Called if the user has modified the current drop gesture
....@@ -1033,85 +1437,107 @@
10331437 {
10341438 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10351439 //heightFieldItem.addActionListener(this);
1036
- gridItem = menu.add(new MenuItem("Grid"));
1037
- gridItem.addActionListener(this);
1038
- rectoidItem = menu.add(new MenuItem("Box"));
1039
- rectoidItem.addActionListener(this);
1040
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1041
- ellipsoidItem.addActionListener(this);
1042
- coneItem = menu.add(new MenuItem("Cone"));
1043
- coneItem.addActionListener(this);
1044
- torusItem = menu.add(new MenuItem("Torus"));
1045
- torusItem.addActionListener(this);
1046
- superItem = menu.add(new MenuItem("Superellipsoid"));
1047
- 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
+ {
10481458 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10491459 kleinItem.addActionListener(this);
1050
- particleItem = menu.add(new MenuItem("Particle system"));
1051
- particleItem.addActionListener(this);
1460
+ }
1461
+
1462
+// particleItem = menu.add(new MenuItem("Particle system"));
1463
+// particleItem.addActionListener(this);
1464
+ if (Globals.ADVANCED)
1465
+ {
10521466 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10531467 ragdollItem.addActionListener(this);
10541468 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10551469 ragdoll2Item.addActionListener(this);
1470
+ }
10561471 menu.add("-");
1057
- meshItem = menu.add(new MenuItem("Mesh"));
1472
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10581473 meshItem.addActionListener(this);
10591474 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10601475 // meshGroupItem.addActionListener(this);
1476
+ if (Globals.ADVANCED)
1477
+ {
10611478 springItem = menu.add(new MenuItem("Spring"));
10621479 springItem.addActionListener(this);
10631480 flagItem = menu.add(new MenuItem("Flag"));
10641481 flagItem.addActionListener(this);
1065
- bezierItem = menu.add(new MenuItem("Patch"));
1066
- bezierItem.addActionListener(this);
1067
- checkerItem = menu.add(new MenuItem("Checker"));
1068
- checkerItem.addActionListener(this);
10691482 blobItem = menu.add(new MenuItem("Blob"));
10701483 blobItem.addActionListener(this);
10711484 latheItem = menu.add(new MenuItem("Lathe"));
10721485 latheItem.addActionListener(this);
1073
- lightItem = menu.add(new MenuItem("Light"));
1074
- 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);
10751493 menu.add("-");
10761494 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10771495 //superLoopItem.addActionListener(this);
1078
- loopItem = menu.add(new MenuItem("Loop"));
1079
- loopItem.addActionListener(this);
1496
+// loopItem = menu.add(new MenuItem("Loop"));
1497
+// loopItem.addActionListener(this);
10801498 doubleItem = menu.add(new MenuItem("Fork"));
10811499 doubleItem.addActionListener(this);
1500
+ if (Globals.ADVANCED)
1501
+ {
10821502 tripleItem = menu.add(new MenuItem("Trident"));
10831503 tripleItem.addActionListener(this);
1504
+ }
10841505 }
10851506
10861507 void buildToolsMenu(Menu menu)
10871508 {
10881509 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10891510 animationItem.addItemListener(this);
1090
- animationItem.setState(CameraPane.ANIMATION);
1511
+ animationItem.setState(Globals.ANIMATION);
1512
+
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
10911515
10921516 menu.add("-");
10931517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10941518 parseverticesItem.addActionListener(this);
10951519 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10961520 textureFieldItem.addActionListener(this);
1097
- alignItem = menu.add(new MenuItem("Align"));
1521
+ alignItem = menu.add(new MenuItem("Align Objects"));
10981522 alignItem.addActionListener(this);
1099
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1100
- mirrorItem.addActionListener(this);
11011523 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11021524 reduceMorphItem.addActionListener(this);
11031525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11041526 reduce34MorphItem.addActionListener(this);
1105
-
1106
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1107
- computeAOItem.addActionListener(this);
11081527 menu.add("-");
1109
-
11101528 menu.add(memoryItem = new MenuItem("Memory Usage"));
11111529 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("-");
11121538 menu.add(analyzeItem = new MenuItem("Analyze"));
11131539 analyzeItem.addActionListener(this);
1114
- menu.add(dumpItem = new MenuItem("Dump"));
1540
+ menu.add(dumpItem = new MenuItem("Print"));
11151541 dumpItem.addActionListener(this);
11161542 // menu.add(pathItem = new MenuItem("From-to path"));
11171543 // pathItem.addActionListener(this);
....@@ -1120,6 +1546,8 @@
11201546 resetParentItem.addActionListener(this);
11211547 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11221548 repairParentItem.addActionListener(this);
1549
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1550
+ repairShadowItem.addActionListener(this);
11231551 menu.add(invariantsItem = new MenuItem("Invariants"));
11241552 invariantsItem.addActionListener(this);
11251553 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1127,6 +1555,7 @@
11271555 menu.add("-");
11281556 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11291557 editScriptItem.addActionListener(this);
1558
+ }
11301559 }
11311560
11321561 void ScreenFit()
....@@ -1249,9 +1678,34 @@
12491678 shadow.material = new cMaterial(obj.material);
12501679 shadow.material.diffuse = 0.0001f;
12511680 shadow.material.specular = 0.0001f;
1681
+ //shadow.projectedVertices[1].x = 300;
12521682
12531683 makeSomething(shadow);
12541684 }
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
+ }
12551709
12561710 /**
12571711 * applyExample
....@@ -1455,9 +1909,9 @@
14551909
14561910 void Overwrite(int mask)
14571911 {
1458
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1912
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14591913 {
1460
- Object3D content = GrafreeD.clipboard.get(0);
1914
+ Object3D content = Grafreed.clipboard.get(0);
14611915
14621916 if (content instanceof cGroup && ((cGroup)content).transientlink )
14631917 content = ((cGroup)content).get(0);
....@@ -1480,6 +1934,7 @@
14801934 //
14811935 public void actionPerformed(ActionEvent event) // , Object arg)
14821936 {
1937
+ Object source = event.getSource();
14831938 /*
14841939 if (event.getSource() == nameField)
14851940 {
....@@ -1491,11 +1946,11 @@
14911946 }
14921947 else
14931948 */
1494
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1949
+ if (source == lookAtItem || source == lookFromItem)
14951950 {
14961951 ScreenFit();
14971952 } else
1498
- if (event.getSource() == switchItem)
1953
+ if (source == switchViewItem)
14991954 {
15001955 cVector v1 = new cVector();
15011956 cVector v2 = new cVector();
....@@ -1504,11 +1959,11 @@
15041959 objEditor.cameraView.renderCamera.setAim(v2, v1);
15051960 objEditor.cameraView.repaint();
15061961 } else
1507
- if (event.getSource() == rectoidItem)
1962
+ if (source == rectoidItem || source == boxButton)
15081963 {
15091964 makeSomething(new Box());
15101965 } else
1511
- if (event.getSource() == particleItem)
1966
+ if (source == particleItem || source == particlesButton)
15121967 {
15131968 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15141969 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1529,9 +1984,9 @@
15291984 applyExample(particleGeom, "SMOKE");
15301985 makeSomething(particleGeom);
15311986 } else
1532
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1987
+ if (source == ragdollItem || source == ragdoll2Item)
15331988 {
1534
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1989
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15351990
15361991 ragdoll.toParent = LA.newMatrix();
15371992 ragdoll.fromParent = LA.newMatrix();
....@@ -1549,7 +2004,7 @@
15492004 } else
15502005 /*
15512006 */
1552
- if (event.getSource() == heightFieldItem)
2007
+ if (source == heightFieldItem)
15532008 {
15542009 Object3D obj = new Object3D();
15552010
....@@ -1587,31 +2042,31 @@
15872042
15882043 makeSomething(obj);
15892044 } else
1590
- if (event.getSource() == gridItem)
2045
+ if (source == gridItem || source == gridButton)
15912046 {
15922047 makeSomething(new Grid());
15932048 } else
1594
- if (event.getSource() == ellipsoidItem)
2049
+ if (source == ellipsoidItem || source == sphereButton)
15952050 {
15962051 makeSomething(new Sphere());
15972052 } else
1598
- if (event.getSource() == coneItem)
2053
+ if (source == coneItem || source == coneButton)
15992054 {
16002055 makeSomething(new Cone());
16012056 } else
1602
- if (event.getSource() == torusItem)
2057
+ if (source == torusItem || source == torusButton)
16032058 {
16042059 makeSomething(new Torus());
16052060 } else
1606
- if (event.getSource() == superItem)
2061
+ if (source == superItem || source == superButton)
16072062 {
16082063 makeSomething(new Superellipsoid());
16092064 } else
1610
- if (event.getSource() == kleinItem)
2065
+ if (source == kleinItem || source == kleinButton)
16112066 {
16122067 makeSomething(new Klein());
16132068 } else
1614
- if (event.getSource() == blobItem)
2069
+ if (source == blobItem)
16152070 {
16162071 Blob blob = new Blob();
16172072 BlobComponent comp = new BlobComponent();
....@@ -1619,15 +2074,15 @@
16192074 //blob.retile();
16202075 makeSomething(blob);
16212076 } else
1622
- if (event.getSource() == latheItem)
2077
+ if (source == latheItem)
16232078 {
16242079 makeSomething(new Lathe());
16252080 } else
1626
- if (event.getSource() == bezierItem)
2081
+ if (source == bezierItem)
16272082 {
16282083 makeSomething(new BezierSurface());
16292084 } else
1630
- if (event.getSource() == checkerItem)
2085
+ if (source == overlayItem || source == overlayButton)
16312086 {
16322087 /*
16332088 Object3D obj = new BezierSurface(5,8);
....@@ -1642,7 +2097,7 @@
16422097 */
16432098 makeSomething(new Checker());
16442099 } else
1645
- if (event.getSource() == meshItem)
2100
+ if (source == meshItem)
16462101 {
16472102 Object3D itemtomake = new Object3D();
16482103 Object3D child;
....@@ -1663,35 +2118,35 @@
16632118 makeSomething(child);
16642119 }
16652120 } else
1666
- if (event.getSource() == springItem)
2121
+ if (source == springItem)
16672122 {
16682123 cSpring s = new cSpring();
16692124 s.setup();
16702125 makeSomething(s);
16712126 } else
1672
- if (event.getSource() == flagItem)
2127
+ if (source == flagItem)
16732128 {
16742129 cSpring s = new cFlag();
16752130 s.setup();
16762131 makeSomething(s);
16772132 } else
1678
- if (event.getSource() == lightItem)
2133
+ if (source == lightItem || source == lightButton)
16792134 {
16802135 makeSomething(new Light());
16812136 } else
1682
- if (event.getSource() == csgItem)
2137
+ if (source == csgItem)
16832138 {
16842139 group(new CSG());
16852140 } else
1686
- if (event.getSource() == templateItem)
2141
+ if (source == templateItem)
16872142 {
16882143 group(new cTemplate());
16892144 } else
1690
- if (event.getSource() == attributeItem)
2145
+ if (source == attributeItem)
16912146 {
16922147 makeSomething(new Attribute());
16932148 } else
1694
- if (event.getSource() == pointflowItem)
2149
+ if (source == pointflowItem)
16952150 {
16962151 makeSomething(new PointFlow());
16972152 } else
....@@ -1703,7 +2158,7 @@
17032158 } else
17042159 */
17052160
1706
- if (event.getSource() == superLoopItem)
2161
+ if (source == superLoopItem)
17072162 {
17082163 Composite g = new cGroup();
17092164 for (int i=0; i<15; i++)
....@@ -1725,30 +2180,30 @@
17252180
17262181 group(g);
17272182 } else
1728
- if (event.getSource() == loopItem)
2183
+ if (source == loopItem || source == loopButton)
17292184 {
17302185 Composite csg = new GroupLeaf();
17312186 csg.count = 5;
17322187 group(csg);
1733
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
17342189 csg.addChild(child);
17352190 child.addChild(csg);
17362191 } else
1737
- if (event.getSource() == doubleItem)
2192
+ if (source == doubleItem)
17382193 {
1739
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
17402195 csg.count = 5;
17412196 group(csg);
1742
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
17432198 csg.addChild(child);
17442199 child.addChild(csg);
1745
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
17462201 csg.addChild(child);
17472202 child.addChild(csg);
17482203 } else
1749
- if (event.getSource() == tripleItem)
2204
+ if (source == tripleItem)
17502205 {
1751
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
17522207 csg.count = 4;
17532208 group(csg);
17542209 Composite child = new cGroup();
....@@ -1761,73 +2216,98 @@
17612216 csg.addChild(child);
17622217 child.addChild(csg);
17632218 } else
1764
-
1765
- if (event.getSource() == importGFDItem)
2219
+ if (source == computeAOItem)
17662220 {
1767
- ImportGFD();
2221
+ Globals.drawMode = CameraPane.OCCLUSION;
2222
+ Globals.theRenderer.repaint();
17682223 } else
1769
- if (event.getSource() == importVRMLX3DItem)
1770
- {
1771
- ImportVRMLX3D();
1772
- } else
1773
- if (event.getSource() == import3DSItem)
1774
- {
1775
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1776
- } else
1777
- if (event.getSource() == importOBJItem)
1778
- {
1779
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1780
- } else
1781
- if (event.getSource() == computeAOItem)
1782
- {
1783
- CameraPane.drawMode = CameraPane.OCCLUSION;
1784
- CameraPane.theRenderer.repaint();
1785
- } else
1786
- if (event.getSource() == recompileItem)
2224
+ if (source == recompileItem)
17872225 {
17882226 Recompile();
17892227 refreshContents();
17902228 } else
1791
- if (event.getSource() == editScriptItem)
2229
+ if (source == editScriptItem)
17922230 {
17932231 OpenDialog();
17942232 refreshContents();
17952233 } else
1796
- if (event.getSource() == invariantsItem)
2234
+ if (source == invariantsItem)
17972235 {
17982236 System.out.println("Invariants:");
1799
- GrafreeD.grafreeD.universe.invariants();
2237
+ Grafreed.grafreeD.universe.invariants();
18002238 } else
1801
- if (event.getSource() == memoryItem)
2239
+ if (source == memoryItem)
18022240 {
18032241 //System.out.println("Invariants:");
18042242 PrintMemory();
18052243 } else
1806
- if (event.getSource() == pathItem)
2244
+ if (source == pathItem)
18072245 {
18082246 PrintPath();
18092247 } else
1810
- if (event.getSource() == analyzeItem)
2248
+ if (source == analyzeItem)
18112249 {
18122250 AnalyzeObject();
18132251 } else
1814
- if (event.getSource() == dumpItem)
2252
+ if (source == dumpItem)
18152253 {
18162254 DumpObject();
18172255 } else
1818
- if (event.getSource() == screenfitButton)
2256
+ if (source == minButton)
18192257 {
1820
- //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
+ {
18212303 ScreenFit();
18222304 } else
1823
- if (event.getSource() == screenfitpointButton)
2305
+ if (source == screenfitpointButton)
18242306 {
1825
- //Reload(lastConverter, lastFilename, true);
18262307 ScreenFitPoint();
18272308 } else
1828
- if (event.getSource() == snapobjectButton)
2309
+ if (source == snapobjectButton)
18292310 {
1830
- //Reload(lastConverter, lastFilename, true);
18312311 SnapObject();
18322312 } else
18332313 // if (event.getSource() == recompileButton)
....@@ -1836,13 +2316,13 @@
18362316 // Recompile();
18372317 // refreshContents();
18382318 // } else
1839
- if (event.getSource() == gcButton)
2319
+ if (source == gcButton)
18402320 {
18412321 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18422322 System.gc();
18432323 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18442324 } else
1845
- if (event.getSource() == editLeafItem)
2325
+ if (source == editLeafItem)
18462326 {
18472327 Object3D obj;
18482328 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1856,62 +2336,74 @@
18562336 }
18572337 refreshContents(true);
18582338 } else
1859
- if (event.getSource() == openWindowItem)
2339
+ if (source == openWindowItem)
18602340 {
18612341 EditSelection(true);
18622342 } else
1863
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2343
+ if (source == cutItem || source == clearButton)
18642344 {
18652345 loadClipboard(true);
18662346 } else
1867
- if (event.getSource() == duplicateItem)
2347
+ if (source == undoItem)
18682348 {
1869
- 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;
18702358 loadClipboard(false);
18712359 paste(false);
1872
- GrafreeD.clipboard = keep;
2360
+ Grafreed.clipboard = keep;
18732361 } else
1874
- if (event.getSource() == cloneItem)
2362
+ if (source == cloneItem)
18752363 {
18762364 CloneSelection(false);
18772365 } else
1878
- if (event.getSource() == cloneSupportItem)
2366
+ if (source == cloneSupportItem)
18792367 {
18802368 CloneSelection(true);
18812369 } else
1882
- if (event.getSource() == copyItem)
2370
+ if (source == copyItem)
18832371 {
18842372 loadClipboard(false);
18852373 } else
1886
- if (event.getSource() == pasteItem)
2374
+ if (source == pasteItem)
18872375 {
18882376 paste(false);
18892377 } else
1890
- if (event.getSource() == pasteLinkItem)
2378
+ if (source == pasteIntoItem)
18912379 {
1892
- pasteInto(false);
2380
+ pasteInto(true, false);
18932381 } else
1894
- if (event.getSource() == pasteCloneItem)
2382
+ if (source == pasteLinkItem)
18952383 {
1896
- pasteInto(true);
2384
+ pasteInto(false, false);
18972385 } else
1898
- if (event.getSource() == pasteExpandItem)
2386
+ if (source == pasteCloneItem)
2387
+ {
2388
+ pasteInto(true, true);
2389
+ } else
2390
+ if (source == pasteExpandItem)
18992391 {
19002392 paste(true);
19012393 } else
1902
- if (event.getSource() == synchronizeItem)
2394
+ if (source == synchronizeItem)
19032395 {
19042396 Overwrite(Object3D.TRANSFORM);
19052397 } else
1906
- if (event.getSource() == overwriteNameItem)
2398
+ if (source == overwriteNameItem)
19072399 {
19082400 Overwrite(Object3D.NAME);
19092401 } else
1910
- if (event.getSource() == overwriteUVItem)
2402
+ if (source == overwriteUVItem)
19112403 {
19122404 Overwrite(Object3D.UV);
19132405 } else
1914
- if (event.getSource() == overwriteMatItem)
2406
+ if (source == overwriteMatItem)
19152407 {
19162408 /* july 2015
19172409 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1931,7 +2423,7 @@
19312423
19322424 Overwrite(dropAttributes);
19332425 }
1934
- if (event.getSource() == overwriteGeoItem)
2426
+ if (source == overwriteGeoItem)
19352427 {
19362428 Overwrite(Object3D.GEOMETRY);
19372429 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1948,7 +2440,7 @@
19482440 // refreshContents();
19492441 // }
19502442 } else
1951
- if (event.getSource() == generateMeshItem)
2443
+ if (source == generateMeshItem)
19522444 {
19532445 //if (group.selection.size() == 1)
19542446 // for (int i=0; i<group.selection.size(); i++)
....@@ -1959,7 +2451,7 @@
19592451 ResetModel();
19602452 refreshContents();
19612453 } else
1962
- if (event.getSource() == extractGeometriesItem)
2454
+ if (source == extractGeometriesItem)
19632455 {
19642456 boolean one = false;
19652457
....@@ -1986,7 +2478,7 @@
19862478 ResetModel();
19872479 refreshContents();
19882480 } else
1989
- if (event.getSource() == cloneGeometriesItem)
2481
+ if (source == cloneGeometriesItem)
19902482 {
19912483 boolean one = false;
19922484
....@@ -2012,7 +2504,7 @@
20122504 ResetModel();
20132505 refreshContents();
20142506 } else
2015
- if (event.getSource() == shareGeometriesItem)
2507
+ if (source == shareGeometriesItem)
20162508 {
20172509 boolean one = false;
20182510
....@@ -2042,7 +2534,7 @@
20422534 refreshContents();
20432535 }
20442536 } else
2045
- if (event.getSource() == mergeGeometriesItem)
2537
+ if (source == mergeGeometriesItem)
20462538 {
20472539 boolean one = false;
20482540
....@@ -2072,7 +2564,7 @@
20722564 ResetModel();
20732565 refreshContents();
20742566 } else
2075
- if (event.getSource() == linkverticesItem)
2567
+ if (source == linkverticesItem)
20762568 {
20772569 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20782570 // {
....@@ -2085,48 +2577,48 @@
20852577 // group.selection.get(0).setMasterThis(content); // should be identity
20862578 // refreshContents();
20872579 // }
2088
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2580
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20892581 {
2090
- Object3D content = GrafreeD.clipboard.get(0);
2582
+ Object3D content = Grafreed.clipboard.get(0);
20912583
20922584 if (content instanceof cGroup && ((cGroup)content).transientlink )
20932585 content = ((cGroup)content).get(0);
20942586
2095
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2587
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20962588 for (int i=0; i<group.selection.size(); i++)
20972589 {
2098
- boolean random = CameraPane.RANDOM;
2099
- CameraPane.RANDOM = false; // parse all random nodes
2590
+ boolean random = CameraPane.SWITCH;
2591
+ CameraPane.SWITCH = false; // parse all random nodes
21002592 group.selection.get(i).linkVerticesThis(content);
21012593 // group.selection.get(i).setMasterThis(content); // should be identity
2102
- CameraPane.RANDOM = random;
2594
+ CameraPane.SWITCH = random;
21032595 }
2104
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2596
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21052597 refreshContents();
21062598 }
21072599 } else
2108
- if (event.getSource() == resetsupportItem)
2600
+ if (source == resetsupportItem)
21092601 {
21102602 for (int i=0; i<group.selection.size(); i++)
21112603 {
2112
- boolean random = CameraPane.RANDOM;
2113
- CameraPane.RANDOM = false; // parse all random nodes
2604
+ boolean random = CameraPane.SWITCH;
2605
+ CameraPane.SWITCH = false; // parse all random nodes
21142606 group.selection.get(i).linkVerticesThis(null);
2115
- CameraPane.RANDOM = random;
2607
+ CameraPane.SWITCH = random;
21162608 }
21172609
21182610 refreshContents();
21192611 } else
2120
- if (event.getSource() == relinkverticesItem)
2612
+ if (source == relinkverticesItem)
21212613 {
2122
- boolean random = CameraPane.RANDOM;
2123
- CameraPane.RANDOM = false; // parse all random nodes
2614
+ boolean random = CameraPane.SWITCH;
2615
+ CameraPane.SWITCH = false; // parse all random nodes
21242616 group.selection.RelinkToSupport();
2125
- CameraPane.RANDOM = random;
2617
+ CameraPane.SWITCH = random;
21262618
21272619 refreshContents();
21282620 } else
2129
- if (event.getSource() == resetreferencesItem)
2621
+ if (source == resetreferencesItem)
21302622 {
21312623 for (int i=0; i<group.selection.size(); i++)
21322624 {
....@@ -2135,11 +2627,11 @@
21352627
21362628 refreshContents();
21372629 } else
2138
- if (event.getSource() == setMasterItem)
2630
+ if (source == setMasterItem)
21392631 {
2140
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2632
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21412633 {
2142
- Object3D content = GrafreeD.clipboard.get(0);
2634
+ Object3D content = Grafreed.clipboard.get(0);
21432635
21442636 if (content instanceof cGroup && ((cGroup)content).transientlink )
21452637 content = ((cGroup)content).get(0);
....@@ -2148,13 +2640,13 @@
21482640 refreshContents();
21492641 }
21502642 } else
2151
- if (event.getSource() == poseMeshItem)
2643
+ if (source == poseMeshItem)
21522644 {
21532645 if (group.selection.size() == 1)
21542646 {
2155
- if (GrafreeD.clipboard.size() == 1)
2647
+ if (Grafreed.clipboard.size() == 1)
21562648 {
2157
- Object3D content = GrafreeD.clipboard.get(0);
2649
+ Object3D content = Grafreed.clipboard.get(0);
21582650
21592651 if (content instanceof cGroup && ((cGroup)content).transientlink )
21602652 content = ((cGroup)content).get(0);
....@@ -2167,19 +2659,19 @@
21672659 }
21682660
21692661 } else
2170
- if (event.getSource() == revertMeshItem)
2662
+ if (source == revertMeshItem)
21712663 {
21722664 RevertMeshes();
21732665 } else
2174
- if (event.getSource() == resetMeshItem)
2666
+ if (source == resetAllItem)
21752667 {
21762668 ResetAll();
21772669 } else
2178
- if (event.getSource() == stepAllItem)
2670
+ if (source == stepAllItem)
21792671 {
21802672 StepAll();
21812673 } else
2182
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
21832675 {
21842676 //int indices[] = jList.getSelectedIndices();
21852677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2187,46 +2679,46 @@
21872679
21882680 ClearSelection(false);
21892681 } else
2190
- if (event.getSource() == clearAllItem)
2682
+ if (source == clearAllItem)
21912683 {
21922684 ClearSelection(true);
21932685 } else
2194
- if (event.getSource() == grabItem)
2686
+ if (source == grabItem || source == groupButton)
21952687 {
2196
- group(new cGroup(), true);
2688
+ group(new cGroup(), false); // true);
21972689 } else
2198
- if (event.getSource() == hideItem)
2690
+ if (source == hideItem)
21992691 {
22002692 group(new HiddenObject());
22012693 } else
2202
- if (event.getSource() == frontItem)
2694
+ if (source == frontItem)
22032695 {
22042696 front();
22052697 } else
2206
- if (event.getSource() == backItem)
2698
+ if (source == backItem)
22072699 {
22082700 back();
22092701 } else
2210
- if (event.getSource() == cameraItem)
2702
+ if (source == cameraItem)
22112703 {
22122704 makeSomething(new Camera());
22132705 } else
2214
- if (event.getSource() == compositeItem)
2706
+ if (source == compositeItem || source == compositeButton)
22152707 {
22162708 group(new Composite());
22172709 } else
2218
- if (event.getSource() == randomItem)
2710
+ if (source == switchItem || source == switchButton)
22192711 {
22202712 RandomNode random = new RandomNode();
22212713 group(random);
22222714 if (random.size() > 0)
2223
- random.name = random.get(0).name + "Rnd";
2715
+ random.name = random.get(0).name + "Switch";
22242716 } else
2225
- if (event.getSource() == physicsItem)
2717
+ if (source == physicsItem)
22262718 {
22272719 group(new PhysicsNode());
22282720 } else
2229
- if (event.getSource() == frameselectorItem)
2721
+ if (source == frameselectorItem)
22302722 {
22312723 for (int i=0; i<group.selection.size(); i++)
22322724 {
....@@ -2238,7 +2730,7 @@
22382730 ResetModel();
22392731 refreshContents();
22402732 } else
2241
- if (event.getSource() == switchGeoItem)
2733
+ if (source == switchGeoItem)
22422734 {
22432735 for (int i=0; i<group.selection.size(); i++)
22442736 {
....@@ -2250,7 +2742,7 @@
22502742 ResetModel();
22512743 refreshContents();
22522744 } else
2253
- if (event.getSource() == switchTransfoItem)
2745
+ if (source == switchTransfoItem)
22542746 {
22552747 for (int i=0; i<group.selection.size(); i++)
22562748 {
....@@ -2262,7 +2754,7 @@
22622754 ResetModel();
22632755 refreshContents();
22642756 } else
2265
- if (event.getSource() == morphItem)
2757
+ if (source == morphItem)
22662758 {
22672759 for (int i=0; i<group.selection.size(); i++)
22682760 {
....@@ -2274,7 +2766,7 @@
22742766 ResetModel();
22752767 refreshContents();
22762768 } else
2277
- if (event.getSource() == scriptNodeItem)
2769
+ if (source == scriptNodeItem)
22782770 {
22792771 boolean atleastone = false;
22802772
....@@ -2313,215 +2805,252 @@
23132805 }
23142806 }
23152807 } else
2316
- if (event.getSource() == linkerItem)
2808
+ if (source == linkerItem)
23172809 {
23182810 group(new cLinker());
23192811 } else
2320
- if (event.getSource() == textureItem)
2812
+ if (source == textureItem || source == textureButton)
23212813 {
23222814 group(new TextureNode());
23232815 } else
2324
- if (event.getSource() == billboardItem)
2816
+ if (source == billboardItem)
23252817 {
23262818 group(new BillboardNode());
23272819 } else
2328
- if (event.getSource() == shadowXItem)
2820
+ if (source == shadowXItem)
23292821 {
23302822 CastShadow(0);
23312823 } else
2332
- if (event.getSource() == shadowYItem)
2824
+ if (source == shadowYItem)
23332825 {
23342826 CastShadow(1);
23352827 } else
2336
- if (event.getSource() == shadowZItem)
2828
+ if (source == shadowZItem)
23372829 {
23382830 CastShadow(2);
23392831 } else
2340
- if (event.getSource() == ungroupItem)
2832
+ if (source == ungroupItem || source == ungroupButton)
23412833 {
2342
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
23432836 for (int i=0; i<group.selection.size(); i++)
23442837 {
2345
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
23462843 }
23472844
2348
- ClearSelection(false);
2349
-
2350
- 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
+ }
23512856 } else
2352
- if (event.getSource() == genUVItem)
2857
+ if (source == genUVItem)
23532858 {
23542859 GenUV();
23552860 } else
2356
- if (event.getSource() == genNormalsCADItem)
2861
+ if (source == genNormalsCADItem)
23572862 {
23582863 GenNormals(true);
23592864 } else
2360
- if (event.getSource() == genNormalsMESHItem)
2865
+ if (source == genNormalsMESHItem)
23612866 {
2362
- GenNormals(true); // TODO
2867
+ GenNormalsMESH();
23632868 } else
2364
- if (event.getSource() == genNormalsORGANItem)
2869
+ if (source == genNormalsORGANItem)
23652870 {
23662871 GenNormals(false);
23672872 } else
2368
- if (event.getSource() == genNormalsMINEItem)
2873
+ if (source == genNormalsMINEItem)
23692874 {
23702875 GenNormalsMINE();
23712876 } else
2372
- if (event.getSource() == stripifyItem)
2877
+ if (source == stripifyItem)
23732878 {
23742879 Stripify();
23752880 } else
2376
- if (event.getSource() == unstripifyItem)
2881
+ if (source == unstripifyItem)
23772882 {
23782883 Unstripify();
23792884 } else
2380
- if (event.getSource() == trimItem)
2885
+ if (source == trimItem)
23812886 {
23822887 Trim();
23832888 } else
2384
- if (event.getSource() == untrimItem)
2889
+ if (source == untrimItem)
23852890 {
23862891 Untrim();
23872892 } else
2388
- if (event.getSource() == clearColorsItem)
2893
+ if (source == clearColorsItem)
23892894 {
23902895 ClearColors();
23912896 } else
2392
- if (event.getSource() == clearMaterialsItem)
2897
+ if (source == clearMaterialsItem)
23932898 {
23942899 ClearMaterials();
23952900 } else
2396
- if (event.getSource() == liveleavesItem)
2901
+ if (source == liveleavesItem)
23972902 {
23982903 LiveLeaves(true);
23992904 } else
2400
- if (event.getSource() == unliveleavesItem)
2905
+ if (source == unliveleavesItem)
24012906 {
24022907 LiveLeaves(false);
24032908 } else
2404
- if (event.getSource() == supportleavesItem)
2909
+ if (source == supportleavesItem)
24052910 {
24062911 SupportLeaves(true);
24072912 } else
2408
- if (event.getSource() == unsupportleavesItem)
2913
+ if (source == unsupportleavesItem)
24092914 {
24102915 SupportLeaves(false);
24112916 } else
2412
- if (event.getSource() == hideleavesItem)
2917
+ if (source == hideleavesItem)
24132918 {
24142919 HideLeaves(true);
24152920 } else
2416
- if (event.getSource() == showleavesItem)
2921
+ if (source == showleavesItem)
24172922 {
24182923 HideLeaves(false);
24192924 } else
2420
- if (event.getSource() == markleavesItem)
2925
+ if (source == markleavesItem)
24212926 {
24222927 MarkLeaves(true);
24232928 } else
2424
- if (event.getSource() == unmarkleavesItem)
2929
+ if (source == unmarkleavesItem)
24252930 {
24262931 MarkLeaves(false);
24272932 } else
2428
- 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)
24292950 {
24302951 FlipV(true);
24312952 } else
2432
- if (event.getSource() == unflipVItem)
2953
+ if (source == unflipVItem)
24332954 {
24342955 FlipV(false);
24352956 } else
2436
- if (event.getSource() == lowTexturesItem)
2957
+ if (source == lowTexturesItem)
24372958 {
24382959 SetTexRes(0);
24392960 } else
2440
- if (event.getSource() == normalTexturesItem)
2961
+ if (source == normalTexturesItem)
24412962 {
24422963 SetTexRes(1);
24432964 } else
2444
- if (event.getSource() == highTexturesItem)
2965
+ if (source == highTexturesItem)
24452966 {
24462967 SetTexRes(2);
24472968 } else
2448
- if (event.getSource() == veryhighTexturesItem)
2969
+ if (source == veryhighTexturesItem)
24492970 {
24502971 SetTexRes(3);
24512972 } else
2452
- if (event.getSource() == maxTexturesItem)
2973
+ if (source == maxTexturesItem)
24532974 {
24542975 SetTexRes(4);
24552976 } else
2456
- if (event.getSource() == panoTexturesItem)
2977
+ if (source == panoTexturesItem)
24572978 {
24582979 SetTexRes(5);
24592980 } else
2460
- if (event.getSource() == reverseNormalsItem)
2981
+ if (source == reverseNormalsItem)
24612982 {
24622983 ReverseNormals();
24632984 } else
2464
- if (event.getSource() == parseverticesItem)
2985
+ if (source == parseverticesItem)
24652986 {
24662987 ParseVertices();
24672988 } else
2468
- if (event.getSource() == textureFieldItem)
2989
+ if (source == textureFieldItem)
24692990 {
24702991 TextureVertices();
24712992 } else
2472
- if (event.getSource() == alignItem)
2993
+ if (source == alignItem)
24732994 {
24742995 Align();
24752996 } else
2476
- if (event.getSource() == mirrorItem)
2997
+ if (source == mirrorItem)
24772998 {
24782999 MirrorPoses();
24793000 } else
2480
- if (event.getSource() == reduceMorphItem)
3001
+ if (source == reduceMorphItem)
24813002 {
24823003 MeshReduction(false);
24833004 } else
2484
- if (event.getSource() == reduce34MorphItem)
3005
+ if (source == reduce34MorphItem)
24853006 {
24863007 MeshReduction(true);
24873008 } else
2488
- if (event.getSource() == reverseTrianglesItem)
3009
+ if (source == reverseTrianglesItem)
24893010 {
24903011 ReverseTriangles();
24913012 } else
2492
- if (event.getSource() == reduceMeshItem)
3013
+ if (source == reduceMeshItem)
24933014 {
24943015 ReduceMesh(false);
24953016 } else
2496
- if (event.getSource() == reduce34MeshItem)
3017
+ if (source == reduce34MeshItem)
24973018 {
24983019 ReduceMesh(true);
24993020 } else
2500
- if (event.getSource() == increaseMeshItem)
3021
+ if (source == increaseMeshItem)
25013022 {
25023023 IncreaseMesh();
25033024 } else
2504
- if (event.getSource() == clipMeshItem)
3025
+ if (source == clipMeshItem)
25053026 {
25063027 ClipMesh();
25073028 } else
2508
- if (event.getSource() == smoothMeshItem)
3029
+ if (source == smoothMeshItem)
25093030 {
25103031 SmoothMesh();
25113032 } else
2512
- if (event.getSource() == transformgeometryItem)
3033
+ if (source == transformGeometryItem)
25133034 {
25143035 TransformGeometry();
25153036 } else
2516
- if (event.getSource() == resetTransformItem)
3037
+ if (source == transformChildrenItem)
3038
+ {
3039
+ TransformChildren();
3040
+ } else
3041
+ if (source == resetTransformItem)
25173042 {
25183043 ResetTransform();
25193044 } else
2520
- if (event.getSource() == resetCentroidItem)
3045
+ if (source == resetCentroidItem)
25213046 {
2522
- ResetCentroid();
3047
+ ResetCentroid(true);
25233048 } else
2524
- if (event.getSource() == resetParentItem)
3049
+ if (source == resetCentroidXZItem)
3050
+ {
3051
+ ResetCentroid(false);
3052
+ } else
3053
+ if (source == resetParentItem)
25253054 {
25263055 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25273056 {
....@@ -2531,7 +3060,7 @@
25313060
25323061 refreshContents();
25333062 } else
2534
- if (event.getSource() == repairParentItem)
3063
+ if (source == repairParentItem)
25353064 {
25363065 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25373066 {
....@@ -2545,7 +3074,21 @@
25453074
25463075 refreshContents();
25473076 } else
2548
- if (event.getSource() == sortbysizeItem)
3077
+ if (source == repairShadowItem)
3078
+ {
3079
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3080
+ {
3081
+ Object3D obj = (Object3D)e.nextElement();
3082
+ obj.RepairShadow();
3083
+// for (int i=0; i<obj.size(); i++)
3084
+// {
3085
+// obj.get(i).parent = obj;
3086
+// }
3087
+ }
3088
+
3089
+ refreshContents();
3090
+ } else
3091
+ if (source == sortbysizeItem)
25493092 {
25503093 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25513094 {
....@@ -2557,7 +3100,7 @@
25573100 ResetModel();
25583101 refreshContents();
25593102 } else
2560
- if (event.getSource() == sortbynameItem)
3103
+ if (source == sortbynameItem)
25613104 {
25623105 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25633106 {
....@@ -2569,7 +3112,7 @@
25693112 ResetModel();
25703113 refreshContents();
25713114 } else
2572
- if (event.getSource() == attachPigmentItem)
3115
+ if (source == attachPigmentItem)
25733116 {
25743117 String texture = GetFile("Attach pigment");
25753118 Object3D obj;
....@@ -2581,7 +3124,7 @@
25813124
25823125 refreshContents();
25833126 } else
2584
- if (event.getSource() == detachPigmentItem)
3127
+ if (source == detachPigmentItem)
25853128 {
25863129 Object3D obj;
25873130 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2592,7 +3135,7 @@
25923135
25933136 refreshContents();
25943137 } else
2595
- if (event.getSource() == attachBumpItem)
3138
+ if (source == attachBumpItem)
25963139 {
25973140 String texture = GetFile("Attach bump");
25983141 Object3D obj;
....@@ -2604,7 +3147,7 @@
26043147
26053148 refreshContents();
26063149 } else
2607
- if (event.getSource() == detachBumpItem)
3150
+ if (source == detachBumpItem)
26083151 {
26093152 Object3D obj;
26103153 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2615,7 +3158,7 @@
26153158
26163159 refreshContents();
26173160 } else
2618
- if (event.getSource() == pigmentBumpItem)
3161
+ if (source == pigmentBumpItem)
26193162 {
26203163 Object3D obj;
26213164 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2626,158 +3169,237 @@
26263169
26273170 refreshContents();
26283171 } else
2629
- if (event.getSource() == flashSelectionButton)
3172
+ if (source == flashSelectionButton)
26303173 {
26313174 CameraPane.flash = true;
26323175 refreshContents();
26333176 } else
2634
- if (event.getSource() == oneButton)
3177
+ if (source == oneButton)
26353178 {
26363179 } else
2637
- if (event.getSource() == twoButton)
3180
+ if (source == twoButton)
26383181 {
26393182 radio.layout = twoButton;
3183
+
3184
+ if (CameraPane.FULLSCREEN)
3185
+ fullscreenLayout = radio.layout;
3186
+
26403187 // bug
26413188 //gridPanel.setDividerLocation(1.0);
26423189 //bigPanel.setDividerLocation(0.0);
2643
- bigThree.remove(scenePanel);
2644
- bigThree.remove(centralPanel);
2645
- bigThree.remove(XYZPanel);
2646
- aWindowConstraints.gridx = 0;
2647
- aWindowConstraints.gridy = 0;
2648
- aWindowConstraints.gridwidth = 1;
2649
- // aConstraints.gridheight = 3;
2650
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2651
- aWindowConstraints.weightx = 0;
2652
- aWindowConstraints.weighty = 1;
2653
- //bigThree.add(jtp, aWindowConstraints);
2654
- aWindowConstraints.weightx = 1;
2655
- aWindowConstraints.gridwidth = 3;
2656
- // aConstraints.gridheight = 3;
2657
- aWindowConstraints.gridx = 1;
2658
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2659
- bigThree.add(centralPanel, aWindowConstraints);
2660
- aWindowConstraints.weightx = 0;
2661
- aWindowConstraints.gridx = 4;
2662
- aWindowConstraints.gridwidth = 1;
2663
- // aConstraints.gridheight = 3;
2664
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2665
- //bigThree.add(XYZPanel, aWindowConstraints);
2666
- 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
+
26673237 } else
2668
- if (event.getSource() == threeButton)
3238
+ if (source == threeButton)
26693239 {
26703240 radio.layout = threeButton;
2671
- bigThree.remove(scenePanel);
2672
- bigThree.remove(centralPanel);
2673
- bigThree.remove(XYZPanel);
2674
- aWindowConstraints.gridx = 0;
2675
- aWindowConstraints.gridy = 0;
2676
- aWindowConstraints.gridwidth = 1;
2677
- // aConstraints.gridheight = 3;
2678
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2679
- aWindowConstraints.weightx = 0;
2680
- aWindowConstraints.weighty = 1;
2681
- //bigThree.add(jtp, aWindowConstraints);
2682
- aWindowConstraints.weightx = 1;
2683
- aWindowConstraints.gridwidth = 3;
2684
- // aConstraints.gridheight = 3;
2685
- aWindowConstraints.gridx = 1;
2686
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2687
- bigThree.add(centralPanel, aWindowConstraints);
2688
- aWindowConstraints.weightx = 0;
2689
- aWindowConstraints.gridx = 4;
2690
- aWindowConstraints.gridwidth = 1;
2691
- // aConstraints.gridheight = 3;
2692
- aConstraints.fill = GridBagConstraints.VERTICAL;
2693
- bigThree.add(XYZPanel, aWindowConstraints);
2694
- 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();
26953278 } else
2696
- if (event.getSource() == fourButton)
3279
+ if (source == fourButton)
26973280 {
26983281 radio.layout = fourButton;
2699
- bigThree.remove(scenePanel);
2700
- bigThree.remove(centralPanel);
2701
- bigThree.remove(XYZPanel);
2702
- aWindowConstraints.gridx = 0;
2703
- aWindowConstraints.gridy = 0;
2704
- aWindowConstraints.gridwidth = 1;
2705
- // aWindowConstraints.gridheight = 3;
2706
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2707
- aWindowConstraints.weightx = 1;
2708
- aWindowConstraints.weighty = 1;
2709
- bigThree.add(scenePanel, aWindowConstraints);
2710
- aWindowConstraints.weightx = 1;
2711
- aWindowConstraints.gridwidth = 3;
2712
- // aConstraints.gridheight = 3;
2713
- aWindowConstraints.gridx = 1;
2714
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2715
- //bigThree.add(cameraPanel, aWindowConstraints);
2716
- aWindowConstraints.weightx = 0;
2717
- aWindowConstraints.gridx = 4;
2718
- aWindowConstraints.gridwidth = 1;
2719
- // aWindowConstraints.gridheight = 3;
2720
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2721
- //bigThree.add(XYZPanel, aWindowConstraints);
2722
- 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();
27233318 } else
2724
- if (event.getSource() == sixButton)
3319
+ if (source == sixButton)
27253320 {
27263321 radio.layout = sixButton;
2727
- bigThree.remove(scenePanel);
2728
- bigThree.remove(centralPanel);
2729
- bigThree.remove(XYZPanel);
2730
- aWindowConstraints.gridx = 0;
2731
- aWindowConstraints.gridy = 0;
2732
- aWindowConstraints.gridwidth = 1;
2733
- // aConstraints.gridheight = 3;
2734
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2735
- aWindowConstraints.weightx = 0;
2736
- aWindowConstraints.weighty = 1;
2737
- bigThree.add(scenePanel, aWindowConstraints);
2738
- aWindowConstraints.weightx = 1;
2739
- aWindowConstraints.gridwidth = 3;
2740
- // aWindowConstraints.gridheight = 3;
2741
- aWindowConstraints.gridx = 1;
2742
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2743
- bigThree.add(centralPanel, aWindowConstraints);
2744
- aWindowConstraints.weightx = 0;
2745
- aWindowConstraints.gridx = 4;
2746
- aWindowConstraints.gridwidth = 1;
2747
- // aWindowConstraints.gridheight = 3;
2748
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2749
- //bigThree.add(XYZPanel, aConstraints);
2750
- 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();
27513359 } else
2752
- if (event.getSource() == sevenButton)
3360
+ if (source == sevenButton)
27533361 {
27543362 radio.layout = sevenButton;
2755
- bigThree.remove(scenePanel);
2756
- bigThree.remove(centralPanel);
2757
- bigThree.remove(XYZPanel);
2758
- aWindowConstraints.gridx = 0;
2759
- aWindowConstraints.gridy = 0;
2760
- aWindowConstraints.gridwidth = 1;
2761
- // aWindowConstraints.gridheight = 3;
2762
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2763
- aWindowConstraints.weightx = 0;
2764
- aWindowConstraints.weighty = 1;
2765
- bigThree.add(scenePanel, aWindowConstraints);
2766
- aWindowConstraints.weightx = 1;
2767
- aWindowConstraints.gridwidth = 3;
2768
- // aWindowConstraints.gridheight = 3;
2769
- aWindowConstraints.gridx = 1;
2770
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2771
- bigThree.add(centralPanel, aWindowConstraints);
2772
- aWindowConstraints.weightx = 0;
2773
- aWindowConstraints.gridx = 4;
2774
- aWindowConstraints.gridwidth = 1;
2775
- // aConstraints.gridheight = 3;
2776
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2777
- bigThree.add(XYZPanel, aWindowConstraints);
2778
- 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();
27793401 } else
2780
- if (event.getSource() == rootButton)
3402
+ if (source == rootButton)
27813403 {
27823404 Object3D obj;
27833405 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2787,66 +3409,84 @@
27873409 EditObject(obj);
27883410 }
27893411
3412
+ cameraView.requestFocusInWindow();
27903413 refreshContents(true);
27913414 } else
2792
- if (event.getSource() == closeButton)
3415
+ if (source == closeButton)
27933416 {
27943417 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27953418 cRadio ab;
27963419 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27973420 {
27983421 ab = (cRadio)e.nextElement();
2799
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3422
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28003423 {
3424
+ // Patch to avoid bug with transparency.
3425
+ if (!ab.hadMaterial)
3426
+ {
3427
+ ab.object.material = null;
3428
+ }
3429
+
28013430 buttonGroup.remove(ab);
28023431 radioPanel.remove(ab);
28033432
2804
- ab.GetObject().editWindow = null;
3433
+ //ab.GetObject().editWindow = null;
3434
+ ab.GetObject().manipWindow = null;
28053435 // ab.GetObject().objectUI = null; // ?????????
28063436
28073437 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28083438 break;
28093439 }
28103440 }
3441
+
3442
+ cameraView.requestFocusInWindow();
28113443 refreshContents(true);
28123444 } else
2813
- if (event.getSource() == editItem || event.getSource() == editButton)
3445
+ if (source == editItem || source == editButton)
28143446 {
3447
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3448
+ {
3449
+ Object3D child = (Object3D)e.nextElement();
3450
+ child.pinned = true;
3451
+ }
3452
+
28153453 EditSelection(false);
28163454 } else
2817
- if (event.getSource() == uneditButton)
3455
+ if (source == uneditButton)
28183456 {
28193457 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28203458 {
28213459 Object3D child = (Object3D)e.nextElement();
28223460 if(child.editWindow != null)
28233461 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3462
+ child.pinned = false;
28243463 child.CloseUI();
28253464 listUI.remove(child);
28263465
2827
- child.editWindow = null; // ???????????
3466
+ //child.editWindow = null; // ???????????
28283467 }
2829
- objEditor.ctrlPanel.revalidate();
3468
+ objEditor.ctrlPanel.FlushUI();
28303469 //objEditor.jTree.clearSelection();
28313470 //objEditor.ResetSliders();
28323471 refreshContents(true);
28333472 } else
2834
- if (event.getSource() == clearPanelButton)
3473
+ if (source == clearPanelButton)
28353474 {
28363475 assert(copy == group);
28373476 //copy.ClearUI();
28383477 for (Object3D obj : listUI)
28393478 {
3479
+ obj.pinned = false;
28403480 obj.CloseUI();
28413481 }
28423482 listUI.clear();
28433483 refreshContents(true);
28443484 } else
2845
- if (event.getSource() == allParamsButton)
3485
+ if (source == allParamsButton)
28463486 {
28473487 assert(copy == group);
28483488
2849
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3489
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28503490
28513491 for (Object3D obj : listUI)
28523492 {
....@@ -2863,19 +3503,19 @@
28633503
28643504 refreshContents(true);
28653505 } else
2866
- if (event.getSource() == unselectButton)
3506
+ if (source == unselectButton)
28673507 {
28683508 objEditor.jTree.clearSelection();
28693509 // ?? oct 2012 GrafreeD.clipboard.clear();
28703510 objEditor.ResetSliders();
28713511 refreshContents(true);
28723512 } else
2873
- if(event.getSource() instanceof cRadio)
3513
+ if(source instanceof cRadio)
28743514 {
28753515 group.parent = keepparent;
28763516 group.attributes = 0;
28773517 //group.editWindow = null;
2878
- /*cRadio*/ radio = (cRadio)event.getSource();
3518
+ /*cRadio*/ radio = (cRadio)source;
28793519 Object3D obj = radio.GetObject();
28803520 System.out.println("Edit " + obj);
28813521 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2895,7 +3535,10 @@
28953535 }
28963536
28973537 copy = group;
2898
- //CameraPane.theRenderer.object = group;
3538
+
3539
+ SetUndoStates();
3540
+
3541
+ //Globals.theRenderer.object = group;
28993542 if(!useclient)
29003543 {
29013544 cameraView.renderCamera = radio.camera;
....@@ -2904,25 +3547,52 @@
29043547 cameraView.cameras[cameraView.cameracount] = radio.camera;
29053548 cameraView.targetLookAt.set(radio.camera.lookAt);
29063549 cameraView.object = group;
2907
- cameraView.lighttouched = true;
3550
+ //cameraView.lighttouched = true;
3551
+ Globals.lighttouched = true;
29083552 topView.object = group;
29093553 frontView.object = group;
29103554 sideView.object = group;
29113555 }
2912
- group.editWindow = this;
3556
+
3557
+// fix "+" issue
3558
+ //group.editWindow = this;
3559
+ group.manipWindow = this;
3560
+
29133561 /*
29143562 currentLayout = radio.layout;
29153563 if (currentLayout == null)
29163564 currentLayout = sevenButton;
29173565 */
29183566 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);
29193574 keepparent = group.parent;
29203575 // PARENT = NULL or not???
29213576 //group.parent = null; // ROOT
29223577 //group.attributes = -1;
29233578 ResetModel();
3579
+
3580
+ cameraView.requestFocusInWindow();
29243581 refreshContents(true);
2925
- }
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
+ }
29263596 else
29273597 {
29283598 //return super.action(event, arg);
....@@ -2931,7 +3601,6 @@
29313601 }
29323602
29333603 boolean useclient = false;
2934
- cRadio radio;
29353604
29363605 void ToggleRoot()
29373606 {
....@@ -2940,7 +3609,7 @@
29403609 if (useclient)
29413610 {
29423611 cameraView.object = client;
2943
- cameraView.lighttouched = true;
3612
+ Globals.lighttouched = true;
29443613 //topView.object = client;
29453614 //frontView.object = client;
29463615 //sideView.object = client;
....@@ -2948,7 +3617,7 @@
29483617 else
29493618 {
29503619 cameraView.object = group;
2951
- cameraView.lighttouched = true;
3620
+ Globals.lighttouched = true;
29523621 //topView.object = group;
29533622 //frontView.object = group;
29543623 //sideView.object = group;
....@@ -2983,6 +3652,28 @@
29833652 refreshContents();
29843653 }
29853654
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
+ }
29863677
29873678 void ResetTransform()
29883679 {
....@@ -3095,7 +3786,7 @@
30953786 refreshContents();
30963787 }
30973788
3098
- void ResetCentroid()
3789
+ void ResetCentroid(boolean full)
30993790 {
31003791 Object3D obj;
31013792 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3110,12 +3801,16 @@
31103801 LA.matIdentity(Object3D.mat);
31113802 obj.getBounds(minima, maxima, false);
31123803 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3113
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3804
+ if (full)
3805
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31143806 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31153807 obj.TransformMesh(Object3D.mat);
3808
+
31163809 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3117
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3810
+ if (full)
3811
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31183812 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3813
+
31193814 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31203815 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31213816 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3144,7 +3839,8 @@
31443839
31453840 int size = obj.MemorySize();
31463841
3147
- 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)");
31483844 }
31493845 }
31503846 catch (Exception e)
....@@ -3181,9 +3877,9 @@
31813877 obj = (Object3D)e.nextElement();
31823878
31833879 System.out.println("Object is: " + obj);
3184
- GrafreeD.AnalyzeObject(obj);
3880
+ Grafreed.AnalyzeObject(obj);
31853881 System.out.println("Boundary rep: " + obj.bRep);
3186
- GrafreeD.AnalyzeObject(obj.bRep);
3882
+ Grafreed.AnalyzeObject(obj.bRep);
31873883
31883884 // System.err.println((size/1024) + " KB is the size of " + obj);
31893885 }
....@@ -3225,6 +3921,13 @@
32253921 void GenNormals(boolean crease)
32263922 {
32273923 group.GenNormalsS(crease);
3924
+
3925
+ refreshContents();
3926
+ }
3927
+
3928
+ void GenNormalsMESH()
3929
+ {
3930
+ group.GenNormalsMeshS();
32283931
32293932 refreshContents();
32303933 }
....@@ -3397,8 +4100,8 @@
33974100
33984101 void ParseVertices()
33994102 {
3400
- boolean epsequal = GrafreeD.epsequal;
3401
- GrafreeD.epsequal = true;
4103
+ boolean epsequal = Grafreed.epsequal;
4104
+ Grafreed.epsequal = true;
34024105
34034106 for (int i=0; i<group.selection.size(); i++)
34044107 {
....@@ -3423,7 +4126,7 @@
34234126 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34244127 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34254128
3426
- g.add(GrafreeD.clipboard);
4129
+ g.add(Grafreed.clipboard);
34274130
34284131 buffer.add(g);
34294132 }
....@@ -3438,7 +4141,7 @@
34384141 makeSomething(buffer, i==group.selection.size()-1);
34394142 }
34404143
3441
- GrafreeD.epsequal = epsequal;
4144
+ Grafreed.epsequal = epsequal;
34424145
34434146 refreshContents();
34444147 }
....@@ -3456,7 +4159,16 @@
34564159 String pigment = Object3D.GetPigment(tex);
34574160 //String bump = Object3D.GetBump(tex);
34584161
3459
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.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
+ }
34604172
34614173 double s = v.s;
34624174
....@@ -3544,11 +4256,11 @@
35444256
35454257 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35464258
3547
- boolean random = CameraPane.RANDOM;
3548
- CameraPane.RANDOM = false; // parse all random nodes
4259
+ boolean random = CameraPane.SWITCH;
4260
+ CameraPane.SWITCH = false; // parse all random nodes
35494261 lowres.linkVerticesThis(null);
35504262 lowres.linkVerticesThis(sn);
3551
- CameraPane.RANDOM = random;
4263
+ CameraPane.SWITCH = random;
35524264
35534265 System.err.flush();
35544266
....@@ -3588,7 +4300,7 @@
35884300 return;
35894301
35904302 Object3D poses = group.selection.get(0);
3591
- Object3D ref = GrafreeD.clipboard.get(0);
4303
+ Object3D ref = Grafreed.clipboard.get(0);
35924304
35934305 Object3D newgroup = new Object3D("Po:" + poses.name);
35944306
....@@ -3757,7 +4469,7 @@
37574469 group.selection.RelinkToSupport(); // july 2014
37584470 System.out.println("DONE.");
37594471 refreshContents();
3760
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4472
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
37614473 }
37624474
37634475 void ReduceMesh(boolean reduction34)
....@@ -3782,9 +4494,9 @@
37824494
37834495 void ClipMesh()
37844496 {
3785
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4497
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37864498 {
3787
- Object3D content = GrafreeD.clipboard.get(0);
4499
+ Object3D content = Grafreed.clipboard.get(0);
37884500
37894501 if (content instanceof cGroup && ((cGroup)content).transientlink )
37904502 content = ((cGroup)content).get(0);
....@@ -3793,7 +4505,7 @@
37934505 // {
37944506 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37954507 // }
3796
- group.selection.ClipMesh(GrafreeD.clipboard);
4508
+ group.selection.ClipMesh(Grafreed.clipboard);
37974509 }
37984510 // group.selection.ClipMesh(GrafreeD.clipboard);
37994511 System.out.println("DONE.");
....@@ -3840,6 +4552,18 @@
38404552 void MarkLeaves(boolean hide)
38414553 {
38424554 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);
38434567 refreshContents();
38444568 }
38454569
....@@ -3914,28 +4638,25 @@
39144638 // }
39154639 // }
39164640
3917
- static boolean allparams = true;
3918
-
3919
- static Vector<Object3D> listUI = new Vector<Object3D>();
3920
-
39214641 void EditSelection(boolean newWindow)
39224642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
39234649 // aConstraints.gridy = 0;
39244650 for (int i=0; i<group.selection.size(); i++)
39254651 {
39264652 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39274653 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3928
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4654
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39294655
39304656 Object3D elem = (Object3D)group.selection.elementAt(i);
3931
- if(elem != group)
4657
+ if(elem != group || !newWindow)
39324658 {
3933
- // if (!(elem instanceof Composite))
3934
- // newWindow = false;
3935
- listUI.add(elem);
3936
- elem.openEditWindow(this, newWindow); //, false);
3937
- System.out.println("edit : " + elem);
3938
- elem.editWindow.refreshContents(true); // ? new
4659
+ EditElement(elem, newWindow); // ? new
39394660 }
39404661 }
39414662 }
....@@ -4010,7 +4731,8 @@
40104731 //new Exception().printStackTrace();
40114732
40124733 freezemodel = true;
4013
-
4734
+ ClearUnpinned();
4735
+
40144736 /**/
40154737 //switch (event.id)
40164738 {
....@@ -4018,7 +4740,6 @@
40184740 //case 702: // Event.LIST_DESELECT
40194741 group.deselectAll();
40204742 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4021
- objEditor.ClearInfo(); // .GetMaterial());
40224743 if (tps != null)
40234744 {
40244745 for (int i=0; i < tps.length; i++)
....@@ -4027,33 +4748,39 @@
40274748
40284749 //if (child.parent != null)
40294750 //child.parent.addSelectee(child);
4751
+ objEditor.SetMaterial(child);
40304752 group.addSelectee(child);
4031
- objEditor.SetMaterial(child); // .GetMaterial());
4032
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4033
- System.err.println("info : " + child.GetPath());
40344753 }
40354754 }
4036
- else
4037
- {
4038
- objEditor.SetMaterial(group); // .GetMaterial());
4039
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4040
- System.err.println("info : " + group.GetPath());
4041
- }
4755
+// else
4756
+// {
4757
+// objEditor.SetMaterial(group); // .GetMaterial());
4758
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4759
+// System.err.println("info : " + group.GetPath());
4760
+// }
40424761
4043
- objEditor.SetText(); // jan 2014
4044
-
4045
- if (flashIt && !CameraPane.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))
40464763 CameraPane.flash = true;
40474764
4048
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4765
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40494766 // a camera
40504767 {
4051
- CameraPane.camerachangeframe = 0; // don't refuse it
4052
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4053
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
4054
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
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
+ }
4773
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4774
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
40554775 }
40564776
4777
+ if (tps != null && tps.length == 1)
4778
+ {
4779
+ EditSelection(false);
4780
+ }
4781
+
4782
+ SetPinStates(tps != null && tps.length > 0);
4783
+
40574784 refreshContents();
40584785 //return true;
40594786 }
....@@ -4062,6 +4789,35 @@
40624789
40634790 freezemodel = false;
40644791 }
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
+ }
40654821
40664822 void linkSomething(Object3D thing)
40674823 {
....@@ -4133,16 +4889,19 @@
41334889 {
41344890 if (group.selection.isEmpty())
41354891 return;
4136
- GrafreeD.clipboardIsTempGroup = false;
4892
+
4893
+ Grafreed.clipboardIsTempGroup = false;
41374894 Composite tGroup = null;
41384895 if (group.selection.size() > 0) // 1)
41394896 {
41404897 tGroup = new cGroup();
4141
- GrafreeD.clipboardIsTempGroup = true;
4898
+ Grafreed.clipboardIsTempGroup = true;
41424899 }
41434900
41444901 if (cut)
41454902 {
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
41464905 //int indices[] = jList.getSelectedIndices();
41474906 //for (int i = indices.length - 1; i >= 0; i--)
41484907 //jList.remove(indices[i]);
....@@ -4178,16 +4937,16 @@
41784937 //System.out.println("cut " + child);
41794938 //System.out.println("parent = " + child.parent);
41804939 // tmp.addChild(child);
4181
- if (GrafreeD.clipboardIsTempGroup)
4940
+ if (Grafreed.clipboardIsTempGroup)
41824941 tGroup.add/*Child*/(tmp);
41834942 else
4184
- GrafreeD.clipboard = tmp;
4943
+ Grafreed.clipboard = tmp;
41854944 }
41864945 else
4187
- if (GrafreeD.clipboardIsTempGroup)
4946
+ if (Grafreed.clipboardIsTempGroup)
41884947 tGroup.add/*Child*/(child);
41894948 else
4190
- GrafreeD.clipboard = child;
4949
+ Grafreed.clipboard = child;
41914950 }
41924951
41934952 //ResetModel();
....@@ -4219,21 +4978,23 @@
42194978 //System.out.println("cut " + elem);
42204979 //System.out.println("parent = " + elem.parent);
42214980 // tmp.addChild(elem);
4222
- if (GrafreeD.clipboardIsTempGroup)
4981
+ if (Grafreed.clipboardIsTempGroup)
42234982 tGroup.add/*Child*/(tmp);
42244983 else
4225
- GrafreeD.clipboard = tmp;
4984
+ Grafreed.clipboard = tmp;
42264985 }
42274986 else
4228
- if (GrafreeD.clipboardIsTempGroup)
4987
+ if (Grafreed.clipboardIsTempGroup)
42294988 tGroup.add/*Child*/(child);
42304989 else
4231
- GrafreeD.clipboard = child;
4990
+ Grafreed.clipboard = child;
42324991 }
42334992
42344993 }
4235
- if (GrafreeD.clipboardIsTempGroup)
4236
- GrafreeD.clipboard = tGroup;
4994
+
4995
+ if (Grafreed.clipboardIsTempGroup)
4996
+ Grafreed.clipboard = tGroup;
4997
+
42374998 if (cut)
42384999 {
42395000 ResetModel();
....@@ -4243,11 +5004,15 @@
42435004
42445005 void paste(boolean expand)
42455006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
42465011 // if (GrafreeD.clipboard == null)
42475012 // return;
42485013 boolean first = true;
42495014
4250
- if (GrafreeD.clipboardIsTempGroup)
5015
+ if (Grafreed.clipboardIsTempGroup)
42515016 {
42525017 Composite temp;
42535018
....@@ -4258,7 +5023,7 @@
42585023 temp = (Composite)Applet3D.clipboard.deepCopy();
42595024 */
42605025 Object3D elem;
4261
- 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))
42625027 {
42635028 Object3D child = (Object3D)e.nextElement();
42645029
....@@ -4292,21 +5057,22 @@
42925057 //Object3D cb = Applet3D.clipboard;
42935058 //temp.addChild(cb);
42945059 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4295
- assert(GrafreeD.clipboard.parent == null);
4296
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4297
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4298
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4299
- 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());
43005065 else
4301
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4302
- GrafreeD.clipboard.get(0).parent = keepparent;
5066
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5067
+ Grafreed.clipboard.get(0).parent = keepparent;
43035068 }
43045069
5070
+ Globals.REPLACEONMAKE = keep;
43055071 ResetModel();
43065072 refreshContents();
43075073 }
43085074
4309
- void pasteInto(boolean copyit)
5075
+ void pasteInto(boolean copyit, boolean clone)
43105076 {
43115077 // if (GrafreeD.clipboard == null)
43125078 // return;
....@@ -4335,15 +5101,22 @@
43355101 if (copyit)
43365102 {
43375103 // paste(false);
4338
- CloneClipboard(false); // sept 2014
5104
+ if (clone)
5105
+ {
5106
+ CloneClipboard(false); // sept 2014
5107
+ }
5108
+ else
5109
+ {
5110
+ paste(false);
5111
+ }
43395112 }
43405113 else
43415114 {
43425115 boolean first = true;
43435116
4344
- if (GrafreeD.clipboardIsTempGroup)
5117
+ if (Grafreed.clipboardIsTempGroup)
43455118 {
4346
- Composite temp = (Composite)GrafreeD.clipboard;
5119
+ Composite temp = (Composite)Grafreed.clipboard;
43475120 Object3D copy;
43485121 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43495122 {
....@@ -4353,7 +5126,7 @@
43535126 }
43545127 } else
43555128 {
4356
- linkSomething(GrafreeD.clipboard); //.get(0));
5129
+ linkSomething(Grafreed.clipboard); //.get(0));
43575130 }
43585131 }
43595132 }
....@@ -4430,6 +5203,10 @@
44305203
44315204 void group(Object3D csg, boolean grab)
44325205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
44335210 if (//false) // why??
44345211 !group.selection.isEmpty())
44355212 {
....@@ -4543,10 +5320,15 @@
45435320 //node.add(csg);
45445321 //makeSomething(node);
45455322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
45465324 }
45475325
45485326 void Ungroup(Object3D g)
45495327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
45505332 if (g instanceof HiddenObject)
45515333 {
45525334 HiddenObject h = (HiddenObject) g;
....@@ -4563,6 +5345,7 @@
45635345 objEditor.makeSomething(g.get(i), false);
45645346 }
45655347 }
5348
+ Globals.REPLACEONMAKE = keep;
45665349 }
45675350
45685351 void ungroup()
....@@ -4758,21 +5541,6 @@
47585541 }
47595542 */
47605543
4761
- void ImportGFD()
4762
- {
4763
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4764
- browser.show();
4765
- String filename = browser.getFile();
4766
- if (filename != null && filename.length() > 0)
4767
- {
4768
- String fullname = browser.getDirectory() + filename;
4769
-
4770
- //Object3D readobj =
4771
- objEditor.ReadGFD(fullname, objEditor);
4772
- //makeSomething(readobj);
4773
- }
4774
- }
4775
-
47765544 /*
47775545 public void Callback(Object obj)
47785546 {
....@@ -4796,26 +5564,9 @@
47965564 }
47975565 */
47985566
4799
- void ImportVRMLX3D()
4800
- {
4801
- if (GrafreeD.standAlone)
4802
- {
4803
- /**/
4804
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4805
- browser.show();
4806
- String filename = browser.getFile();
4807
- if (filename != null && filename.length() > 0)
4808
- {
4809
- String fullname = browser.getDirectory() + filename;
4810
- LoadVRMLX3D(fullname);
4811
- }
4812
- /**/
4813
- }
4814
- }
4815
-
48165567 String GetFile(String dialogName)
48175568 {
4818
- if (GrafreeD.standAlone)
5569
+ if (Grafreed.standAlone)
48195570 {
48205571 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48215572 browser.show();
....@@ -4879,10 +5630,33 @@
48795630 cButton flashSelectionButton;
48805631 cButton editButton;
48815632 cButton uneditButton;
5633
+ JCheckBox allParamsButton;
48825634 cButton clearpanelButton;
4883
- cButton allParamsButton;
48845635 cButton unselectButton;
48855636
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
+
48865660 cButton screenfitButton;
48875661 cButton screenfitpointButton;
48885662 cButton snapobjectButton;
....@@ -4894,14 +5668,6 @@
48945668
48955669 cButton setsupportButton;
48965670
4897
- cButton twoButton;
4898
- cButton sixButton;
4899
- cButton threeButton;
4900
- cButton sevenButton;
4901
- cButton fourButton; // full panel
4902
- cButton oneButton; // full XYZ
4903
- //cButton currentLayout;
4904
-
49055671 //
49065672 //Composite
49075673 Object3D // to do !!
....@@ -4911,9 +5677,11 @@
49115677 //JTree jTree;
49125678 private MenuItem lookAtItem;
49135679 private MenuItem lookFromItem;
4914
- private MenuItem switchItem;
5680
+ private MenuItem switchViewItem;
49155681 private MenuItem cutItem;
4916
- private MenuItem duplicateItem;
5682
+ private MenuItem undoItem;
5683
+ private MenuItem redoItem;
5684
+ private JMenuItem duplicateItem;
49175685 private MenuItem cloneItem;
49185686 private MenuItem cloneSupportItem;
49195687 private MenuItem overwriteGeoItem;
....@@ -4926,7 +5694,7 @@
49265694 private MenuItem linkverticesItem;
49275695 private MenuItem relinkverticesItem;
49285696 private MenuItem setMasterItem;
4929
- private MenuItem resetMeshItem;
5697
+ private MenuItem resetAllItem;
49305698 private MenuItem stepAllItem;
49315699 private MenuItem revertMeshItem;
49325700 private MenuItem poseMeshItem;
....@@ -4937,10 +5705,11 @@
49375705 private MenuItem mergeGeometriesItem;
49385706 private MenuItem copyItem;
49395707 private MenuItem pasteItem;
5708
+ private MenuItem pasteIntoItem;
49405709 private MenuItem pasteLinkItem;
49415710 private MenuItem pasteCloneItem;
49425711 private MenuItem pasteExpandItem;
4943
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
49445713 private MenuItem clearAllItem;
49455714 private MenuItem genUVItem;
49465715 private MenuItem genNormalsMESHItem;
....@@ -4975,6 +5744,10 @@
49755744 private MenuItem showleavesItem;
49765745 private MenuItem markleavesItem;
49775746 private MenuItem unmarkleavesItem;
5747
+ private MenuItem rewindleavesItem;
5748
+ private MenuItem unrewindleavesItem;
5749
+ private MenuItem randomleavesItem;
5750
+ private MenuItem unrandomleavesItem;
49785751
49795752 private MenuItem flipVItem;
49805753 private MenuItem unflipVItem;
....@@ -4986,15 +5759,17 @@
49865759 private MenuItem panoTexturesItem;
49875760
49885761 private MenuItem resetCentroidItem;
4989
- private MenuItem transformgeometryItem;
5762
+ private MenuItem resetCentroidXZItem;
49905763 private MenuItem resetTransformItem;
5764
+ private MenuItem transformGeometryItem;
5765
+ private MenuItem transformChildrenItem;
49915766 private MenuItem hideItem;
49925767 private MenuItem grabItem;
49935768 private MenuItem backItem;
49945769 private MenuItem frontItem;
49955770 private MenuItem cameraItem;
49965771 private MenuItem compositeItem;
4997
- private MenuItem randomItem;
5772
+ private MenuItem switchItem;
49985773 private MenuItem physicsItem;
49995774 private MenuItem frameselectorItem;
50005775 private MenuItem scriptNodeItem;
....@@ -5009,6 +5784,7 @@
50095784
50105785 private MenuItem resetParentItem;
50115786 private MenuItem repairParentItem;
5787
+ private MenuItem repairShadowItem;
50125788 private MenuItem sortbysizeItem;
50135789 private MenuItem sortbynameItem;
50145790
....@@ -5033,7 +5809,7 @@
50335809 private MenuItem blobItem;
50345810 private MenuItem latheItem;
50355811 private MenuItem bezierItem;
5036
- private MenuItem checkerItem;
5812
+ private MenuItem overlayItem;
50375813 private MenuItem meshItem;
50385814 // private MenuItem meshGroupItem;
50395815 private MenuItem springItem;
....@@ -5055,11 +5831,6 @@
50555831 private MenuItem doubleItem;
50565832 private MenuItem tripleItem;
50575833
5058
- private MenuItem importGFDItem;
5059
- private MenuItem importVRMLX3DItem;
5060
- private MenuItem import3DSItem;
5061
- private MenuItem importOBJItem;
5062
-
50635834 private MenuItem computeAOItem;
50645835 private MenuItem recompileItem;
50655836 private MenuItem editScriptItem;
....@@ -5069,4 +5840,8 @@
50695840 private MenuItem analyzeItem;
50705841 private MenuItem dumpItem;
50715842 //boolean freezemodel = false;
5843
+
5844
+ Menu cameraMenu;
5845
+ MenuItem editCameraItem;
5846
+ MenuItem restoreCameraItem;
50725847 }