Normand Briere
2019-07-18 d7a17c35c443e2cb6c09eaa3cfeaf590a571faa1
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,7 +80,13 @@
7380 this.copy = this.group = copy;
7481 //selectees = this.group.selectees;
7582
76
- SetupMenu2(objEditor);
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
89
+ SetupMenu2(this); //objEditor);
7790 SetupUI2(objEditor);
7891 objEditor.SetupUI(true);
7992 SetupViews(objEditor);
....@@ -83,6 +96,10 @@
8396
8497 void CloneSelection(boolean supports)
8598 {
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
86103 // Object3D keep = GrafreeD.clipboard;
87104 //Object3D obj;
88105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +110,19 @@
93110
94111 makeSomething(clone, i==group.selection.size()-1);
95112 }
113
+ Globals.REPLACEONMAKE = keep;
96114 }
97115
98116 void CloneClipboard(boolean supports)
99117 {
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));
118
+ assert(Grafreed.clipboard.parent == null);
119
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
120
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
121
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
122
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105123 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
124
+ makeSomething(CloneObject(Grafreed.clipboard, false));
125
+ Grafreed.clipboard.get(0).parent = keepparent;
108126 }
109127
110128 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +136,7 @@
118136 // obj.support = null;
119137 if (!supports)
120138 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
139
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122140 obj.parent = parent;
123141 // obj.support = support;
124142 // clone.support = support; // aout 2013
....@@ -147,30 +165,29 @@
147165
148166 //JTextField nameField;
149167
150
- void SetupMenu2(ObjEditor oe)
168
+ void SetupMenu2(GroupEditor oe)
151169 {
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);
170
+ oe.jTree = new cTree();
171
+
163172 Menu menu;
164173 oe.menuBar.add(menu = new Menu("Edit"));
165174 //editItem = menu.add(new MenuItem("Edit"));
166175 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
176
+
177
+// undoItem = menu.add(new MenuItem("Undo"));
178
+// undoItem.addActionListener(this);
179
+// redoItem = menu.add(new MenuItem("Redo"));
180
+// redoItem.addActionListener(this);
181
+// menu.add("-");
182
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168183 duplicateItem.addActionListener(this);
169
- menu.add("-");
170184 cloneItem = menu.add(new MenuItem("Clone"));
171185 cloneItem.addActionListener(this);
186
+ if (Globals.ADVANCED)
187
+ {
172188 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173189 cloneSupportItem.addActionListener(this);
190
+ }
174191 menu.add("-");
175192 cutItem = menu.add(new MenuItem("Cut"));
176193 cutItem.addActionListener(this);
....@@ -178,27 +195,123 @@
178195 copyItem.addActionListener(this);
179196 pasteItem = menu.add(new MenuItem("Paste"));
180197 pasteItem.addActionListener(this);
198
+
199
+ menu.add("-");
200
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
201
+ pasteIntoItem.addActionListener(this);
181202 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182203 pasteLinkItem.addActionListener(this);
183204 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184205 pasteCloneItem.addActionListener(this);
185206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186207 // pasteExpandItem.addActionListener(this);
208
+ menu.add("-");
187209 clearItem = menu.add(new MenuItem("Clear"));
188210 clearItem.addActionListener(this);
211
+
212
+ if (Globals.ADVANCED)
213
+ {
214
+ // Deletes the cameras...
189215 clearAllItem = menu.add(new MenuItem("Clear All"));
190216 clearAllItem.addActionListener(this);
217
+ }
218
+
219
+ menuBar.add(cameraMenu = new Menu("View"));
220
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
221
+ //zBufferItem.addActionListener(this);
222
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
223
+ //normalLensItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
226
+
227
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
228
+// toggleFullScreenItem.addItemListener(this);
229
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
230
+// cameraMenu.add("-");
231
+//
232
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
233
+// toggleTextureItem.addItemListener(this);
234
+// toggleTextureItem.setState(CameraPane.textureon);
235
+//
236
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
237
+// toggleSwitchItem.addItemListener(this);
238
+// toggleSwitchItem.setState(CameraPane.SWITCH);
239
+
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
241
+ toggleHandleItem.addItemListener(this);
242
+ toggleHandleItem.setState(CameraPane.HANDLES);
243
+
244
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
245
+ togglePaintItem.addItemListener(this);
246
+ togglePaintItem.setState(CameraPane.PAINTMODE);
247
+
248
+ if (Globals.ADVANCED)
249
+ {
250
+ cameraMenu.add("-");
251
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
252
+ toggleLiveItem.addItemListener(this);
253
+ toggleLiveItem.setState(Globals.isLIVE());
191254
255
+ cameraMenu.add(stepItem = new MenuItem("Step"));
256
+ stepItem.addActionListener(this);
257
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
258
+ // toggleDLItem.addItemListener(this);
259
+ // toggleDLItem.setState(false);
260
+
261
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
262
+ toggleRenderItem.addItemListener(this);
263
+ toggleRenderItem.setState(!CameraPane.frozen);
264
+
265
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
266
+ toggleDebugItem.addItemListener(this);
267
+ toggleDebugItem.setState(Globals.DEBUG);
268
+
269
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
270
+ toggleFrustumItem.addItemListener(this);
271
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
272
+
273
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
274
+ toggleFootContactItem.addItemListener(this);
275
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
276
+
277
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
278
+ toggleTimelineItem.addItemListener(this);
279
+ }
280
+
281
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
282
+// toggleRootItem.addItemListener(this);
283
+// toggleRootItem.setState(false);
284
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
285
+// animationItem.addItemListener(this);
286
+// animationItem.setState(CameraPane.ANIMATION);
287
+ cameraMenu.add("-");
288
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
289
+ editCameraItem.addActionListener(this);
290
+
291
+ if (Globals.ADVANCED)
292
+ {
293
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
294
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
296
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
297
+ oe.cameraMenu.add("-");
298
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
299
+ openWindowItem.addActionListener(this);
300
+ editLeafItem.addActionListener(this);
301
+ lookAtItem.addActionListener(this);
302
+ //lookFromItem.addActinoListener(this);
303
+ //switchViewItem.addActionListener(this);
304
+ }
305
+
192306 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);
307
+ if (Globals.ADVANCED)
308
+ {
197309 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198310 revertMeshItem.addActionListener(this);
199311 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200312 resetreferencesItem.addActionListener(this);
201313 menu.add("-");
314
+ }
202315 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203316 overwriteGeoItem.addActionListener(this);
204317 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,73 +323,104 @@
210323 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211324 overwriteUVItem.addActionListener(this);
212325 menu.add("-");
326
+ if (Globals.ADVANCED)
327
+ {
213328 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214329 generateMeshItem.addActionListener(this);
215330 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216331 poseMeshItem.addActionListener(this);
217332 menu.add("-");
333
+ }
218334 resetsupportItem = menu.add(new MenuItem("Reset support"));
219335 resetsupportItem.addActionListener(this);
220336 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221337 linkverticesItem.addActionListener(this);
338
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
339
+ relinkverticesItem.addActionListener(this);
340
+
341
+ if (Globals.ADVANCED)
342
+ {
222343 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223344 setMasterItem.addActionListener(this);
345
+ }
224346
225347 oe.menuBar.add(menu = new Menu("Group"));
226
- grabItem = menu.add(new MenuItem("Grab"));
227
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
228350 backItem = menu.add(new MenuItem("Back"));
229351 backItem.addActionListener(this);
230352 frontItem = menu.add(new MenuItem("Front"));
231353 frontItem.addActionListener(this);
232
- compositeItem = menu.add(new MenuItem("Composite"));
233
- compositeItem.addActionListener(this);
234
- menu.add("-");
235
- randomItem = menu.add(new MenuItem("Random"));
236
- randomItem.addActionListener(this);
237
- physicsItem = menu.add(new MenuItem("Physics"));
238
- physicsItem.addActionListener(this);
239
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
240
- frameselectorItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
359
+ hideItem = menu.add(new MenuItem("Hidden Group"));
360
+ hideItem.addActionListener(this);
361
+ }
362
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
363
+ ungroupItem.addActionListener(this);
364
+
365
+// menu.add("-");
366
+//
367
+// switchItem = menu.add(new MenuItem("Switch node"));
368
+// switchItem.addActionListener(this);
369
+ if (Globals.ADVANCED)
370
+ {
241371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
242372 switchGeoItem.addActionListener(this);
243373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
244374 switchTransfoItem.addActionListener(this);
245
- morphItem = menu.add(new MenuItem("Morph"));
375
+ morphItem = menu.add(new MenuItem("Morph Group"));
246376 morphItem.addActionListener(this);
377
+
378
+ menu.add("-");
379
+ physicsItem = menu.add(new MenuItem("Physics"));
380
+ physicsItem.addActionListener(this);
381
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
382
+ frameselectorItem.addActionListener(this);
247383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
248384 scriptNodeItem.addActionListener(this);
249
- cameraItem = menu.add(new MenuItem("Camera"));
250
- cameraItem.addActionListener(this);
385
+ }
251386
252387 oe.menuBar.add(menu = new Menu("Object"));
253
- textureItem = menu.add(new MenuItem("Texture"));
254
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
390
+ billboardItem = menu.add(new MenuItem("Billboard"));
391
+ billboardItem.addActionListener(this);
255392 csgItem = menu.add(new MenuItem("CSG"));
256393 csgItem.addActionListener(this);
257
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
258395 shadowXItem.addActionListener(this);
259
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
260397 shadowYItem.addActionListener(this);
261
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
262399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
403
+ if (Globals.ADVANCED)
404
+ {
405
+ menu.add("-");
263406 linkerItem = menu.add(new MenuItem("Linker"));
264407 linkerItem.addActionListener(this);
265408 templateItem = menu.add(new MenuItem("Template"));
266409 templateItem.addActionListener(this);
267
- attributeItem = menu.add(new MenuItem("Attribute"));
268
- attributeItem.addActionListener(this);
269410 pointflowItem = menu.add(new MenuItem("Point Flow"));
270411 pointflowItem.addActionListener(this);
412
+ }
271413 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274414 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275415 resetTransformItem.addActionListener(this);
276416 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277417 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.addActionListener(this);
418
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
419
+ resetCentroidXZItem.addActionListener(this);
420
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
421
+ transformGeometryItem.addActionListener(this);
422
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
423
+ transformChildrenItem.addActionListener(this);
280424
281425 oe.menuBar.add(menu = new Menu("Geometry"));
282426 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -287,6 +431,11 @@
287431 genNormalsCADItem.addActionListener(this);
288432 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
289433 genNormalsMESHItem.addActionListener(this);
434
+ if (Globals.ADVANCED)
435
+ {
436
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
437
+ genNormalsMINEItem.addActionListener(this);
438
+ }
290439 stripifyItem = menu.add(new MenuItem("Stripify"));
291440 stripifyItem.addActionListener(this);
292441 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -308,23 +457,34 @@
308457 reduce34MeshItem.addActionListener(this);
309458 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
310459 increaseMeshItem.addActionListener(this);
311
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
312
- smoothMeshItem.addActionListener(this);
313460 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
314461 clipMeshItem.addActionListener(this);
462
+
463
+ if (Globals.ADVANCED)
464
+ {
465
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
466
+ smoothMeshItem.addActionListener(this);
467
+ }
315468
316469 oe.menuBar.add(menu = new Menu("Attributes"));
317470 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
318471 clearMaterialsItem.addActionListener(this);
472
+ resetAllItem = menu.add(new MenuItem("Reset All"));
473
+ resetAllItem.addActionListener(this);
474
+ stepAllItem = menu.add(new MenuItem("Step All"));
475
+ stepAllItem.addActionListener(this);
319476 menu.add("-");
320477 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
321478 liveleavesItem.addActionListener(this);
322479 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
323480 unliveleavesItem.addActionListener(this);
481
+ if (Globals.ADVANCED)
482
+ {
324483 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
325484 supportleavesItem.addActionListener(this);
326485 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
327486 unsupportleavesItem.addActionListener(this);
487
+ }
328488 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
329489 hideleavesItem.addActionListener(this);
330490 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -333,6 +493,14 @@
333493 markleavesItem.addActionListener(this);
334494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
335495 unmarkleavesItem.addActionListener(this);
496
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
497
+ rewindleavesItem.addActionListener(this);
498
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
499
+ unrewindleavesItem.addActionListener(this);
500
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
501
+ randomleavesItem.addActionListener(this);
502
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
503
+ unrandomleavesItem.addActionListener(this);
336504 menu.add("-");
337505 flipVItem = menu.add(new MenuItem("Flip V"));
338506 flipVItem.addActionListener(this);
....@@ -368,35 +536,41 @@
368536 sortbynameItem = menu.add(new MenuItem("Sort by name"));
369537 sortbynameItem.addActionListener(this);
370538 menu.add("-");
539
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
540
+ shareGeometriesItem.addActionListener(this);
541
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
542
+ mergeGeometriesItem.addActionListener(this);
543
+ if (Globals.ADVANCED)
544
+ {
545
+ // Pretty much the same as duplicate and clone.
371546 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
372547 extractGeometriesItem.addActionListener(this);
373548 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
374549 cloneGeometriesItem.addActionListener(this);
375
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
376
- shareGeometriesItem.addActionListener(this);
377
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
378
- mergeGeometriesItem.addActionListener(this);
550
+ }
379551
380552 oe.menuBar.add(menu = new Menu("Insert"));
381553 buildCreateMenu(menu);
382554
383
-
384
- oe.menuBar.add(menu = new Menu("Include"));
385
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
386
- importGFDItem.addActionListener(this);
387
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
388
- importVRMLX3DItem.addActionListener(this);
389
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
390
- importOBJItem.addActionListener(this);
391
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
392
- import3DSItem.addActionListener(this);
393
-
394555 oe.menuBar.add(menu = new Menu("Tools"));
395556 buildToolsMenu(menu);
396557 }
397558
559
+
398560 void SetupUI2(ObjEditor oe)
399561 {
562
+ // June 2019
563
+ if (oe == null)
564
+ {
565
+ //super.SetupUI2(this);
566
+ //return;
567
+ }
568
+
569
+ if (copy != group)
570
+ {
571
+ //super.SetupUI2(this);
572
+ }
573
+
400574 //new Exception().printStackTrace();
401575
402576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -425,150 +599,230 @@
425599 oe.radioPanel.add(dummyButton);
426600 oe.buttonGroup.add(dummyButton);
427601 */
428
- aConstraints.gridy += 1;
429
- oe.aConstraints.gridwidth = 1;
430
- oe.aConstraints.gridx = 0;
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
431605
432
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
606
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
607
+
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
611
+
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
618
+
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ fullButton.setToolTipText("Full-screen window");
621
+ fullButton.addActionListener(this);
622
+
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ screenfitButton.setToolTipText("Screen fit");
625
+ screenfitButton.addActionListener(this);
626
+
627
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ restoreCameraButton.setToolTipText("Restore viewpoint");
629
+ restoreCameraButton.addActionListener(this);
630
+
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
633
+ saveButton.addActionListener(this);
634
+
635
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ undoButton.setToolTipText("Previous version");
637
+ undoButton.addActionListener(this);
638
+ undoButton.setEnabled(false);
639
+
640
+ cGridBag updown = new cGridBag().setVertical(true);
641
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ restoreButton.setToolTipText("Restore current");
643
+ restoreButton.addActionListener(this);
644
+ restoreButton.setEnabled(false);
645
+
646
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ replaceButton.setToolTipText("Replace current");
648
+ replaceButton.addActionListener(this);
649
+ replaceButton.setEnabled(false);
650
+
651
+ copyOptionsPanel.add(updown);
652
+
653
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ redoButton.setToolTipText("Next version");
655
+ redoButton.addActionListener(this);
656
+ redoButton.setEnabled(false);
657
+
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
659
+ liveCB.setToolTipText("Enable animation");
433660 liveCB.addItemListener(this);
434661
435
- oe.aConstraints.gridx += 1;
436
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
437
- supportCB.addItemListener(this);
438
-
439
- // oe.aConstraints.gridx += 1;
440
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
441
- // localCB.addItemListener(this);
442
-
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
445
- crowdCB.addItemListener(this);
446
-
447
- oe.aConstraints.gridx += 1;
448
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
449
- smoothCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
+ oneStepButton.setToolTipText("Animate one step forward");
664
+ oneStepButton.addActionListener(this);
665
+
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
667
+ fastCB.setToolTipText("Fast mode");
453668 fastCB.addItemListener(this);
454
- oe.aConstraints.gridx += 1;
455
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
456
- slowCB.addItemListener(this);
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
459
- boxCB.addItemListener(this);
669
+
670
+ //oe.toolboxPanel.Return();
671
+
672
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
673
+// trackCB.setToolTipText("Enable tracking");
674
+// trackCB.addItemListener(this);
460675
461
-// oe.aConstraints.gridx += 1;
462
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
463
-// speakerMocapCB.addItemListener(this);
464
-
465
- if (false)
466
- {
467
- // handled in scripts
468
- oe.aConstraints.gridx += 1;
469
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
470
- speakerCameraCB.addItemListener(this);
471
-
472
- oe.aConstraints.gridx += 1;
473
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
474
- speakerFocusCB.addItemListener(this);
475
-
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
478
- smoothfocusCB.addItemListener(this);
479
- }
480
-
481
-//oe.aConstraints.gridx += 1;
482
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
483
-// debugCB.addItemListener(this);
484
-
485
- oe.aConstraints.gridx += 1;
486
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
487
- oeilCB.addItemListener(this);
488
-
489
- oe.aConstraints.gridx += 1;
490
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
491
- lookAtCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
495
- trackCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
499
- screenfitButton.addActionListener(this);
500
- oe.aConstraints.gridx += 1;
501676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
502677 // screenfitpointButton.addActionListener(this);
503
-// oe.aConstraints.gridx += 1;
504
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
505
- snapobjectButton.addActionListener(this);
506
- oe.aConstraints.gridx += 1;
507678
508
- //aConstraints.gridx = 0;
509
- //aConstraints.gridy += 1;
510
- oe.aConstraints.weighty = 0;
511
- oe.aConstraints.gridwidth = 1;
512
-
513
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
514
- flashSelectionButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.aConstraints.weighty = 0;
517
- oe.aConstraints.gridwidth = 1;
679
+ if (Globals.ADVANCED)
680
+ {
681
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ snapobjectButton.addActionListener(this);
683
+ snapobjectButton.setToolTipText("Snap Object");
684
+ }
685
+
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
518687
519
- //
520
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
689
+ twoButton.setToolTipText("Show center view only");
521690 twoButton.addActionListener(this);
522
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
691
+ this.fullscreenLayout = twoButton;
692
+
693
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
523694 fourButton.addActionListener(this);
524
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
695
+ fourButton.setToolTipText("Show left panel only");
696
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697
+ sixButton.setToolTipText("2-column layout left");
525698 sixButton.addActionListener(this);
526
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ threeButton.setToolTipText("2-column layout right");
527701 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
702
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+ sevenButton.setToolTipText("3-column layout");
529704 sevenButton.addActionListener(this);
530705 //
531706
532
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
707
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ rootButton.setToolTipText("Edit selection in new tab");
533709 rootButton.addActionListener(this);
534
- oe.aConstraints.gridx += 1;
535
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
710
+
711
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
712
+ closeButton.setToolTipText("Close tab");
536713 closeButton.addActionListener(this);
537714 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
538715 //clearButton.addActionListener(this);
539
- oe.aConstraints.gridx += 1;
540
-
541
- oe.aConstraints.gridx = 1; //
542
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
543
- editButton.addActionListener(this);
544
- oe.aConstraints.gridx += 1;
545
- oe.aConstraints.weighty = 0;
546
- oe.aConstraints.gridwidth = 1;
547716
548
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
717
+ // INSERT
718
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ gridButton.setToolTipText("Create grid");
720
+ gridButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ boxButton.setToolTipText("Create box");
724
+ boxButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ sphereButton.setToolTipText("Create sphere");
728
+ sphereButton.addActionListener(this);
729
+
730
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
731
+ coneButton.setToolTipText("Create cone");
732
+ coneButton.addActionListener(this);
733
+
734
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
735
+ torusButton.setToolTipText("Create torus");
736
+ torusButton.addActionListener(this);
737
+
738
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
739
+ superButton.setToolTipText("Create superellipsoid");
740
+ superButton.addActionListener(this);
741
+
742
+ if (Globals.ADVANCED)
743
+ {
744
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ kleinButton.setToolTipText("Create Klein bottle");
746
+ kleinButton.addActionListener(this);
747
+ }
748
+
749
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ particlesButton.setToolTipText("Create particle system");
751
+ particlesButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.Return();
754
+
755
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ groupButton.setToolTipText("Create group");
757
+ groupButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ compositeButton.setToolTipText("Create composite");
761
+ compositeButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ switchButton.setToolTipText("Create item switcher");
765
+ switchButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ loopButton.setToolTipText("Create loop");
769
+ loopButton.addActionListener(this);
770
+
771
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
772
+ textureButton.setToolTipText("Create texture");
773
+ textureButton.addActionListener(this);
774
+
775
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
776
+ overlayButton.setToolTipText("Create overlay");
777
+ overlayButton.addActionListener(this);
778
+
779
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ lightButton.setToolTipText("Create light");
781
+ lightButton.addActionListener(this);
782
+
783
+ for (int i=6; --i>=0;)
784
+ {
785
+ oe.toolboxPanel.Return();
786
+ oe.toolboxPanel.add(new cGridBag());
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
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
+ }
794
+
795
+ // EDIT panel
796
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ editButton.setToolTipText("Pin selection controls");
798
+ editButton.addActionListener(this);
799
+
800
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ uneditButton.setToolTipText("Remove selection controls");
549802 uneditButton.addActionListener(this);
550803
551
- oe.aConstraints.gridx += 1;
552
- oe.aConstraints.weighty = 0;
553
- oe.aConstraints.gridwidth = 1;
554
-
555
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
556
- clearPanelButton.addActionListener(this);
557
-
558
- oe.aConstraints.gridx += 1;
559
- oe.aConstraints.weighty = 0;
560
- oe.aConstraints.gridwidth = 1;
561
-
562
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
804
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
805
+ allParamsButton.setToolTipText("Show all controle");
563806 allParamsButton.addActionListener(this);
564807
565
- oe.aConstraints.gridx += 1;
566
- oe.aConstraints.weighty = 0;
567
- oe.aConstraints.gridwidth = 1;
568
-
569
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
808
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ clearPanelButton.setToolTipText("Clear edit panel");
810
+ clearPanelButton.addActionListener(this);
811
+
812
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ unselectButton.setToolTipText("Unselect");
570814 unselectButton.addActionListener(this);
571815
816
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ flashSelectionButton.setToolTipText("Highlight selection");
818
+ flashSelectionButton.addActionListener(this);
819
+
820
+ editCommandsPanel.preferredHeight = 1;
821
+
822
+ SetPinStates(false);
823
+// oe.treePanel.add(commandsPanel);
824
+// oe.treePanel.Return();
825
+
572826 // oe.aConstraints.gridx += 1;
573827 // oe.aConstraints.weighty = 0;
574828 // oe.aConstraints.gridwidth = 1;
....@@ -580,40 +834,25 @@
580834 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
581835 // gcButton.addActionListener(this);
582836
583
- oe.aConstraints.gridx = 0;
584
- oe.aConstraints.gridy += 1;
585
-
586
- //ctrlPanel.add(objList = new List(5, true));
587
- oe.aConstraints.gridwidth = 100;
588
- // oe.aConstraints.gridheight = 100;
589
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
590
- oe.aConstraints.gridheight = 1;
591
- oe.aConstraints.weighty = 0.5;
592
- oe.aConstraints.gridx = 0;
593
- JScrollPane jSP;
837
+ cGridBag jSPPanel = new cGridBag();
838
+
839
+ JScrollPane jSP;
594840 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
595
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
841
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
596842 ResetModel();
597
- oe.aConstraints.weighty = 0.5;
598
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
599
- oe.aConstraints.gridy += 1;
600
- oe.aConstraints.gridwidth = 1;
601
-
602
- oe.aConstraints.weighty = 0;
603
- oe.aConstraints.gridwidth = 2;
604
-
605
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
606
- colorCB.addItemListener(this);
607
- oe.aConstraints.gridx += 2;
608
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
609
- materialCB.addItemListener(this);
610
- oe.aConstraints.gridx += 2;
611
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
612
- textureCB.addItemListener(this);
613
-
614
- oe.aConstraints.gridx = 0;
615
- oe.aConstraints.gridy += 1;
616843
844
+ oe.treePanel.add(jSPPanel);
845
+ oe.treePanel.Return();
846
+
847
+ oe.treePanel.add(copyOptionsPanel);
848
+ oe.treePanel.Return();
849
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
850
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
851
+ sliderPane.preferredHeight = 1;
852
+
853
+// mainPanel.setDividerLocation(0.5); //1.0);
854
+// mainPanel.setResizeWeight(0.5);
855
+
617856 //jList.addListSelectionListener(this);
618857 oe.jTree.addTreeSelectionListener(this);
619858 //jTree.setRootVisible(false);
....@@ -635,20 +874,157 @@
635874 radio.layout = sevenButton;
636875 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
637876 }
877
+
878
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
879
+ {
880
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
881
+ colorCB.setToolTipText("Copy color when dropped");
882
+ colorCB.addItemListener(this);
883
+
884
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
885
+ materialCB.setToolTipText("Copy material when dropped");
886
+ materialCB.addItemListener(this);
887
+
888
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
889
+ textureCB.setToolTipText("Copy texture when dropped");
890
+ textureCB.addItemListener(this);
891
+
892
+ panel.Return();
893
+
894
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
895
+ boxCB.setToolTipText("Display bounding boxes");
896
+ boxCB.addItemListener(this);
897
+
898
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
899
+ zoomBoxCB.setToolTipText("Display only for wheel");
900
+ zoomBoxCB.addItemListener(this);
901
+
902
+ if (true) // Globals.ADVANCED)
903
+ {
904
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
905
+// supportCB.setToolTipText("Enable rigging");
906
+// supportCB.addItemListener(this);
907
+
908
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
909
+ freezeCB.setToolTipText("Fast moving camera");
910
+ freezeCB.addItemListener(this);
911
+
912
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
913
+ // localCB.addItemListener(this);
914
+
915
+ panel.Return();
916
+
917
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
918
+ crowdCB.setToolTipText("Used for crowds");
919
+ crowdCB.addItemListener(this);
920
+
921
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
922
+ smoothCB.setToolTipText("Snapping delay");
923
+ smoothCB.addItemListener(this);
924
+
925
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
926
+ slowCB.setToolTipText("Smooth interpolation");
927
+ slowCB.addItemListener(this);
928
+
929
+// constraints.gridy += 1;
930
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
931
+// speakerMocapCB.addItemListener(this);
932
+
933
+ panel.Return();
934
+
935
+ if (false)
936
+ {
937
+ // handled in scripts
938
+ //constraints.gridy += 1;
939
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
940
+ speakerCameraCB.addItemListener(this);
941
+
942
+ //constraints.gridy += 1;
943
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
944
+ speakerFocusCB.addItemListener(this);
945
+
946
+ //constraints.gridy += 1;
947
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
948
+ smoothfocusCB.addItemListener(this);
949
+ panel.Return();
950
+ }
951
+
952
+//constraints.gridx += 1;
953
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
954
+// debugCB.addItemListener(this);
955
+
956
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
957
+ trackCB.setToolTipText("Enable tracking target");
958
+ trackCB.addItemListener(this);
959
+
960
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
961
+ oeilCB.setToolTipText("Move camera when tracking");
962
+ oeilCB.addItemListener(this);
963
+
964
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
965
+ shadowCB.setToolTipText("When live compute shadows");
966
+ shadowCB.addItemListener(this);
967
+
968
+ panel.Return();
969
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
970
+ toggleTextureCB.setToolTipText("Load textures");
971
+ toggleTextureCB.addItemListener(this);
972
+
973
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
974
+ toggleSwitchCB.setToolTipText("Choose a single item");
975
+ toggleSwitchCB.addItemListener(this);
976
+
977
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
978
+ autokeepCB.setToolTipText("On structure change");
979
+ autokeepCB.addItemListener(this);
980
+
981
+ panel.Return();
982
+ if (Globals.ADVANCED)
983
+ {
984
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
985
+ lookAtCB.setToolTipText("Look-at target");
986
+ lookAtCB.addItemListener(this);
987
+ }
988
+
989
+ }
990
+
991
+ cGridBag fill = new cGridBag();
992
+ fill.preferredHeight = 200;
993
+ cGridBag fill2 = new cGridBag();
994
+ fill2.preferredHeight = 200;
995
+ cGridBag fill3 = new cGridBag();
996
+ fill3.preferredHeight = 200;
997
+
998
+ panel.add(fill);
999
+ panel.add(fill2);
1000
+ panel.add(fill3);
1001
+
1002
+ }
6381003
6391004 void EditObject(Object3D obj)
6401005 {
641
- cRadio dummyButton = new cRadio(obj.name);
642
- dummyButton.SetObject(obj);
643
- dummyButton.layout = sevenButton;
644
- dummyButton.SetCamera(cameraView.renderCamera, false);
645
- dummyButton.addActionListener(this);
646
- radioPanel.add(dummyButton);
647
- buttonGroup.add(dummyButton);
648
- dummyButton.doClick();
1006
+ cRadio radioButton = new cRadio(obj.name);
1007
+
1008
+ // June 2019. Patch to avoid bug with transparency.
1009
+ radioButton.hadMaterial = obj.material != null;
1010
+ if (!radioButton.hadMaterial)
1011
+ {
1012
+ obj.material = new cMaterial();
1013
+ }
1014
+
1015
+ radioButton.SetObject(obj);
1016
+ radioButton.layout = sevenButton;
1017
+ radioButton.SetCamera(cameraView.renderCamera, false);
1018
+ radioButton.addActionListener(this);
1019
+ radioPanel.add(radioButton);
1020
+ buttonGroup.add(radioButton);
1021
+ radioButton.doClick();
6491022 }
1023
+
6501024 void SetupViews(ObjEditor oe)
6511025 {
1026
+ theFrame = this;
1027
+
6521028 oe.SetupViews();
6531029
6541030 System.out.println("SetupViews");
....@@ -657,22 +1033,28 @@
6571033 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6581034 }
6591035
660
- JCheckBox liveCB;
661
- JCheckBox supportCB;
662
- JCheckBox localCB;
663
- JCheckBox crowdCB;
664
- JCheckBox smoothCB;
665
- JCheckBox fastCB;
666
- JCheckBox slowCB;
667
- JCheckBox boxCB;
668
- JCheckBox trackCB;
669
- JCheckBox smoothfocusCB;
1036
+ cToggleButton liveCB;
1037
+ cCheckBox supportCB;
1038
+ cCheckBox localCB;
1039
+ cCheckBox crowdCB;
1040
+ cCheckBox smoothCB;
1041
+ cToggleButton fastCB;
1042
+ cCheckBox slowCB;
1043
+ cCheckBox boxCB;
1044
+ cCheckBox zoomBoxCB;
1045
+ cCheckBox freezeCB;
1046
+ //cToggleButton trackCB;
1047
+ cCheckBox trackCB;
1048
+ cCheckBox smoothfocusCB;
6701049 // JCheckBox speakerMocapCB;
671
- JCheckBox speakerCameraCB;
672
- JCheckBox speakerFocusCB;
673
- JCheckBox debugCB;
674
- JCheckBox oeilCB;
675
- JCheckBox lookAtCB;
1050
+ cCheckBox speakerCameraCB;
1051
+ cCheckBox speakerFocusCB;
1052
+ cCheckBox debugCB;
1053
+
1054
+ cCheckBox oeilCB;
1055
+ cCheckBox shadowCB;
1056
+ cCheckBox autokeepCB;
1057
+ cCheckBox lookAtCB;
6761058
6771059 // static int COLOR = 1;
6781060 // static int MATERIAL = 2;
....@@ -680,9 +1062,9 @@
6801062
6811063 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6821064
683
- JCheckBox colorCB;
684
- JCheckBox materialCB;
685
- JCheckBox textureCB;
1065
+ cCheckBox colorCB;
1066
+ cCheckBox materialCB;
1067
+ cCheckBox textureCB;
6861068
6871069 public void itemStateChanged(ItemEvent e)
6881070 {
....@@ -707,10 +1089,10 @@
7071089 dropAttributes |= Object3D.TEXTURE;
7081090 else
7091091 dropAttributes &= ~Object3D.TEXTURE;
710
- }
711
- else if(e.getSource() == liveCB)
1092
+ } else if(e.getSource() == liveCB)
7121093 {
7131094 cameraView.ToggleLive();
1095
+ refreshContents(false);
7141096 }
7151097 else if(e.getSource() == supportCB)
7161098 {
....@@ -746,6 +1128,10 @@
7461128 cameraView.repaint();
7471129 // refreshContents();
7481130 }
1131
+ else if(e.getSource() == zoomBoxCB)
1132
+ {
1133
+ cameraView.ToggleZoomBoxMode();
1134
+ }
7491135 else if(e.getSource() == smoothfocusCB)
7501136 {
7511137 cameraView.ToggleSmoothFocus();
....@@ -771,6 +1157,18 @@
7711157 {
7721158 cameraView.ToggleOeil();
7731159 }
1160
+ else if(e.getSource() == shadowCB)
1161
+ {
1162
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1163
+ }
1164
+ else if(e.getSource() == freezeCB)
1165
+ {
1166
+ Globals.FREEZEONMOVE ^= true;
1167
+ }
1168
+ else if(e.getSource() == autokeepCB)
1169
+ {
1170
+ Globals.REPLACEONMAKE ^= true;
1171
+ }
7741172 else if(e.getSource() == lookAtCB)
7751173 {
7761174 cameraView.ToggleLookAt();
....@@ -787,7 +1185,8 @@
7871185
7881186 /**/
7891187 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
790
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1188
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ TreePath path = objEditor.jTree.getSelectionPath();
7911190 if ((path == null) || (path.getPathCount() <= 1)) {
7921191 // We can't move the root node or an empty selection
7931192 return;
....@@ -850,8 +1249,6 @@
8501249 }
8511250 }
8521251
853
- String string = (String) object;
854
-
8551252 System.out.println("Transfer = " + object + "; drop : " + target);
8561253 // if( object instanceof java.io.File[])
8571254 // {
....@@ -859,7 +1256,11 @@
8591256 // objEditor.DropFile((java.io.File[]) object, true);
8601257 // return;
8611258 // }
862
- if (string.charAt(0) == '/')
1259
+
1260
+ String string = object.toString();
1261
+
1262
+ // File path for Mac and Windows
1263
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8631264 {
8641265 // file(s)
8651266 String[] names = string.split("\n");
....@@ -886,7 +1287,7 @@
8861287
8871288 flashIt = false;
8881289 CameraPane pane = (CameraPane) target;
889
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1290
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8901291 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8911292
8921293 if (group.selection.size() == 1)
....@@ -902,23 +1303,33 @@
9021303
9031304 assert target == objEditor.jTree;
9041305 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1306
+ Object3D destinationLeaf;
9051307 try {
906
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1308
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9071309 } catch (Exception e) {
9081310 System.out.println("destinationPath : " + destinationPath);
9091311 return;
9101312 }
9111313
912
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1314
+ for (int i=group.selection.size(); --i>=0;)
9131315 {
1316
+ Object3D child = (Object3D)group.selection.elementAt(i);
1317
+
1318
+ // Cannot move into itself
1319
+ if (child == destinationLeaf)
1320
+ return;
1321
+ }
1322
+
1323
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1324
+// {
9141325 loadClipboard(true);
9151326 objEditor.jTree.setSelectionPath(destinationPath);
916
- pasteInto(false);
917
- } else {
918
- loadClipboard(false);
919
- objEditor.jTree.setSelectionPath(destinationPath);
920
- pasteInto(false); // true); // ???
921
- }
1327
+ pasteInto(false, false);
1328
+// } else {
1329
+// loadClipboard(false);
1330
+// objEditor.jTree.setSelectionPath(destinationPath);
1331
+// pasteInto(false, false); // true); // ???
1332
+// }
9221333 }
9231334 public void dropActionChanged(DropTargetDragEvent dtde)
9241335 // Called if the user has modified the current drop gesture
....@@ -1023,83 +1434,107 @@
10231434 {
10241435 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10251436 //heightFieldItem.addActionListener(this);
1026
- gridItem = menu.add(new MenuItem("Grid"));
1027
- gridItem.addActionListener(this);
1028
- rectoidItem = menu.add(new MenuItem("Box"));
1029
- rectoidItem.addActionListener(this);
1030
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1031
- ellipsoidItem.addActionListener(this);
1032
- coneItem = menu.add(new MenuItem("Cone"));
1033
- coneItem.addActionListener(this);
1034
- torusItem = menu.add(new MenuItem("Torus"));
1035
- torusItem.addActionListener(this);
1036
- superItem = menu.add(new MenuItem("Superellipsoid"));
1037
- superItem.addActionListener(this);
1038
- particleItem = menu.add(new MenuItem("Particle system"));
1039
- particleItem.addActionListener(this);
1437
+// gridItem = menu.add(new MenuItem("Grid"));
1438
+// gridItem.addActionListener(this);
1439
+// rectoidItem = menu.add(new MenuItem("Box"));
1440
+// rectoidItem.addActionListener(this);
1441
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1442
+// ellipsoidItem.addActionListener(this);
1443
+// coneItem = menu.add(new MenuItem("Cone"));
1444
+// coneItem.addActionListener(this);
1445
+// torusItem = menu.add(new MenuItem("Torus"));
1446
+// torusItem.addActionListener(this);
1447
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1448
+// superItem.addActionListener(this);
1449
+
1450
+ cameraItem = menu.add(new MenuItem("Camera"));
1451
+ cameraItem.addActionListener(this);
1452
+
1453
+ if (!Globals.ADVANCED)
1454
+ {
1455
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1456
+ kleinItem.addActionListener(this);
1457
+ }
1458
+
1459
+// particleItem = menu.add(new MenuItem("Particle system"));
1460
+// particleItem.addActionListener(this);
1461
+ if (Globals.ADVANCED)
1462
+ {
10401463 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10411464 ragdollItem.addActionListener(this);
10421465 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10431466 ragdoll2Item.addActionListener(this);
1467
+ }
10441468 menu.add("-");
1045
- meshItem = menu.add(new MenuItem("Mesh"));
1469
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10461470 meshItem.addActionListener(this);
10471471 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10481472 // meshGroupItem.addActionListener(this);
1473
+ if (Globals.ADVANCED)
1474
+ {
10491475 springItem = menu.add(new MenuItem("Spring"));
10501476 springItem.addActionListener(this);
10511477 flagItem = menu.add(new MenuItem("Flag"));
10521478 flagItem.addActionListener(this);
1053
- bezierItem = menu.add(new MenuItem("Patch"));
1054
- bezierItem.addActionListener(this);
1055
- checkerItem = menu.add(new MenuItem("Checker"));
1056
- checkerItem.addActionListener(this);
10571479 blobItem = menu.add(new MenuItem("Blob"));
10581480 blobItem.addActionListener(this);
10591481 latheItem = menu.add(new MenuItem("Lathe"));
10601482 latheItem.addActionListener(this);
1061
- lightItem = menu.add(new MenuItem("Light"));
1062
- lightItem.addActionListener(this);
1483
+ }
1484
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1485
+ bezierItem.addActionListener(this);
1486
+// overlayItem = menu.add(new MenuItem("Overlay"));
1487
+// overlayItem.addActionListener(this);
1488
+// lightItem = menu.add(new MenuItem("Light"));
1489
+// lightItem.addActionListener(this);
10631490 menu.add("-");
10641491 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10651492 //superLoopItem.addActionListener(this);
1066
- loopItem = menu.add(new MenuItem("Loop"));
1067
- loopItem.addActionListener(this);
1493
+// loopItem = menu.add(new MenuItem("Loop"));
1494
+// loopItem.addActionListener(this);
10681495 doubleItem = menu.add(new MenuItem("Fork"));
10691496 doubleItem.addActionListener(this);
1497
+ if (Globals.ADVANCED)
1498
+ {
10701499 tripleItem = menu.add(new MenuItem("Trident"));
10711500 tripleItem.addActionListener(this);
1501
+ }
10721502 }
10731503
10741504 void buildToolsMenu(Menu menu)
10751505 {
10761506 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10771507 animationItem.addItemListener(this);
1078
- animationItem.setState(CameraPane.ANIMATION);
1508
+ animationItem.setState(Globals.ANIMATION);
1509
+
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
10791512
10801513 menu.add("-");
10811514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10821515 parseverticesItem.addActionListener(this);
10831516 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10841517 textureFieldItem.addActionListener(this);
1085
- alignItem = menu.add(new MenuItem("Align"));
1518
+ alignItem = menu.add(new MenuItem("Align Objects"));
10861519 alignItem.addActionListener(this);
1087
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1088
- mirrorItem.addActionListener(this);
10891520 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10901521 reduceMorphItem.addActionListener(this);
10911522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10921523 reduce34MorphItem.addActionListener(this);
1093
-
1094
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1095
- computeAOItem.addActionListener(this);
10961524 menu.add("-");
1097
-
10981525 menu.add(memoryItem = new MenuItem("Memory Usage"));
10991526 memoryItem.addActionListener(this);
1527
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1528
+ computeAOItem.addActionListener(this);
1529
+
1530
+ if (Globals.ADVANCED)
1531
+ {
1532
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1533
+ mirrorItem.addActionListener(this);
1534
+ menu.add("-");
11001535 menu.add(analyzeItem = new MenuItem("Analyze"));
11011536 analyzeItem.addActionListener(this);
1102
- menu.add(dumpItem = new MenuItem("Dump"));
1537
+ menu.add(dumpItem = new MenuItem("Print"));
11031538 dumpItem.addActionListener(this);
11041539 // menu.add(pathItem = new MenuItem("From-to path"));
11051540 // pathItem.addActionListener(this);
....@@ -1108,6 +1543,8 @@
11081543 resetParentItem.addActionListener(this);
11091544 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11101545 repairParentItem.addActionListener(this);
1546
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1547
+ repairShadowItem.addActionListener(this);
11111548 menu.add(invariantsItem = new MenuItem("Invariants"));
11121549 invariantsItem.addActionListener(this);
11131550 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1115,6 +1552,7 @@
11151552 menu.add("-");
11161553 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11171554 editScriptItem.addActionListener(this);
1555
+ }
11181556 }
11191557
11201558 void ScreenFit()
....@@ -1237,9 +1675,24 @@
12371675 shadow.material = new cMaterial(obj.material);
12381676 shadow.material.diffuse = 0.0001f;
12391677 shadow.material.specular = 0.0001f;
1678
+ //shadow.projectedVertices[1].x = 300;
12401679
12411680 makeSomething(shadow);
12421681 }
1682
+
1683
+ private void ClearUnpinned()
1684
+ {
1685
+ //for (Object3D obj : listUI)
1686
+ for (int i=listUI.size(); --i>=0;)
1687
+ {
1688
+ Object3D obj = listUI.elementAt(i);
1689
+ if (!obj.pinned)
1690
+ {
1691
+ obj.CloseUI();
1692
+ listUI.remove(i);
1693
+ }
1694
+ }
1695
+ }
12431696
12441697 /**
12451698 * applyExample
....@@ -1443,9 +1896,9 @@
14431896
14441897 void Overwrite(int mask)
14451898 {
1446
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1899
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14471900 {
1448
- Object3D content = GrafreeD.clipboard.get(0);
1901
+ Object3D content = Grafreed.clipboard.get(0);
14491902
14501903 if (content instanceof cGroup && ((cGroup)content).transientlink )
14511904 content = ((cGroup)content).get(0);
....@@ -1468,6 +1921,7 @@
14681921 //
14691922 public void actionPerformed(ActionEvent event) // , Object arg)
14701923 {
1924
+ Object source = event.getSource();
14711925 /*
14721926 if (event.getSource() == nameField)
14731927 {
....@@ -1479,11 +1933,11 @@
14791933 }
14801934 else
14811935 */
1482
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1936
+ if (source == lookAtItem || source == lookFromItem)
14831937 {
14841938 ScreenFit();
14851939 } else
1486
- if (event.getSource() == switchItem)
1940
+ if (source == switchViewItem)
14871941 {
14881942 cVector v1 = new cVector();
14891943 cVector v2 = new cVector();
....@@ -1492,11 +1946,11 @@
14921946 objEditor.cameraView.renderCamera.setAim(v2, v1);
14931947 objEditor.cameraView.repaint();
14941948 } else
1495
- if (event.getSource() == rectoidItem)
1949
+ if (source == rectoidItem || source == boxButton)
14961950 {
14971951 makeSomething(new Box());
14981952 } else
1499
- if (event.getSource() == particleItem)
1953
+ if (source == particleItem || source == particlesButton)
15001954 {
15011955 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15021956 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1517,9 +1971,9 @@
15171971 applyExample(particleGeom, "SMOKE");
15181972 makeSomething(particleGeom);
15191973 } else
1520
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1974
+ if (source == ragdollItem || source == ragdoll2Item)
15211975 {
1522
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1976
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15231977
15241978 ragdoll.toParent = LA.newMatrix();
15251979 ragdoll.fromParent = LA.newMatrix();
....@@ -1537,7 +1991,7 @@
15371991 } else
15381992 /*
15391993 */
1540
- if (event.getSource() == heightFieldItem)
1994
+ if (source == heightFieldItem)
15411995 {
15421996 Object3D obj = new Object3D();
15431997
....@@ -1575,27 +2029,31 @@
15752029
15762030 makeSomething(obj);
15772031 } else
1578
- if (event.getSource() == gridItem)
2032
+ if (source == gridItem || source == gridButton)
15792033 {
15802034 makeSomething(new Grid());
15812035 } else
1582
- if (event.getSource() == ellipsoidItem)
2036
+ if (source == ellipsoidItem || source == sphereButton)
15832037 {
15842038 makeSomething(new Sphere());
15852039 } else
1586
- if (event.getSource() == coneItem)
2040
+ if (source == coneItem || source == coneButton)
15872041 {
15882042 makeSomething(new Cone());
15892043 } else
1590
- if (event.getSource() == torusItem)
2044
+ if (source == torusItem || source == torusButton)
15912045 {
15922046 makeSomething(new Torus());
15932047 } else
1594
- if (event.getSource() == superItem)
2048
+ if (source == superItem || source == superButton)
15952049 {
15962050 makeSomething(new Superellipsoid());
15972051 } else
1598
- if (event.getSource() == blobItem)
2052
+ if (source == kleinItem || source == kleinButton)
2053
+ {
2054
+ makeSomething(new Klein());
2055
+ } else
2056
+ if (source == blobItem)
15992057 {
16002058 Blob blob = new Blob();
16012059 BlobComponent comp = new BlobComponent();
....@@ -1603,15 +2061,15 @@
16032061 //blob.retile();
16042062 makeSomething(blob);
16052063 } else
1606
- if (event.getSource() == latheItem)
2064
+ if (source == latheItem)
16072065 {
16082066 makeSomething(new Lathe());
16092067 } else
1610
- if (event.getSource() == bezierItem)
2068
+ if (source == bezierItem)
16112069 {
16122070 makeSomething(new BezierSurface());
16132071 } else
1614
- if (event.getSource() == checkerItem)
2072
+ if (source == overlayItem || source == overlayButton)
16152073 {
16162074 /*
16172075 Object3D obj = new BezierSurface(5,8);
....@@ -1626,7 +2084,7 @@
16262084 */
16272085 makeSomething(new Checker());
16282086 } else
1629
- if (event.getSource() == meshItem)
2087
+ if (source == meshItem)
16302088 {
16312089 Object3D itemtomake = new Object3D();
16322090 Object3D child;
....@@ -1647,35 +2105,35 @@
16472105 makeSomething(child);
16482106 }
16492107 } else
1650
- if (event.getSource() == springItem)
2108
+ if (source == springItem)
16512109 {
16522110 cSpring s = new cSpring();
16532111 s.setup();
16542112 makeSomething(s);
16552113 } else
1656
- if (event.getSource() == flagItem)
2114
+ if (source == flagItem)
16572115 {
16582116 cSpring s = new cFlag();
16592117 s.setup();
16602118 makeSomething(s);
16612119 } else
1662
- if (event.getSource() == lightItem)
2120
+ if (source == lightItem || source == lightButton)
16632121 {
16642122 makeSomething(new Light());
16652123 } else
1666
- if (event.getSource() == csgItem)
2124
+ if (source == csgItem)
16672125 {
16682126 group(new CSG());
16692127 } else
1670
- if (event.getSource() == templateItem)
2128
+ if (source == templateItem)
16712129 {
16722130 group(new cTemplate());
16732131 } else
1674
- if (event.getSource() == attributeItem)
2132
+ if (source == attributeItem)
16752133 {
16762134 makeSomething(new Attribute());
16772135 } else
1678
- if (event.getSource() == pointflowItem)
2136
+ if (source == pointflowItem)
16792137 {
16802138 makeSomething(new PointFlow());
16812139 } else
....@@ -1687,7 +2145,7 @@
16872145 } else
16882146 */
16892147
1690
- if (event.getSource() == superLoopItem)
2148
+ if (source == superLoopItem)
16912149 {
16922150 Composite g = new cGroup();
16932151 for (int i=0; i<15; i++)
....@@ -1709,30 +2167,30 @@
17092167
17102168 group(g);
17112169 } else
1712
- if (event.getSource() == loopItem)
2170
+ if (source == loopItem || source == loopButton)
17132171 {
17142172 Composite csg = new GroupLeaf();
17152173 csg.count = 5;
17162174 group(csg);
1717
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
17182176 csg.addChild(child);
17192177 child.addChild(csg);
17202178 } else
1721
- if (event.getSource() == doubleItem)
2179
+ if (source == doubleItem)
17222180 {
1723
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
17242182 csg.count = 5;
17252183 group(csg);
1726
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
17272185 csg.addChild(child);
17282186 child.addChild(csg);
1729
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
17302188 csg.addChild(child);
17312189 child.addChild(csg);
17322190 } else
1733
- if (event.getSource() == tripleItem)
2191
+ if (source == tripleItem)
17342192 {
1735
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
17362194 csg.count = 4;
17372195 group(csg);
17382196 Composite child = new cGroup();
....@@ -1745,73 +2203,98 @@
17452203 csg.addChild(child);
17462204 child.addChild(csg);
17472205 } else
1748
-
1749
- if (event.getSource() == importGFDItem)
2206
+ if (source == computeAOItem)
17502207 {
1751
- ImportGFD();
2208
+ Globals.drawMode = CameraPane.OCCLUSION;
2209
+ Globals.theRenderer.repaint();
17522210 } else
1753
- if (event.getSource() == importVRMLX3DItem)
1754
- {
1755
- ImportVRMLX3D();
1756
- } else
1757
- if (event.getSource() == import3DSItem)
1758
- {
1759
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1760
- } else
1761
- if (event.getSource() == importOBJItem)
1762
- {
1763
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1764
- } else
1765
- if (event.getSource() == computeAOItem)
1766
- {
1767
- CameraPane.drawMode = CameraPane.OCCLUSION;
1768
- CameraPane.theRenderer.repaint();
1769
- } else
1770
- if (event.getSource() == recompileItem)
2211
+ if (source == recompileItem)
17712212 {
17722213 Recompile();
17732214 refreshContents();
17742215 } else
1775
- if (event.getSource() == editScriptItem)
2216
+ if (source == editScriptItem)
17762217 {
17772218 OpenDialog();
17782219 refreshContents();
17792220 } else
1780
- if (event.getSource() == invariantsItem)
2221
+ if (source == invariantsItem)
17812222 {
17822223 System.out.println("Invariants:");
1783
- GrafreeD.theApplet3D.universe.invariants();
2224
+ Grafreed.grafreeD.universe.invariants();
17842225 } else
1785
- if (event.getSource() == memoryItem)
2226
+ if (source == memoryItem)
17862227 {
17872228 //System.out.println("Invariants:");
17882229 PrintMemory();
17892230 } else
1790
- if (event.getSource() == pathItem)
2231
+ if (source == pathItem)
17912232 {
17922233 PrintPath();
17932234 } else
1794
- if (event.getSource() == analyzeItem)
2235
+ if (source == analyzeItem)
17952236 {
17962237 AnalyzeObject();
17972238 } else
1798
- if (event.getSource() == dumpItem)
2239
+ if (source == dumpItem)
17992240 {
18002241 DumpObject();
18012242 } else
1802
- if (event.getSource() == screenfitButton)
2243
+ if (source == minButton)
18032244 {
1804
- //Reload(lastConverter, lastFilename, true);
2245
+ Minimize();
2246
+ } else
2247
+ if (source == maxButton)
2248
+ {
2249
+ Maximize();
2250
+ } else
2251
+ if (source == fullButton)
2252
+ {
2253
+ ToggleFullScreen();
2254
+ } else
2255
+ if (source == undoButton)
2256
+ {
2257
+ // Go to previous version
2258
+ //if (!Undo())
2259
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2260
+ Undo();
2261
+ } else
2262
+ if (source == restoreButton)
2263
+ {
2264
+ // Restore current version
2265
+ Restore();
2266
+ } else
2267
+ if (source == replaceButton)
2268
+ {
2269
+ // Overwrite current version
2270
+ Replace();
2271
+ } else
2272
+ if (source == redoButton)
2273
+ {
2274
+ // Go to next version
2275
+ Redo();
2276
+ } else
2277
+ if (source == saveButton)
2278
+ {
2279
+ // Save a new version
2280
+ if (!Save(true))
2281
+ java.awt.Toolkit.getDefaultToolkit().beep();
2282
+ } else
2283
+ if (source == oneStepButton)
2284
+ {
2285
+ Globals.ONESTEP = true;
2286
+ cameraView.repaint();
2287
+ } else
2288
+ if (source == screenfitButton)
2289
+ {
18052290 ScreenFit();
18062291 } else
1807
- if (event.getSource() == screenfitpointButton)
2292
+ if (source == screenfitpointButton)
18082293 {
1809
- //Reload(lastConverter, lastFilename, true);
18102294 ScreenFitPoint();
18112295 } else
1812
- if (event.getSource() == snapobjectButton)
2296
+ if (source == snapobjectButton)
18132297 {
1814
- //Reload(lastConverter, lastFilename, true);
18152298 SnapObject();
18162299 } else
18172300 // if (event.getSource() == recompileButton)
....@@ -1820,13 +2303,13 @@
18202303 // Recompile();
18212304 // refreshContents();
18222305 // } else
1823
- if (event.getSource() == gcButton)
2306
+ if (source == gcButton)
18242307 {
18252308 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262309 System.gc();
18272310 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18282311 } else
1829
- if (event.getSource() == editLeafItem)
2312
+ if (source == editLeafItem)
18302313 {
18312314 Object3D obj;
18322315 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1840,62 +2323,74 @@
18402323 }
18412324 refreshContents(true);
18422325 } else
1843
- if (event.getSource() == openWindowItem)
2326
+ if (source == openWindowItem)
18442327 {
18452328 EditSelection(true);
18462329 } else
1847
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2330
+ if (source == cutItem || source == clearButton)
18482331 {
18492332 loadClipboard(true);
18502333 } else
1851
- if (event.getSource() == duplicateItem)
2334
+ if (source == undoItem)
18522335 {
1853
- Object3D keep = GrafreeD.clipboard;
2336
+ Undo();
2337
+ } else
2338
+ if (source == redoItem)
2339
+ {
2340
+ Redo();
2341
+ } else
2342
+ if (source == duplicateItem)
2343
+ {
2344
+ Object3D keep = Grafreed.clipboard;
18542345 loadClipboard(false);
18552346 paste(false);
1856
- GrafreeD.clipboard = keep;
2347
+ Grafreed.clipboard = keep;
18572348 } else
1858
- if (event.getSource() == cloneItem)
2349
+ if (source == cloneItem)
18592350 {
18602351 CloneSelection(false);
18612352 } else
1862
- if (event.getSource() == cloneSupportItem)
2353
+ if (source == cloneSupportItem)
18632354 {
18642355 CloneSelection(true);
18652356 } else
1866
- if (event.getSource() == copyItem)
2357
+ if (source == copyItem)
18672358 {
18682359 loadClipboard(false);
18692360 } else
1870
- if (event.getSource() == pasteItem)
2361
+ if (source == pasteItem)
18712362 {
18722363 paste(false);
18732364 } else
1874
- if (event.getSource() == pasteLinkItem)
2365
+ if (source == pasteIntoItem)
18752366 {
1876
- pasteInto(false);
2367
+ pasteInto(true, false);
18772368 } else
1878
- if (event.getSource() == pasteCloneItem)
2369
+ if (source == pasteLinkItem)
18792370 {
1880
- pasteInto(true);
2371
+ pasteInto(false, false);
18812372 } else
1882
- if (event.getSource() == pasteExpandItem)
2373
+ if (source == pasteCloneItem)
2374
+ {
2375
+ pasteInto(true, true);
2376
+ } else
2377
+ if (source == pasteExpandItem)
18832378 {
18842379 paste(true);
18852380 } else
1886
- if (event.getSource() == synchronizeItem)
2381
+ if (source == synchronizeItem)
18872382 {
18882383 Overwrite(Object3D.TRANSFORM);
18892384 } else
1890
- if (event.getSource() == overwriteNameItem)
2385
+ if (source == overwriteNameItem)
18912386 {
18922387 Overwrite(Object3D.NAME);
18932388 } else
1894
- if (event.getSource() == overwriteUVItem)
2389
+ if (source == overwriteUVItem)
18952390 {
18962391 Overwrite(Object3D.UV);
18972392 } else
1898
- if (event.getSource() == overwriteMatItem)
2393
+ if (source == overwriteMatItem)
18992394 {
19002395 /* july 2015
19012396 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1915,7 +2410,7 @@
19152410
19162411 Overwrite(dropAttributes);
19172412 }
1918
- if (event.getSource() == overwriteGeoItem)
2413
+ if (source == overwriteGeoItem)
19192414 {
19202415 Overwrite(Object3D.GEOMETRY);
19212416 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1932,7 +2427,7 @@
19322427 // refreshContents();
19332428 // }
19342429 } else
1935
- if (event.getSource() == generateMeshItem)
2430
+ if (source == generateMeshItem)
19362431 {
19372432 //if (group.selection.size() == 1)
19382433 // for (int i=0; i<group.selection.size(); i++)
....@@ -1943,7 +2438,7 @@
19432438 ResetModel();
19442439 refreshContents();
19452440 } else
1946
- if (event.getSource() == extractGeometriesItem)
2441
+ if (source == extractGeometriesItem)
19472442 {
19482443 boolean one = false;
19492444
....@@ -1970,7 +2465,7 @@
19702465 ResetModel();
19712466 refreshContents();
19722467 } else
1973
- if (event.getSource() == cloneGeometriesItem)
2468
+ if (source == cloneGeometriesItem)
19742469 {
19752470 boolean one = false;
19762471
....@@ -1996,32 +2491,37 @@
19962491 ResetModel();
19972492 refreshContents();
19982493 } else
1999
- if (event.getSource() == shareGeometriesItem)
2494
+ if (source == shareGeometriesItem)
20002495 {
20012496 boolean one = false;
20022497
20032498 if (group.selection.size() == 1)
20042499 one = true;
20052500
2501
+ Object3D merge = null;
2502
+
20062503 Object3D content = new cGroup();
20072504
20082505 for (int i=0; i<group.selection.size(); i++)
20092506 {
2010
- Object3D sel = new Merge(group.selection.get(i));
2507
+ merge = new Merge(group.selection.get(i));
20112508
20122509 if (one)
2013
- makeSomething(sel, false);
2510
+ makeSomething(merge, false);
20142511 else
2015
- content.addChild(sel);
2512
+ content.addChild(merge);
20162513 }
20172514
20182515 if (!one)
2019
- makeSomething(content, false);
2020
-
2021
- ResetModel();
2022
- refreshContents();
2516
+ makeSomething(content, true);
2517
+ else
2518
+ {
2519
+ ResetModel();
2520
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2521
+ refreshContents();
2522
+ }
20232523 } else
2024
- if (event.getSource() == mergeGeometriesItem)
2524
+ if (source == mergeGeometriesItem)
20252525 {
20262526 boolean one = false;
20272527
....@@ -2051,7 +2551,7 @@
20512551 ResetModel();
20522552 refreshContents();
20532553 } else
2054
- if (event.getSource() == linkverticesItem)
2554
+ if (source == linkverticesItem)
20552555 {
20562556 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20572557 // {
....@@ -2064,39 +2564,48 @@
20642564 // group.selection.get(0).setMasterThis(content); // should be identity
20652565 // refreshContents();
20662566 // }
2067
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2567
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20682568 {
2069
- Object3D content = GrafreeD.clipboard.get(0);
2569
+ Object3D content = Grafreed.clipboard.get(0);
20702570
20712571 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722572 content = ((cGroup)content).get(0);
20732573
2074
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2574
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20752575 for (int i=0; i<group.selection.size(); i++)
20762576 {
2077
- boolean random = CameraPane.RANDOM;
2078
- CameraPane.RANDOM = false; // parse all random nodes
2577
+ boolean random = CameraPane.SWITCH;
2578
+ CameraPane.SWITCH = false; // parse all random nodes
20792579 group.selection.get(i).linkVerticesThis(content);
20802580 // group.selection.get(i).setMasterThis(content); // should be identity
2081
- CameraPane.RANDOM = random;
2581
+ CameraPane.SWITCH = random;
20822582 }
2083
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2583
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20842584 refreshContents();
20852585 }
20862586 } else
2087
- if (event.getSource() == resetsupportItem)
2587
+ if (source == resetsupportItem)
20882588 {
20892589 for (int i=0; i<group.selection.size(); i++)
20902590 {
2091
- boolean random = CameraPane.RANDOM;
2092
- CameraPane.RANDOM = false; // parse all random nodes
2591
+ boolean random = CameraPane.SWITCH;
2592
+ CameraPane.SWITCH = false; // parse all random nodes
20932593 group.selection.get(i).linkVerticesThis(null);
2094
- CameraPane.RANDOM = random;
2594
+ CameraPane.SWITCH = random;
20952595 }
20962596
20972597 refreshContents();
20982598 } else
2099
- if (event.getSource() == resetreferencesItem)
2599
+ if (source == relinkverticesItem)
2600
+ {
2601
+ boolean random = CameraPane.SWITCH;
2602
+ CameraPane.SWITCH = false; // parse all random nodes
2603
+ group.selection.RelinkToSupport();
2604
+ CameraPane.SWITCH = random;
2605
+
2606
+ refreshContents();
2607
+ } else
2608
+ if (source == resetreferencesItem)
21002609 {
21012610 for (int i=0; i<group.selection.size(); i++)
21022611 {
....@@ -2105,11 +2614,11 @@
21052614
21062615 refreshContents();
21072616 } else
2108
- if (event.getSource() == setMasterItem)
2617
+ if (source == setMasterItem)
21092618 {
2110
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2619
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21112620 {
2112
- Object3D content = GrafreeD.clipboard.get(0);
2621
+ Object3D content = Grafreed.clipboard.get(0);
21132622
21142623 if (content instanceof cGroup && ((cGroup)content).transientlink )
21152624 content = ((cGroup)content).get(0);
....@@ -2118,13 +2627,13 @@
21182627 refreshContents();
21192628 }
21202629 } else
2121
- if (event.getSource() == poseMeshItem)
2630
+ if (source == poseMeshItem)
21222631 {
21232632 if (group.selection.size() == 1)
21242633 {
2125
- if (GrafreeD.clipboard.size() == 1)
2634
+ if (Grafreed.clipboard.size() == 1)
21262635 {
2127
- Object3D content = GrafreeD.clipboard.get(0);
2636
+ Object3D content = Grafreed.clipboard.get(0);
21282637
21292638 if (content instanceof cGroup && ((cGroup)content).transientlink )
21302639 content = ((cGroup)content).get(0);
....@@ -2137,19 +2646,19 @@
21372646 }
21382647
21392648 } else
2140
- if (event.getSource() == revertMeshItem)
2649
+ if (source == revertMeshItem)
21412650 {
21422651 RevertMeshes();
21432652 } else
2144
- if (event.getSource() == resetMeshItem)
2653
+ if (source == resetAllItem)
21452654 {
21462655 ResetAll();
21472656 } else
2148
- if (event.getSource() == stepAllItem)
2657
+ if (source == stepAllItem)
21492658 {
21502659 StepAll();
21512660 } else
2152
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2661
+ if (source == clearItem) // || event.getSource() == clearButton)
21532662 {
21542663 //int indices[] = jList.getSelectedIndices();
21552664 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2157,42 +2666,46 @@
21572666
21582667 ClearSelection(false);
21592668 } else
2160
- if (event.getSource() == clearAllItem)
2669
+ if (source == clearAllItem)
21612670 {
21622671 ClearSelection(true);
21632672 } else
2164
- if (event.getSource() == grabItem)
2673
+ if (source == grabItem || source == groupButton)
21652674 {
2166
- group(new cGroup(), true);
2675
+ group(new cGroup(), false); // true);
21672676 } else
2168
- if (event.getSource() == frontItem)
2677
+ if (source == hideItem)
2678
+ {
2679
+ group(new HiddenObject());
2680
+ } else
2681
+ if (source == frontItem)
21692682 {
21702683 front();
21712684 } else
2172
- if (event.getSource() == backItem)
2685
+ if (source == backItem)
21732686 {
21742687 back();
21752688 } else
2176
- if (event.getSource() == cameraItem)
2689
+ if (source == cameraItem)
21772690 {
21782691 makeSomething(new Camera());
21792692 } else
2180
- if (event.getSource() == compositeItem)
2693
+ if (source == compositeItem || source == compositeButton)
21812694 {
21822695 group(new Composite());
21832696 } else
2184
- if (event.getSource() == randomItem)
2697
+ if (source == switchItem || source == switchButton)
21852698 {
21862699 RandomNode random = new RandomNode();
21872700 group(random);
21882701 if (random.size() > 0)
2189
- random.name = random.get(0).name + "Rnd";
2702
+ random.name = random.get(0).name + "Switch";
21902703 } else
2191
- if (event.getSource() == physicsItem)
2704
+ if (source == physicsItem)
21922705 {
21932706 group(new PhysicsNode());
21942707 } else
2195
- if (event.getSource() == frameselectorItem)
2708
+ if (source == frameselectorItem)
21962709 {
21972710 for (int i=0; i<group.selection.size(); i++)
21982711 {
....@@ -2204,7 +2717,7 @@
22042717 ResetModel();
22052718 refreshContents();
22062719 } else
2207
- if (event.getSource() == switchGeoItem)
2720
+ if (source == switchGeoItem)
22082721 {
22092722 for (int i=0; i<group.selection.size(); i++)
22102723 {
....@@ -2216,7 +2729,7 @@
22162729 ResetModel();
22172730 refreshContents();
22182731 } else
2219
- if (event.getSource() == switchTransfoItem)
2732
+ if (source == switchTransfoItem)
22202733 {
22212734 for (int i=0; i<group.selection.size(); i++)
22222735 {
....@@ -2228,7 +2741,7 @@
22282741 ResetModel();
22292742 refreshContents();
22302743 } else
2231
- if (event.getSource() == morphItem)
2744
+ if (source == morphItem)
22322745 {
22332746 for (int i=0; i<group.selection.size(); i++)
22342747 {
....@@ -2240,7 +2753,7 @@
22402753 ResetModel();
22412754 refreshContents();
22422755 } else
2243
- if (event.getSource() == scriptNodeItem)
2756
+ if (source == scriptNodeItem)
22442757 {
22452758 boolean atleastone = false;
22462759
....@@ -2279,199 +2792,252 @@
22792792 }
22802793 }
22812794 } else
2282
- if (event.getSource() == linkerItem)
2795
+ if (source == linkerItem)
22832796 {
22842797 group(new cLinker());
22852798 } else
2286
- if (event.getSource() == textureItem)
2799
+ if (source == textureItem || source == textureButton)
22872800 {
22882801 group(new TextureNode());
22892802 } else
2290
- if (event.getSource() == shadowXItem)
2803
+ if (source == billboardItem)
2804
+ {
2805
+ group(new BillboardNode());
2806
+ } else
2807
+ if (source == shadowXItem)
22912808 {
22922809 CastShadow(0);
22932810 } else
2294
- if (event.getSource() == shadowYItem)
2811
+ if (source == shadowYItem)
22952812 {
22962813 CastShadow(1);
22972814 } else
2298
- if (event.getSource() == shadowZItem)
2815
+ if (source == shadowZItem)
22992816 {
23002817 CastShadow(2);
23012818 } else
2302
- if (event.getSource() == ungroupItem)
2819
+ if (source == ungroupItem || source == ungroupButton)
23032820 {
2304
- ungroup();
2821
+ boolean hasRoot = false;
2822
+
2823
+ for (int i=0; i<group.selection.size(); i++)
2824
+ {
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
2830
+ }
2831
+
2832
+ if (!hasRoot)
2833
+ {
2834
+ for (int i=0; i<group.selection.size(); i++)
2835
+ {
2836
+ Ungroup(group.selection.get(i));
2837
+ }
2838
+
2839
+ ClearSelection(false);
2840
+
2841
+ refreshContents();
2842
+ }
23052843 } else
2306
- if (event.getSource() == genUVItem)
2844
+ if (source == genUVItem)
23072845 {
23082846 GenUV();
23092847 } else
2310
- if (event.getSource() == genNormalsCADItem)
2848
+ if (source == genNormalsCADItem)
23112849 {
23122850 GenNormals(true);
23132851 } else
2314
- if (event.getSource() == genNormalsMESHItem)
2852
+ if (source == genNormalsMESHItem)
23152853 {
2316
- GenNormals(true); // TODO
2854
+ GenNormalsMESH();
23172855 } else
2318
- if (event.getSource() == genNormalsORGANItem)
2856
+ if (source == genNormalsORGANItem)
23192857 {
23202858 GenNormals(false);
23212859 } else
2322
- if (event.getSource() == stripifyItem)
2860
+ if (source == genNormalsMINEItem)
2861
+ {
2862
+ GenNormalsMINE();
2863
+ } else
2864
+ if (source == stripifyItem)
23232865 {
23242866 Stripify();
23252867 } else
2326
- if (event.getSource() == unstripifyItem)
2868
+ if (source == unstripifyItem)
23272869 {
23282870 Unstripify();
23292871 } else
2330
- if (event.getSource() == trimItem)
2872
+ if (source == trimItem)
23312873 {
23322874 Trim();
23332875 } else
2334
- if (event.getSource() == untrimItem)
2876
+ if (source == untrimItem)
23352877 {
23362878 Untrim();
23372879 } else
2338
- if (event.getSource() == clearColorsItem)
2880
+ if (source == clearColorsItem)
23392881 {
23402882 ClearColors();
23412883 } else
2342
- if (event.getSource() == clearMaterialsItem)
2884
+ if (source == clearMaterialsItem)
23432885 {
23442886 ClearMaterials();
23452887 } else
2346
- if (event.getSource() == liveleavesItem)
2888
+ if (source == liveleavesItem)
23472889 {
23482890 LiveLeaves(true);
23492891 } else
2350
- if (event.getSource() == unliveleavesItem)
2892
+ if (source == unliveleavesItem)
23512893 {
23522894 LiveLeaves(false);
23532895 } else
2354
- if (event.getSource() == supportleavesItem)
2896
+ if (source == supportleavesItem)
23552897 {
23562898 SupportLeaves(true);
23572899 } else
2358
- if (event.getSource() == unsupportleavesItem)
2900
+ if (source == unsupportleavesItem)
23592901 {
23602902 SupportLeaves(false);
23612903 } else
2362
- if (event.getSource() == hideleavesItem)
2904
+ if (source == hideleavesItem)
23632905 {
23642906 HideLeaves(true);
23652907 } else
2366
- if (event.getSource() == showleavesItem)
2908
+ if (source == showleavesItem)
23672909 {
23682910 HideLeaves(false);
23692911 } else
2370
- if (event.getSource() == markleavesItem)
2912
+ if (source == markleavesItem)
23712913 {
23722914 MarkLeaves(true);
23732915 } else
2374
- if (event.getSource() == unmarkleavesItem)
2916
+ if (source == unmarkleavesItem)
23752917 {
23762918 MarkLeaves(false);
23772919 } else
2378
- if (event.getSource() == flipVItem)
2920
+ if (source == rewindleavesItem)
2921
+ {
2922
+ RewindLeaves(true);
2923
+ } else
2924
+ if (source == unrewindleavesItem)
2925
+ {
2926
+ RewindLeaves(false);
2927
+ } else
2928
+ if (source == randomleavesItem)
2929
+ {
2930
+ RandomLeaves(true);
2931
+ } else
2932
+ if (source == unrandomleavesItem)
2933
+ {
2934
+ RandomLeaves(false);
2935
+ } else
2936
+ if (source == flipVItem)
23792937 {
23802938 FlipV(true);
23812939 } else
2382
- if (event.getSource() == unflipVItem)
2940
+ if (source == unflipVItem)
23832941 {
23842942 FlipV(false);
23852943 } else
2386
- if (event.getSource() == lowTexturesItem)
2944
+ if (source == lowTexturesItem)
23872945 {
23882946 SetTexRes(0);
23892947 } else
2390
- if (event.getSource() == normalTexturesItem)
2948
+ if (source == normalTexturesItem)
23912949 {
23922950 SetTexRes(1);
23932951 } else
2394
- if (event.getSource() == highTexturesItem)
2952
+ if (source == highTexturesItem)
23952953 {
23962954 SetTexRes(2);
23972955 } else
2398
- if (event.getSource() == veryhighTexturesItem)
2956
+ if (source == veryhighTexturesItem)
23992957 {
24002958 SetTexRes(3);
24012959 } else
2402
- if (event.getSource() == maxTexturesItem)
2960
+ if (source == maxTexturesItem)
24032961 {
24042962 SetTexRes(4);
24052963 } else
2406
- if (event.getSource() == panoTexturesItem)
2964
+ if (source == panoTexturesItem)
24072965 {
24082966 SetTexRes(5);
24092967 } else
2410
- if (event.getSource() == reverseNormalsItem)
2968
+ if (source == reverseNormalsItem)
24112969 {
24122970 ReverseNormals();
24132971 } else
2414
- if (event.getSource() == parseverticesItem)
2972
+ if (source == parseverticesItem)
24152973 {
24162974 ParseVertices();
24172975 } else
2418
- if (event.getSource() == textureFieldItem)
2976
+ if (source == textureFieldItem)
24192977 {
24202978 TextureVertices();
24212979 } else
2422
- if (event.getSource() == alignItem)
2980
+ if (source == alignItem)
24232981 {
24242982 Align();
24252983 } else
2426
- if (event.getSource() == mirrorItem)
2984
+ if (source == mirrorItem)
24272985 {
24282986 MirrorPoses();
24292987 } else
2430
- if (event.getSource() == reduceMorphItem)
2988
+ if (source == reduceMorphItem)
24312989 {
24322990 MeshReduction(false);
24332991 } else
2434
- if (event.getSource() == reduce34MorphItem)
2992
+ if (source == reduce34MorphItem)
24352993 {
24362994 MeshReduction(true);
24372995 } else
2438
- if (event.getSource() == reverseTrianglesItem)
2996
+ if (source == reverseTrianglesItem)
24392997 {
24402998 ReverseTriangles();
24412999 } else
2442
- if (event.getSource() == reduceMeshItem)
3000
+ if (source == reduceMeshItem)
24433001 {
24443002 ReduceMesh(false);
24453003 } else
2446
- if (event.getSource() == reduce34MeshItem)
3004
+ if (source == reduce34MeshItem)
24473005 {
24483006 ReduceMesh(true);
24493007 } else
2450
- if (event.getSource() == increaseMeshItem)
3008
+ if (source == increaseMeshItem)
24513009 {
24523010 IncreaseMesh();
24533011 } else
2454
- if (event.getSource() == clipMeshItem)
3012
+ if (source == clipMeshItem)
24553013 {
24563014 ClipMesh();
24573015 } else
2458
- if (event.getSource() == smoothMeshItem)
3016
+ if (source == smoothMeshItem)
24593017 {
24603018 SmoothMesh();
24613019 } else
2462
- if (event.getSource() == transformgeometryItem)
3020
+ if (source == transformGeometryItem)
24633021 {
24643022 TransformGeometry();
24653023 } else
2466
- if (event.getSource() == resetTransformItem)
3024
+ if (source == transformChildrenItem)
3025
+ {
3026
+ TransformChildren();
3027
+ } else
3028
+ if (source == resetTransformItem)
24673029 {
24683030 ResetTransform();
24693031 } else
2470
- if (event.getSource() == resetCentroidItem)
3032
+ if (source == resetCentroidItem)
24713033 {
2472
- ResetCentroid();
3034
+ ResetCentroid(true);
24733035 } else
2474
- if (event.getSource() == resetParentItem)
3036
+ if (source == resetCentroidXZItem)
3037
+ {
3038
+ ResetCentroid(false);
3039
+ } else
3040
+ if (source == resetParentItem)
24753041 {
24763042 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24773043 {
....@@ -2481,7 +3047,7 @@
24813047
24823048 refreshContents();
24833049 } else
2484
- if (event.getSource() == repairParentItem)
3050
+ if (source == repairParentItem)
24853051 {
24863052 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24873053 {
....@@ -2495,7 +3061,21 @@
24953061
24963062 refreshContents();
24973063 } else
2498
- if (event.getSource() == sortbysizeItem)
3064
+ if (source == repairShadowItem)
3065
+ {
3066
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3067
+ {
3068
+ Object3D obj = (Object3D)e.nextElement();
3069
+ obj.RepairShadow();
3070
+// for (int i=0; i<obj.size(); i++)
3071
+// {
3072
+// obj.get(i).parent = obj;
3073
+// }
3074
+ }
3075
+
3076
+ refreshContents();
3077
+ } else
3078
+ if (source == sortbysizeItem)
24993079 {
25003080 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25013081 {
....@@ -2507,7 +3087,7 @@
25073087 ResetModel();
25083088 refreshContents();
25093089 } else
2510
- if (event.getSource() == sortbynameItem)
3090
+ if (source == sortbynameItem)
25113091 {
25123092 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25133093 {
....@@ -2519,7 +3099,7 @@
25193099 ResetModel();
25203100 refreshContents();
25213101 } else
2522
- if (event.getSource() == attachPigmentItem)
3102
+ if (source == attachPigmentItem)
25233103 {
25243104 String texture = GetFile("Attach pigment");
25253105 Object3D obj;
....@@ -2531,7 +3111,7 @@
25313111
25323112 refreshContents();
25333113 } else
2534
- if (event.getSource() == detachPigmentItem)
3114
+ if (source == detachPigmentItem)
25353115 {
25363116 Object3D obj;
25373117 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2542,7 +3122,7 @@
25423122
25433123 refreshContents();
25443124 } else
2545
- if (event.getSource() == attachBumpItem)
3125
+ if (source == attachBumpItem)
25463126 {
25473127 String texture = GetFile("Attach bump");
25483128 Object3D obj;
....@@ -2554,7 +3134,7 @@
25543134
25553135 refreshContents();
25563136 } else
2557
- if (event.getSource() == detachBumpItem)
3137
+ if (source == detachBumpItem)
25583138 {
25593139 Object3D obj;
25603140 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2565,7 +3145,7 @@
25653145
25663146 refreshContents();
25673147 } else
2568
- if (event.getSource() == pigmentBumpItem)
3148
+ if (source == pigmentBumpItem)
25693149 {
25703150 Object3D obj;
25713151 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2576,158 +3156,237 @@
25763156
25773157 refreshContents();
25783158 } else
2579
- if (event.getSource() == flashSelectionButton)
3159
+ if (source == flashSelectionButton)
25803160 {
25813161 CameraPane.flash = true;
25823162 refreshContents();
25833163 } else
2584
- if (event.getSource() == oneButton)
3164
+ if (source == oneButton)
25853165 {
25863166 } else
2587
- if (event.getSource() == twoButton)
3167
+ if (source == twoButton)
25883168 {
25893169 radio.layout = twoButton;
3170
+
3171
+ if (CameraPane.FULLSCREEN)
3172
+ fullscreenLayout = radio.layout;
3173
+
25903174 // bug
25913175 //gridPanel.setDividerLocation(1.0);
25923176 //bigPanel.setDividerLocation(0.0);
2593
- bigThree.remove(jtp);
2594
- bigThree.remove(cameraPanel);
2595
- bigThree.remove(XYZPanel);
2596
- aWindowConstraints.gridx = 0;
2597
- aWindowConstraints.gridy = 0;
2598
- aWindowConstraints.gridwidth = 1;
2599
- // aConstraints.gridheight = 3;
2600
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2601
- aWindowConstraints.weightx = 0;
2602
- aWindowConstraints.weighty = 1;
2603
- //bigThree.add(jtp, aWindowConstraints);
2604
- aWindowConstraints.weightx = 1;
2605
- aWindowConstraints.gridwidth = 3;
2606
- // aConstraints.gridheight = 3;
2607
- aWindowConstraints.gridx = 1;
2608
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2609
- bigThree.add(cameraPanel, aWindowConstraints);
2610
- aWindowConstraints.weightx = 0;
2611
- aWindowConstraints.gridx = 4;
2612
- aWindowConstraints.gridwidth = 1;
2613
- // aConstraints.gridheight = 3;
2614
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2615
- //bigThree.add(XYZPanel, aWindowConstraints);
2616
- bigThree.revalidate();
3177
+// bigThree.remove(scenePanel);
3178
+// bigThree.remove(centralPanel);
3179
+// bigThree.remove(XYZPanel);
3180
+// aWindowConstraints.gridx = 0;
3181
+// aWindowConstraints.gridy = 0;
3182
+// aWindowConstraints.gridwidth = 1;
3183
+// // aConstraints.gridheight = 3;
3184
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3185
+// aWindowConstraints.weightx = 0;
3186
+// aWindowConstraints.weighty = 1;
3187
+// //bigThree.add(jtp, aWindowConstraints);
3188
+// aWindowConstraints.weightx = 1;
3189
+// aWindowConstraints.gridwidth = 3;
3190
+// // aConstraints.gridheight = 3;
3191
+// aWindowConstraints.gridx = 1;
3192
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3193
+// bigThree.add(centralPanel, aWindowConstraints);
3194
+// aWindowConstraints.weightx = 0;
3195
+// aWindowConstraints.gridx = 4;
3196
+// aWindowConstraints.gridwidth = 1;
3197
+// // aConstraints.gridheight = 3;
3198
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3199
+// //bigThree.add(XYZPanel, aWindowConstraints);
3200
+// scenePanel.setVisible(false);
3201
+// centralPanel.setVisible(true);
3202
+// XYZPanel.setVisible(false);
3203
+ bigThree.ClearUI();
3204
+ bigThree.add(centralPanel);
3205
+ bigThree.FlushUI();
3206
+
3207
+ cameraView.requestFocusInWindow();
3208
+
3209
+// refreshContents(true);
3210
+//
3211
+// try
3212
+// {
3213
+// java.awt.Robot bot = new java.awt.Robot();
3214
+// int mask = InputEvent.BUTTON1_MASK;
3215
+// bot.mouseMove(100, 100);
3216
+// bot.mousePress(mask);
3217
+// bot.mouseRelease(mask);
3218
+// }
3219
+// catch (Exception e)
3220
+// {
3221
+//
3222
+// }
3223
+
26173224 } else
2618
- if (event.getSource() == threeButton)
3225
+ if (source == threeButton)
26193226 {
26203227 radio.layout = threeButton;
2621
- bigThree.remove(jtp);
2622
- bigThree.remove(cameraPanel);
2623
- bigThree.remove(XYZPanel);
2624
- aWindowConstraints.gridx = 0;
2625
- aWindowConstraints.gridy = 0;
2626
- aWindowConstraints.gridwidth = 1;
2627
- // aConstraints.gridheight = 3;
2628
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2629
- aWindowConstraints.weightx = 0;
2630
- aWindowConstraints.weighty = 1;
2631
- //bigThree.add(jtp, aWindowConstraints);
2632
- aWindowConstraints.weightx = 1;
2633
- aWindowConstraints.gridwidth = 3;
2634
- // aConstraints.gridheight = 3;
2635
- aWindowConstraints.gridx = 1;
2636
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2637
- bigThree.add(cameraPanel, aWindowConstraints);
2638
- aWindowConstraints.weightx = 0;
2639
- aWindowConstraints.gridx = 4;
2640
- aWindowConstraints.gridwidth = 1;
2641
- // aConstraints.gridheight = 3;
2642
- aConstraints.fill = GridBagConstraints.VERTICAL;
2643
- bigThree.add(XYZPanel, aWindowConstraints);
2644
- bigThree.revalidate();
3228
+
3229
+ if (CameraPane.FULLSCREEN)
3230
+ fullscreenLayout = radio.layout;
3231
+
3232
+// bigThree.remove(scenePanel);
3233
+// bigThree.remove(centralPanel);
3234
+// bigThree.remove(XYZPanel);
3235
+// aWindowConstraints.gridx = 0;
3236
+// aWindowConstraints.gridy = 0;
3237
+// aWindowConstraints.gridwidth = 1;
3238
+// // aConstraints.gridheight = 3;
3239
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3240
+// aWindowConstraints.weightx = 0;
3241
+// aWindowConstraints.weighty = 1;
3242
+// //bigThree.add(jtp, aWindowConstraints);
3243
+// aWindowConstraints.weightx = 1;
3244
+// aWindowConstraints.gridwidth = 3;
3245
+// // aConstraints.gridheight = 3;
3246
+// aWindowConstraints.gridx = 1;
3247
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3248
+// bigThree.add(centralPanel, aWindowConstraints);
3249
+// aWindowConstraints.weightx = 0;
3250
+// aWindowConstraints.gridx = 4;
3251
+// aWindowConstraints.gridwidth = 1;
3252
+// // aConstraints.gridheight = 3;
3253
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3254
+// bigThree.add(XYZPanel, aWindowConstraints);
3255
+// bigThree.validate();
3256
+// scenePanel.setVisible(false);
3257
+// centralPanel.setVisible(true);
3258
+// XYZPanel.setVisible(true);
3259
+ bigThree.ClearUI();
3260
+ bigThree.add(centralPanel);
3261
+ bigThree.add(XYZPanel);
3262
+ bigThree.FlushUI();
3263
+
3264
+ cameraView.requestFocusInWindow();
26453265 } else
2646
- if (event.getSource() == fourButton)
3266
+ if (source == fourButton)
26473267 {
26483268 radio.layout = fourButton;
2649
- bigThree.remove(jtp);
2650
- bigThree.remove(cameraPanel);
2651
- bigThree.remove(XYZPanel);
2652
- aWindowConstraints.gridx = 0;
2653
- aWindowConstraints.gridy = 0;
2654
- aWindowConstraints.gridwidth = 1;
2655
- // aWindowConstraints.gridheight = 3;
2656
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2657
- aWindowConstraints.weightx = 1;
2658
- aWindowConstraints.weighty = 1;
2659
- bigThree.add(jtp, aWindowConstraints);
2660
- aWindowConstraints.weightx = 1;
2661
- aWindowConstraints.gridwidth = 3;
2662
- // aConstraints.gridheight = 3;
2663
- aWindowConstraints.gridx = 1;
2664
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2665
- //bigThree.add(cameraPanel, aWindowConstraints);
2666
- aWindowConstraints.weightx = 0;
2667
- aWindowConstraints.gridx = 4;
2668
- aWindowConstraints.gridwidth = 1;
2669
- // aWindowConstraints.gridheight = 3;
2670
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2671
- //bigThree.add(XYZPanel, aWindowConstraints);
2672
- bigThree.revalidate();
3269
+
3270
+ if (CameraPane.FULLSCREEN)
3271
+ fullscreenLayout = radio.layout;
3272
+
3273
+// bigThree.remove(scenePanel);
3274
+// bigThree.remove(centralPanel);
3275
+// bigThree.remove(XYZPanel);
3276
+// aWindowConstraints.gridx = 0;
3277
+// aWindowConstraints.gridy = 0;
3278
+// aWindowConstraints.gridwidth = 1;
3279
+// // aWindowConstraints.gridheight = 3;
3280
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3281
+// aWindowConstraints.weightx = 1;
3282
+// aWindowConstraints.weighty = 1;
3283
+// bigThree.add(scenePanel, aWindowConstraints);
3284
+// aWindowConstraints.weightx = 1;
3285
+// aWindowConstraints.gridwidth = 3;
3286
+// // aConstraints.gridheight = 3;
3287
+// aWindowConstraints.gridx = 1;
3288
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3289
+// //bigThree.add(cameraPanel, aWindowConstraints);
3290
+// aWindowConstraints.weightx = 0;
3291
+// aWindowConstraints.gridx = 4;
3292
+// aWindowConstraints.gridwidth = 1;
3293
+// // aWindowConstraints.gridheight = 3;
3294
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3295
+// //bigThree.add(XYZPanel, aWindowConstraints);
3296
+// bigThree.validate();
3297
+// scenePanel.setVisible(true);
3298
+// centralPanel.setVisible(false);
3299
+// XYZPanel.setVisible(false);
3300
+ bigThree.ClearUI();
3301
+ bigThree.add(scenePanel);
3302
+ bigThree.FlushUI();
3303
+
3304
+ cameraView.requestFocusInWindow();
26733305 } else
2674
- if (event.getSource() == sixButton)
3306
+ if (source == sixButton)
26753307 {
26763308 radio.layout = sixButton;
2677
- bigThree.remove(jtp);
2678
- bigThree.remove(cameraPanel);
2679
- bigThree.remove(XYZPanel);
2680
- aWindowConstraints.gridx = 0;
2681
- aWindowConstraints.gridy = 0;
2682
- aWindowConstraints.gridwidth = 1;
2683
- // aConstraints.gridheight = 3;
2684
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2685
- aWindowConstraints.weightx = 0;
2686
- aWindowConstraints.weighty = 1;
2687
- bigThree.add(jtp, aWindowConstraints);
2688
- aWindowConstraints.weightx = 1;
2689
- aWindowConstraints.gridwidth = 3;
2690
- // aWindowConstraints.gridheight = 3;
2691
- aWindowConstraints.gridx = 1;
2692
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2693
- bigThree.add(cameraPanel, aWindowConstraints);
2694
- aWindowConstraints.weightx = 0;
2695
- aWindowConstraints.gridx = 4;
2696
- aWindowConstraints.gridwidth = 1;
2697
- // aWindowConstraints.gridheight = 3;
2698
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2699
- //bigThree.add(XYZPanel, aConstraints);
2700
- bigThree.revalidate();
3309
+
3310
+ if (CameraPane.FULLSCREEN)
3311
+ fullscreenLayout = radio.layout;
3312
+
3313
+// bigThree.remove(scenePanel);
3314
+// bigThree.remove(centralPanel);
3315
+// bigThree.remove(XYZPanel);
3316
+// aWindowConstraints.gridx = 0;
3317
+// aWindowConstraints.gridy = 0;
3318
+// aWindowConstraints.gridwidth = 1;
3319
+// // aConstraints.gridheight = 3;
3320
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3321
+// aWindowConstraints.weightx = 0;
3322
+// aWindowConstraints.weighty = 1;
3323
+// bigThree.add(scenePanel, aWindowConstraints);
3324
+// aWindowConstraints.weightx = 1;
3325
+// aWindowConstraints.gridwidth = 3;
3326
+// // aWindowConstraints.gridheight = 3;
3327
+// aWindowConstraints.gridx = 1;
3328
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3329
+// bigThree.add(centralPanel, aWindowConstraints);
3330
+// aWindowConstraints.weightx = 0;
3331
+// aWindowConstraints.gridx = 4;
3332
+// aWindowConstraints.gridwidth = 1;
3333
+// // aWindowConstraints.gridheight = 3;
3334
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3335
+// //bigThree.add(XYZPanel, aConstraints);
3336
+// bigThree.validate();
3337
+// scenePanel.setVisible(true);
3338
+// centralPanel.setVisible(true);
3339
+// XYZPanel.setVisible(false);
3340
+ bigThree.ClearUI();
3341
+ bigThree.add(scenePanel);
3342
+ bigThree.add(centralPanel);
3343
+ bigThree.FlushUI();
3344
+
3345
+ cameraView.requestFocusInWindow();
27013346 } else
2702
- if (event.getSource() == sevenButton)
3347
+ if (source == sevenButton)
27033348 {
27043349 radio.layout = sevenButton;
2705
- bigThree.remove(jtp);
2706
- bigThree.remove(cameraPanel);
2707
- bigThree.remove(XYZPanel);
2708
- aWindowConstraints.gridx = 0;
2709
- aWindowConstraints.gridy = 0;
2710
- aWindowConstraints.gridwidth = 1;
2711
- // aWindowConstraints.gridheight = 3;
2712
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2713
- aWindowConstraints.weightx = 0;
2714
- aWindowConstraints.weighty = 1;
2715
- bigThree.add(jtp, aWindowConstraints);
2716
- aWindowConstraints.weightx = 1;
2717
- aWindowConstraints.gridwidth = 3;
2718
- // aWindowConstraints.gridheight = 3;
2719
- aWindowConstraints.gridx = 1;
2720
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2721
- bigThree.add(cameraPanel, aWindowConstraints);
2722
- aWindowConstraints.weightx = 0;
2723
- aWindowConstraints.gridx = 4;
2724
- aWindowConstraints.gridwidth = 1;
2725
- // aConstraints.gridheight = 3;
2726
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2727
- bigThree.add(XYZPanel, aWindowConstraints);
2728
- bigThree.revalidate();
3350
+
3351
+ if (CameraPane.FULLSCREEN)
3352
+ fullscreenLayout = radio.layout;
3353
+
3354
+// bigThree.remove(scenePanel);
3355
+// bigThree.remove(centralPanel);
3356
+// bigThree.remove(XYZPanel);
3357
+// aWindowConstraints.gridx = 0;
3358
+// aWindowConstraints.gridy = 0;
3359
+// aWindowConstraints.gridwidth = 1;
3360
+// // aWindowConstraints.gridheight = 3;
3361
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3362
+// aWindowConstraints.weightx = 0;
3363
+// aWindowConstraints.weighty = 1;
3364
+// bigThree.add(scenePanel, aWindowConstraints);
3365
+// aWindowConstraints.weightx = 1;
3366
+// aWindowConstraints.gridwidth = 3;
3367
+// // aWindowConstraints.gridheight = 3;
3368
+// aWindowConstraints.gridx = 1;
3369
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3370
+// bigThree.add(centralPanel, aWindowConstraints);
3371
+// aWindowConstraints.weightx = 0;
3372
+// aWindowConstraints.gridx = 4;
3373
+// aWindowConstraints.gridwidth = 1;
3374
+// // aConstraints.gridheight = 3;
3375
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3376
+// bigThree.add(XYZPanel, aWindowConstraints);
3377
+// bigThree.validate();
3378
+// scenePanel.setVisible(true);
3379
+// centralPanel.setVisible(true);
3380
+// XYZPanel.setVisible(true);
3381
+ bigThree.ClearUI();
3382
+ bigThree.add(scenePanel);
3383
+ bigThree.add(centralPanel);
3384
+ bigThree.add(XYZPanel);
3385
+ bigThree.FlushUI();
3386
+
3387
+ cameraView.requestFocusInWindow();
27293388 } else
2730
- if (event.getSource() == rootButton)
3389
+ if (source == rootButton)
27313390 {
27323391 Object3D obj;
27333392 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2737,66 +3396,84 @@
27373396 EditObject(obj);
27383397 }
27393398
3399
+ cameraView.requestFocusInWindow();
27403400 refreshContents(true);
27413401 } else
2742
- if (event.getSource() == closeButton)
3402
+ if (source == closeButton)
27433403 {
27443404 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27453405 cRadio ab;
27463406 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27473407 {
27483408 ab = (cRadio)e.nextElement();
2749
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3409
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27503410 {
3411
+ // Patch to avoid bug with transparency.
3412
+ if (!ab.hadMaterial)
3413
+ {
3414
+ ab.object.material = null;
3415
+ }
3416
+
27513417 buttonGroup.remove(ab);
27523418 radioPanel.remove(ab);
27533419
2754
- ab.GetObject().editWindow = null;
3420
+ //ab.GetObject().editWindow = null;
3421
+ ab.GetObject().manipWindow = null;
27553422 // ab.GetObject().objectUI = null; // ?????????
27563423
27573424 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
27583425 break;
27593426 }
27603427 }
3428
+
3429
+ cameraView.requestFocusInWindow();
27613430 refreshContents(true);
27623431 } else
2763
- if (event.getSource() == editItem || event.getSource() == editButton)
3432
+ if (source == editItem || source == editButton)
27643433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
27653440 EditSelection(false);
27663441 } else
2767
- if (event.getSource() == uneditButton)
3442
+ if (source == uneditButton)
27683443 {
27693444 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27703445 {
27713446 Object3D child = (Object3D)e.nextElement();
27723447 if(child.editWindow != null)
27733448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
27743450 child.CloseUI();
27753451 listUI.remove(child);
27763452
2777
- child.editWindow = null; // ???????????
3453
+ //child.editWindow = null; // ???????????
27783454 }
2779
- objEditor.ctrlPanel.revalidate();
3455
+ objEditor.ctrlPanel.FlushUI();
27803456 //objEditor.jTree.clearSelection();
27813457 //objEditor.ResetSliders();
27823458 refreshContents(true);
27833459 } else
2784
- if (event.getSource() == clearPanelButton)
3460
+ if (source == clearPanelButton)
27853461 {
27863462 assert(copy == group);
27873463 //copy.ClearUI();
27883464 for (Object3D obj : listUI)
27893465 {
3466
+ obj.pinned = false;
27903467 obj.CloseUI();
27913468 }
27923469 listUI.clear();
27933470 refreshContents(true);
27943471 } else
2795
- if (event.getSource() == allParamsButton)
3472
+ if (source == allParamsButton)
27963473 {
27973474 assert(copy == group);
27983475
2799
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28003477
28013478 for (Object3D obj : listUI)
28023479 {
....@@ -2813,19 +3490,19 @@
28133490
28143491 refreshContents(true);
28153492 } else
2816
- if (event.getSource() == unselectButton)
3493
+ if (source == unselectButton)
28173494 {
28183495 objEditor.jTree.clearSelection();
28193496 // ?? oct 2012 GrafreeD.clipboard.clear();
28203497 objEditor.ResetSliders();
28213498 refreshContents(true);
28223499 } else
2823
- if(event.getSource() instanceof cRadio)
3500
+ if(source instanceof cRadio)
28243501 {
28253502 group.parent = keepparent;
28263503 group.attributes = 0;
28273504 //group.editWindow = null;
2828
- /*cRadio*/ radio = (cRadio)event.getSource();
3505
+ /*cRadio*/ radio = (cRadio)source;
28293506 Object3D obj = radio.GetObject();
28303507 System.out.println("Edit " + obj);
28313508 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2845,7 +3522,10 @@
28453522 }
28463523
28473524 copy = group;
2848
- //CameraPane.theRenderer.object = group;
3525
+
3526
+ SetUndoStates();
3527
+
3528
+ //Globals.theRenderer.object = group;
28493529 if(!useclient)
28503530 {
28513531 cameraView.renderCamera = radio.camera;
....@@ -2854,25 +3534,52 @@
28543534 cameraView.cameras[cameraView.cameracount] = radio.camera;
28553535 cameraView.targetLookAt.set(radio.camera.lookAt);
28563536 cameraView.object = group;
2857
- cameraView.lighttouched = true;
3537
+ //cameraView.lighttouched = true;
3538
+ Globals.lighttouched = true;
28583539 topView.object = group;
28593540 frontView.object = group;
28603541 sideView.object = group;
28613542 }
2862
- group.editWindow = this;
3543
+
3544
+// fix "+" issue
3545
+ //group.editWindow = this;
3546
+ group.manipWindow = this;
3547
+
28633548 /*
28643549 currentLayout = radio.layout;
28653550 if (currentLayout == null)
28663551 currentLayout = sevenButton;
28673552 */
28683553 radio.layout.doClick();
3554
+
3555
+ ClearUnpinned();
3556
+ Grafreed.Assert(group != null);
3557
+ Grafreed.Assert(group.selection != null);
3558
+ SetPinStates(group.selection.size() > 0);
3559
+ if (group.selection.size() == 1)
3560
+ EditSelection(false);
28693561 keepparent = group.parent;
28703562 // PARENT = NULL or not???
28713563 //group.parent = null; // ROOT
28723564 //group.attributes = -1;
28733565 ResetModel();
3566
+
3567
+ cameraView.requestFocusInWindow();
28743568 refreshContents(true);
2875
- }
3569
+ } else if (event.getSource() == editCameraItem)
3570
+ {
3571
+ cameraView.ProtectCamera();
3572
+ cameraView.repaint();
3573
+ return;
3574
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3575
+ {
3576
+ cameraView.RevertCamera();
3577
+ cameraView.repaint();
3578
+ return;
3579
+ // } else if (event.getSource() == textureButton)
3580
+ // {
3581
+ // return; // true;
3582
+ }
28763583 else
28773584 {
28783585 //return super.action(event, arg);
....@@ -2881,7 +3588,6 @@
28813588 }
28823589
28833590 boolean useclient = false;
2884
- cRadio radio;
28853591
28863592 void ToggleRoot()
28873593 {
....@@ -2890,7 +3596,7 @@
28903596 if (useclient)
28913597 {
28923598 cameraView.object = client;
2893
- cameraView.lighttouched = true;
3599
+ Globals.lighttouched = true;
28943600 //topView.object = client;
28953601 //frontView.object = client;
28963602 //sideView.object = client;
....@@ -2898,7 +3604,7 @@
28983604 else
28993605 {
29003606 cameraView.object = group;
2901
- cameraView.lighttouched = true;
3607
+ Globals.lighttouched = true;
29023608 //topView.object = group;
29033609 //frontView.object = group;
29043610 //sideView.object = group;
....@@ -2933,6 +3639,28 @@
29333639 refreshContents();
29343640 }
29353641
3642
+ void TransformChildren()
3643
+ {
3644
+ Object3D obj;
3645
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3646
+ {
3647
+ obj = (Object3D)e.nextElement();
3648
+ obj.KeepTextureMatrices();
3649
+ obj.TransformChildren();
3650
+ obj.RestoreTextureMatrices();
3651
+
3652
+// if (obj.parent == null)
3653
+// {
3654
+// System.out.println("NULL PARENT!");
3655
+// new Exception().printStackTrace();
3656
+// }
3657
+// else
3658
+// TouchTransform(obj);
3659
+// //obj.parent.Touch();
3660
+ }
3661
+
3662
+ refreshContents();
3663
+ }
29363664
29373665 void ResetTransform()
29383666 {
....@@ -3045,7 +3773,7 @@
30453773 refreshContents();
30463774 }
30473775
3048
- void ResetCentroid()
3776
+ void ResetCentroid(boolean full)
30493777 {
30503778 Object3D obj;
30513779 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3060,12 +3788,16 @@
30603788 LA.matIdentity(Object3D.mat);
30613789 obj.getBounds(minima, maxima, false);
30623790 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3063
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3791
+ if (full)
3792
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30643793 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30653794 obj.TransformMesh(Object3D.mat);
3795
+
30663796 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3067
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3797
+ if (full)
3798
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30683799 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3800
+
30693801 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30703802 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30713803 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3094,7 +3826,8 @@
30943826
30953827 int size = obj.MemorySize();
30963828
3097
- System.err.println((size/1024) + " KB is the size of " + obj);
3829
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3830
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30983831 }
30993832 }
31003833 catch (Exception e)
....@@ -3131,9 +3864,9 @@
31313864 obj = (Object3D)e.nextElement();
31323865
31333866 System.out.println("Object is: " + obj);
3134
- GrafreeD.AnalyzeObject(obj);
3867
+ Grafreed.AnalyzeObject(obj);
31353868 System.out.println("Boundary rep: " + obj.bRep);
3136
- GrafreeD.AnalyzeObject(obj.bRep);
3869
+ Grafreed.AnalyzeObject(obj.bRep);
31373870
31383871 // System.err.println((size/1024) + " KB is the size of " + obj);
31393872 }
....@@ -3175,6 +3908,20 @@
31753908 void GenNormals(boolean crease)
31763909 {
31773910 group.GenNormalsS(crease);
3911
+
3912
+ refreshContents();
3913
+ }
3914
+
3915
+ void GenNormalsMESH()
3916
+ {
3917
+ group.GenNormalsMeshS();
3918
+
3919
+ refreshContents();
3920
+ }
3921
+
3922
+ void GenNormalsMINE()
3923
+ {
3924
+ group.selection.GenNormalsMINE();
31783925
31793926 refreshContents();
31803927 }
....@@ -3340,8 +4087,8 @@
33404087
33414088 void ParseVertices()
33424089 {
3343
- boolean epsequal = GrafreeD.epsequal;
3344
- GrafreeD.epsequal = true;
4090
+ boolean epsequal = Grafreed.epsequal;
4091
+ Grafreed.epsequal = true;
33454092
33464093 for (int i=0; i<group.selection.size(); i++)
33474094 {
....@@ -3366,7 +4113,7 @@
33664113 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33674114 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33684115
3369
- g.add(GrafreeD.clipboard);
4116
+ g.add(Grafreed.clipboard);
33704117
33714118 buffer.add(g);
33724119 }
....@@ -3381,7 +4128,7 @@
33814128 makeSomething(buffer, i==group.selection.size()-1);
33824129 }
33834130
3384
- GrafreeD.epsequal = epsequal;
4131
+ Grafreed.epsequal = epsequal;
33854132
33864133 refreshContents();
33874134 }
....@@ -3399,7 +4146,16 @@
33994146 String pigment = Object3D.GetPigment(tex);
34004147 //String bump = Object3D.GetBump(tex);
34014148
3402
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4149
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4150
+
4151
+ try
4152
+ {
4153
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4154
+ }
4155
+ catch (Exception e)
4156
+ {
4157
+ System.err.println("FAIL: " + node);
4158
+ }
34034159
34044160 double s = v.s;
34054161
....@@ -3447,12 +4203,26 @@
34474203
34484204 void Align()
34494205 {
4206
+ if (group.selection.size() == 0)
4207
+ return;
4208
+
4209
+ cVector bbmin = new cVector();
4210
+ cVector bbmax = new cVector();
4211
+
4212
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4213
+
4214
+ double dx = bbmax.x - bbmin.x;
4215
+ double dy = bbmax.y - bbmin.y;
4216
+ double dz = bbmax.z - bbmin.z;
4217
+
4218
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4219
+
34504220 for (int i=0; i<group.selection.size(); i++)
34514221 {
34524222 Object3D obj = group.selection.get(i);
34534223
3454
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3455
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4224
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4225
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34564226 }
34574227
34584228 refreshContents();
....@@ -3473,11 +4243,11 @@
34734243
34744244 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34754245
3476
- boolean random = CameraPane.RANDOM;
3477
- CameraPane.RANDOM = false; // parse all random nodes
4246
+ boolean random = CameraPane.SWITCH;
4247
+ CameraPane.SWITCH = false; // parse all random nodes
34784248 lowres.linkVerticesThis(null);
34794249 lowres.linkVerticesThis(sn);
3480
- CameraPane.RANDOM = random;
4250
+ CameraPane.SWITCH = random;
34814251
34824252 System.err.flush();
34834253
....@@ -3517,7 +4287,7 @@
35174287 return;
35184288
35194289 Object3D poses = group.selection.get(0);
3520
- Object3D ref = GrafreeD.clipboard.get(0);
4290
+ Object3D ref = Grafreed.clipboard.get(0);
35214291
35224292 Object3D newgroup = new Object3D("Po:" + poses.name);
35234293
....@@ -3686,7 +4456,7 @@
36864456 group.selection.RelinkToSupport(); // july 2014
36874457 System.out.println("DONE.");
36884458 refreshContents();
3689
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4459
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
36904460 }
36914461
36924462 void ReduceMesh(boolean reduction34)
....@@ -3711,9 +4481,9 @@
37114481
37124482 void ClipMesh()
37134483 {
3714
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4484
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37154485 {
3716
- Object3D content = GrafreeD.clipboard.get(0);
4486
+ Object3D content = Grafreed.clipboard.get(0);
37174487
37184488 if (content instanceof cGroup && ((cGroup)content).transientlink )
37194489 content = ((cGroup)content).get(0);
....@@ -3722,7 +4492,7 @@
37224492 // {
37234493 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37244494 // }
3725
- group.selection.ClipMesh(GrafreeD.clipboard);
4495
+ group.selection.ClipMesh(Grafreed.clipboard);
37264496 }
37274497 // group.selection.ClipMesh(GrafreeD.clipboard);
37284498 System.out.println("DONE.");
....@@ -3769,6 +4539,18 @@
37694539 void MarkLeaves(boolean hide)
37704540 {
37714541 group.selection.MarkLeaves(hide);
4542
+ refreshContents();
4543
+ }
4544
+
4545
+ void RewindLeaves(boolean hide)
4546
+ {
4547
+ group.selection.RewindLeaves(hide);
4548
+ refreshContents();
4549
+ }
4550
+
4551
+ void RandomLeaves(boolean hide)
4552
+ {
4553
+ group.selection.RandomLeaves(hide);
37724554 refreshContents();
37734555 }
37744556
....@@ -3843,10 +4625,6 @@
38434625 // }
38444626 // }
38454627
3846
- static boolean allparams = true;
3847
-
3848
- static Vector<Object3D> listUI = new Vector<Object3D>();
3849
-
38504628 void EditSelection(boolean newWindow)
38514629 {
38524630 // aConstraints.gridy = 0;
....@@ -3854,10 +4632,10 @@
38544632 {
38554633 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
38564634 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3857
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4635
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38584636
38594637 Object3D elem = (Object3D)group.selection.elementAt(i);
3860
- if(elem != group)
4638
+ if(elem != group || !newWindow)
38614639 {
38624640 // if (!(elem instanceof Composite))
38634641 // newWindow = false;
....@@ -3939,7 +4717,8 @@
39394717 //new Exception().printStackTrace();
39404718
39414719 freezemodel = true;
3942
-
4720
+ ClearUnpinned();
4721
+
39434722 /**/
39444723 //switch (event.id)
39454724 {
....@@ -3947,7 +4726,6 @@
39474726 //case 702: // Event.LIST_DESELECT
39484727 group.deselectAll();
39494728 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3950
- objEditor.ClearInfo(); // .GetMaterial());
39514729 if (tps != null)
39524730 {
39534731 for (int i=0; i < tps.length; i++)
....@@ -3956,33 +4734,39 @@
39564734
39574735 //if (child.parent != null)
39584736 //child.parent.addSelectee(child);
4737
+ objEditor.SetMaterial(child);
39594738 group.addSelectee(child);
3960
- objEditor.SetMaterial(child); // .GetMaterial());
3961
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3962
- System.err.println("info : " + child.GetPath());
39634739 }
39644740 }
3965
- else
3966
- {
3967
- objEditor.SetMaterial(group); // .GetMaterial());
3968
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3969
- System.err.println("info : " + group.GetPath());
3970
- }
4741
+// else
4742
+// {
4743
+// objEditor.SetMaterial(group); // .GetMaterial());
4744
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4745
+// System.err.println("info : " + group.GetPath());
4746
+// }
39714747
3972
- objEditor.SetText(); // jan 2014
3973
-
3974
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4748
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
39754749 CameraPane.flash = true;
39764750
3977
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4751
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39784752 // a camera
39794753 {
3980
- CameraPane.camerachangeframe = 0; // don't refuse it
3981
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3982
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3983
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
4754
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4755
+ {
4756
+ CameraPane.camerachangeframe = 0; // don't refuse it
4757
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4758
+ }
4759
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4760
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
39844761 }
39854762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
39864770 refreshContents();
39874771 //return true;
39884772 }
....@@ -3991,6 +4775,35 @@
39914775
39924776 freezemodel = false;
39934777 }
4778
+
4779
+ void SetPinStates(boolean enabled)
4780
+ {
4781
+ editButton.setEnabled(enabled);
4782
+ uneditButton.setEnabled(enabled);
4783
+ unselectButton.setEnabled(enabled);
4784
+ flashSelectionButton.setEnabled(enabled);
4785
+ }
4786
+
4787
+ void refreshContents(boolean cp)
4788
+ {
4789
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4790
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4791
+ {
4792
+ objEditor.ClearInfo(); // .GetMaterial());
4793
+
4794
+ for (int i=0; i < group.selection.Size(); i++)
4795
+ {
4796
+ Object3D child = (Object3D) group.selection.get(i);
4797
+
4798
+ objEditor.AddInfo(child, this, true);
4799
+ System.err.println("info : " + child.GetPath());
4800
+ }
4801
+
4802
+ objEditor.SetText(); // jan 2014
4803
+ }
4804
+
4805
+ super.refreshContents(cp);
4806
+ }
39944807
39954808 void linkSomething(Object3D thing)
39964809 {
....@@ -4062,16 +4875,19 @@
40624875 {
40634876 if (group.selection.isEmpty())
40644877 return;
4065
- GrafreeD.clipboardIsTempGroup = false;
4878
+
4879
+ Grafreed.clipboardIsTempGroup = false;
40664880 Composite tGroup = null;
40674881 if (group.selection.size() > 0) // 1)
40684882 {
40694883 tGroup = new cGroup();
4070
- GrafreeD.clipboardIsTempGroup = true;
4884
+ Grafreed.clipboardIsTempGroup = true;
40714885 }
40724886
40734887 if (cut)
40744888 {
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
40754891 //int indices[] = jList.getSelectedIndices();
40764892 //for (int i = indices.length - 1; i >= 0; i--)
40774893 //jList.remove(indices[i]);
....@@ -4107,16 +4923,16 @@
41074923 //System.out.println("cut " + child);
41084924 //System.out.println("parent = " + child.parent);
41094925 // tmp.addChild(child);
4110
- if (GrafreeD.clipboardIsTempGroup)
4926
+ if (Grafreed.clipboardIsTempGroup)
41114927 tGroup.add/*Child*/(tmp);
41124928 else
4113
- GrafreeD.clipboard = tmp;
4929
+ Grafreed.clipboard = tmp;
41144930 }
41154931 else
4116
- if (GrafreeD.clipboardIsTempGroup)
4932
+ if (Grafreed.clipboardIsTempGroup)
41174933 tGroup.add/*Child*/(child);
41184934 else
4119
- GrafreeD.clipboard = child;
4935
+ Grafreed.clipboard = child;
41204936 }
41214937
41224938 //ResetModel();
....@@ -4148,21 +4964,23 @@
41484964 //System.out.println("cut " + elem);
41494965 //System.out.println("parent = " + elem.parent);
41504966 // tmp.addChild(elem);
4151
- if (GrafreeD.clipboardIsTempGroup)
4967
+ if (Grafreed.clipboardIsTempGroup)
41524968 tGroup.add/*Child*/(tmp);
41534969 else
4154
- GrafreeD.clipboard = tmp;
4970
+ Grafreed.clipboard = tmp;
41554971 }
41564972 else
4157
- if (GrafreeD.clipboardIsTempGroup)
4973
+ if (Grafreed.clipboardIsTempGroup)
41584974 tGroup.add/*Child*/(child);
41594975 else
4160
- GrafreeD.clipboard = child;
4976
+ Grafreed.clipboard = child;
41614977 }
41624978
41634979 }
4164
- if (GrafreeD.clipboardIsTempGroup)
4165
- GrafreeD.clipboard = tGroup;
4980
+
4981
+ if (Grafreed.clipboardIsTempGroup)
4982
+ Grafreed.clipboard = tGroup;
4983
+
41664984 if (cut)
41674985 {
41684986 ResetModel();
....@@ -4172,11 +4990,15 @@
41724990
41734991 void paste(boolean expand)
41744992 {
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
41754997 // if (GrafreeD.clipboard == null)
41764998 // return;
41774999 boolean first = true;
41785000
4179
- if (GrafreeD.clipboardIsTempGroup)
5001
+ if (Grafreed.clipboardIsTempGroup)
41805002 {
41815003 Composite temp;
41825004
....@@ -4187,7 +5009,7 @@
41875009 temp = (Composite)Applet3D.clipboard.deepCopy();
41885010 */
41895011 Object3D elem;
4190
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5012
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41915013 {
41925014 Object3D child = (Object3D)e.nextElement();
41935015
....@@ -4221,21 +5043,22 @@
42215043 //Object3D cb = Applet3D.clipboard;
42225044 //temp.addChild(cb);
42235045 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4224
- assert(GrafreeD.clipboard.parent == null);
4225
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4226
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4227
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4228
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5046
+ assert(Grafreed.clipboard.parent == null);
5047
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5048
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5049
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5050
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42295051 else
4230
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4231
- GrafreeD.clipboard.get(0).parent = keepparent;
5052
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5053
+ Grafreed.clipboard.get(0).parent = keepparent;
42325054 }
42335055
5056
+ Globals.REPLACEONMAKE = keep;
42345057 ResetModel();
42355058 refreshContents();
42365059 }
42375060
4238
- void pasteInto(boolean copyit)
5061
+ void pasteInto(boolean copyit, boolean clone)
42395062 {
42405063 // if (GrafreeD.clipboard == null)
42415064 // return;
....@@ -4264,15 +5087,22 @@
42645087 if (copyit)
42655088 {
42665089 // paste(false);
4267
- CloneClipboard(false); // sept 2014
5090
+ if (clone)
5091
+ {
5092
+ CloneClipboard(false); // sept 2014
5093
+ }
5094
+ else
5095
+ {
5096
+ paste(false);
5097
+ }
42685098 }
42695099 else
42705100 {
42715101 boolean first = true;
42725102
4273
- if (GrafreeD.clipboardIsTempGroup)
5103
+ if (Grafreed.clipboardIsTempGroup)
42745104 {
4275
- Composite temp = (Composite)GrafreeD.clipboard;
5105
+ Composite temp = (Composite)Grafreed.clipboard;
42765106 Object3D copy;
42775107 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42785108 {
....@@ -4282,7 +5112,7 @@
42825112 }
42835113 } else
42845114 {
4285
- linkSomething(GrafreeD.clipboard); //.get(0));
5115
+ linkSomething(Grafreed.clipboard); //.get(0));
42865116 }
42875117 }
42885118 }
....@@ -4359,6 +5189,10 @@
43595189
43605190 void group(Object3D csg, boolean grab)
43615191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
43625196 if (//false) // why??
43635197 !group.selection.isEmpty())
43645198 {
....@@ -4472,8 +5306,34 @@
44725306 //node.add(csg);
44735307 //makeSomething(node);
44745308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
44755310 }
44765311
5312
+ void Ungroup(Object3D g)
5313
+ {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
5318
+ if (g instanceof HiddenObject)
5319
+ {
5320
+ HiddenObject h = (HiddenObject) g;
5321
+
5322
+ for (int i=0; i<h.ActualSize(); i++)
5323
+ {
5324
+ objEditor.makeSomething(h.get(i), false);
5325
+ }
5326
+ }
5327
+ else
5328
+ {
5329
+ for (int i=0; i<g.Size(); i++)
5330
+ {
5331
+ objEditor.makeSomething(g.get(i), false);
5332
+ }
5333
+ }
5334
+ Globals.REPLACEONMAKE = keep;
5335
+ }
5336
+
44775337 void ungroup()
44785338 {
44795339 /*
....@@ -4667,21 +5527,6 @@
46675527 }
46685528 */
46695529
4670
- void ImportGFD()
4671
- {
4672
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4673
- browser.show();
4674
- String filename = browser.getFile();
4675
- if (filename != null && filename.length() > 0)
4676
- {
4677
- String fullname = browser.getDirectory() + filename;
4678
-
4679
- //Object3D readobj =
4680
- objEditor.ReadGFD(fullname, objEditor);
4681
- //makeSomething(readobj);
4682
- }
4683
- }
4684
-
46855530 /*
46865531 public void Callback(Object obj)
46875532 {
....@@ -4705,26 +5550,9 @@
47055550 }
47065551 */
47075552
4708
- void ImportVRMLX3D()
4709
- {
4710
- if (GrafreeD.standAlone)
4711
- {
4712
- /**/
4713
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4714
- browser.show();
4715
- String filename = browser.getFile();
4716
- if (filename != null && filename.length() > 0)
4717
- {
4718
- String fullname = browser.getDirectory() + filename;
4719
- LoadVRMLX3D(fullname);
4720
- }
4721
- /**/
4722
- }
4723
- }
4724
-
47255553 String GetFile(String dialogName)
47265554 {
4727
- if (GrafreeD.standAlone)
5555
+ if (Grafreed.standAlone)
47285556 {
47295557 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47305558 browser.show();
....@@ -4788,10 +5616,33 @@
47885616 cButton flashSelectionButton;
47895617 cButton editButton;
47905618 cButton uneditButton;
5619
+ JCheckBox allParamsButton;
47915620 cButton clearpanelButton;
4792
- cButton allParamsButton;
47935621 cButton unselectButton;
47945622
5623
+ cButton restoreCameraButton;
5624
+
5625
+ cButton saveButton;
5626
+ cButton oneStepButton;
5627
+
5628
+ cButton groupButton;
5629
+ cButton ungroupButton;
5630
+ cButton compositeButton;
5631
+ cButton switchButton;
5632
+ cButton loopButton;
5633
+ cButton textureButton;
5634
+
5635
+ cButton gridButton;
5636
+ cButton boxButton;
5637
+ cButton sphereButton;
5638
+ cButton coneButton;
5639
+ cButton torusButton;
5640
+ cButton superButton;
5641
+ cButton kleinButton;
5642
+ cButton particlesButton;
5643
+ cButton overlayButton;
5644
+ cButton lightButton;
5645
+
47955646 cButton screenfitButton;
47965647 cButton screenfitpointButton;
47975648 cButton snapobjectButton;
....@@ -4803,14 +5654,6 @@
48035654
48045655 cButton setsupportButton;
48055656
4806
- cButton twoButton;
4807
- cButton sixButton;
4808
- cButton threeButton;
4809
- cButton sevenButton;
4810
- cButton fourButton; // full panel
4811
- cButton oneButton; // full XYZ
4812
- //cButton currentLayout;
4813
-
48145657 //
48155658 //Composite
48165659 Object3D // to do !!
....@@ -4820,9 +5663,11 @@
48205663 //JTree jTree;
48215664 private MenuItem lookAtItem;
48225665 private MenuItem lookFromItem;
4823
- private MenuItem switchItem;
5666
+ private MenuItem switchViewItem;
48245667 private MenuItem cutItem;
4825
- private MenuItem duplicateItem;
5668
+ private MenuItem undoItem;
5669
+ private MenuItem redoItem;
5670
+ private JMenuItem duplicateItem;
48265671 private MenuItem cloneItem;
48275672 private MenuItem cloneSupportItem;
48285673 private MenuItem overwriteGeoItem;
....@@ -4833,8 +5678,9 @@
48335678 private MenuItem resetsupportItem;
48345679 private MenuItem resetreferencesItem;
48355680 private MenuItem linkverticesItem;
5681
+ private MenuItem relinkverticesItem;
48365682 private MenuItem setMasterItem;
4837
- private MenuItem resetMeshItem;
5683
+ private MenuItem resetAllItem;
48385684 private MenuItem stepAllItem;
48395685 private MenuItem revertMeshItem;
48405686 private MenuItem poseMeshItem;
....@@ -4845,6 +5691,7 @@
48455691 private MenuItem mergeGeometriesItem;
48465692 private MenuItem copyItem;
48475693 private MenuItem pasteItem;
5694
+ private MenuItem pasteIntoItem;
48485695 private MenuItem pasteLinkItem;
48495696 private MenuItem pasteCloneItem;
48505697 private MenuItem pasteExpandItem;
....@@ -4854,6 +5701,7 @@
48545701 private MenuItem genNormalsMESHItem;
48555702 private MenuItem genNormalsCADItem;
48565703 private MenuItem genNormalsORGANItem;
5704
+ private MenuItem genNormalsMINEItem;
48575705 private MenuItem stripifyItem;
48585706 private MenuItem unstripifyItem;
48595707 private MenuItem trimItem;
....@@ -4882,6 +5730,10 @@
48825730 private MenuItem showleavesItem;
48835731 private MenuItem markleavesItem;
48845732 private MenuItem unmarkleavesItem;
5733
+ private MenuItem rewindleavesItem;
5734
+ private MenuItem unrewindleavesItem;
5735
+ private MenuItem randomleavesItem;
5736
+ private MenuItem unrandomleavesItem;
48855737
48865738 private MenuItem flipVItem;
48875739 private MenuItem unflipVItem;
....@@ -4893,14 +5745,17 @@
48935745 private MenuItem panoTexturesItem;
48945746
48955747 private MenuItem resetCentroidItem;
4896
- private MenuItem transformgeometryItem;
5748
+ private MenuItem resetCentroidXZItem;
48975749 private MenuItem resetTransformItem;
5750
+ private MenuItem transformGeometryItem;
5751
+ private MenuItem transformChildrenItem;
5752
+ private MenuItem hideItem;
48985753 private MenuItem grabItem;
48995754 private MenuItem backItem;
49005755 private MenuItem frontItem;
49015756 private MenuItem cameraItem;
49025757 private MenuItem compositeItem;
4903
- private MenuItem randomItem;
5758
+ private MenuItem switchItem;
49045759 private MenuItem physicsItem;
49055760 private MenuItem frameselectorItem;
49065761 private MenuItem scriptNodeItem;
....@@ -4915,6 +5770,7 @@
49155770
49165771 private MenuItem resetParentItem;
49175772 private MenuItem repairParentItem;
5773
+ private MenuItem repairShadowItem;
49185774 private MenuItem sortbysizeItem;
49195775 private MenuItem sortbynameItem;
49205776
....@@ -4935,10 +5791,11 @@
49355791 private MenuItem coneItem;
49365792 private MenuItem torusItem;
49375793 private MenuItem superItem;
5794
+ private MenuItem kleinItem;
49385795 private MenuItem blobItem;
49395796 private MenuItem latheItem;
49405797 private MenuItem bezierItem;
4941
- private MenuItem checkerItem;
5798
+ private MenuItem overlayItem;
49425799 private MenuItem meshItem;
49435800 // private MenuItem meshGroupItem;
49445801 private MenuItem springItem;
....@@ -4947,6 +5804,7 @@
49475804 private MenuItem csgItem;
49485805 private MenuItem templateItem;
49495806 private MenuItem textureItem;
5807
+ private MenuItem billboardItem;
49505808 private MenuItem shadowXItem;
49515809 private MenuItem shadowYItem;
49525810 private MenuItem shadowZItem;
....@@ -4959,11 +5817,6 @@
49595817 private MenuItem doubleItem;
49605818 private MenuItem tripleItem;
49615819
4962
- private MenuItem importGFDItem;
4963
- private MenuItem importVRMLX3DItem;
4964
- private MenuItem import3DSItem;
4965
- private MenuItem importOBJItem;
4966
-
49675820 private MenuItem computeAOItem;
49685821 private MenuItem recompileItem;
49695822 private MenuItem editScriptItem;
....@@ -4973,4 +5826,8 @@
49735826 private MenuItem analyzeItem;
49745827 private MenuItem dumpItem;
49755828 //boolean freezemodel = false;
5829
+
5830
+ Menu cameraMenu;
5831
+ MenuItem editCameraItem;
5832
+ MenuItem restoreCameraItem;
49765833 }