Normand Briere
2019-07-19 e79247ef52a0bbb3864d46bb1e2c716005b3ecf3
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);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
208
+ menu.add("-");
209
+ deleteItem = menu.add(new MenuItem("Delete"));
210
+ deleteItem.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,79 +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);
222338 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223339 relinkverticesItem.addActionListener(this);
340
+
341
+ if (Globals.ADVANCED)
342
+ {
224343 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225344 setMasterItem.addActionListener(this);
345
+ }
226346
227347 oe.menuBar.add(menu = new Menu("Group"));
228
- grabItem = menu.add(new MenuItem("Grab"));
229
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
230350 backItem = menu.add(new MenuItem("Back"));
231351 backItem.addActionListener(this);
232352 frontItem = menu.add(new MenuItem("Front"));
233353 frontItem.addActionListener(this);
234
- compositeItem = menu.add(new MenuItem("Composite"));
235
- compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
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"));
237360 hideItem.addActionListener(this);
361
+ }
238362 ungroupItem = menu.add(new MenuItem("Ungroup"));
239363 ungroupItem.addActionListener(this);
240
- menu.add("-");
241
- randomItem = menu.add(new MenuItem("Random"));
242
- randomItem.addActionListener(this);
243
- physicsItem = menu.add(new MenuItem("Physics"));
244
- physicsItem.addActionListener(this);
245
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
246
- frameselectorItem.addActionListener(this);
364
+
365
+// menu.add("-");
366
+//
367
+// switchItem = menu.add(new MenuItem("Switch node"));
368
+// switchItem.addActionListener(this);
369
+ if (Globals.ADVANCED)
370
+ {
247371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248372 switchGeoItem.addActionListener(this);
249373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250374 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
375
+ morphItem = menu.add(new MenuItem("Morph Group"));
252376 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);
253383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254384 scriptNodeItem.addActionListener(this);
255
- cameraItem = menu.add(new MenuItem("Camera"));
256
- cameraItem.addActionListener(this);
385
+ }
257386
258387 oe.menuBar.add(menu = new Menu("Object"));
259
- textureItem = menu.add(new MenuItem("Texture"));
260
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
261390 billboardItem = menu.add(new MenuItem("Billboard"));
262391 billboardItem.addActionListener(this);
263392 csgItem = menu.add(new MenuItem("CSG"));
264393 csgItem.addActionListener(this);
265
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
266395 shadowXItem.addActionListener(this);
267
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
268397 shadowYItem.addActionListener(this);
269
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
270399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
403
+ if (Globals.ADVANCED)
404
+ {
405
+ menu.add("-");
271406 linkerItem = menu.add(new MenuItem("Linker"));
272407 linkerItem.addActionListener(this);
273408 templateItem = menu.add(new MenuItem("Template"));
274409 templateItem.addActionListener(this);
275
- attributeItem = menu.add(new MenuItem("Attribute"));
276
- attributeItem.addActionListener(this);
277410 pointflowItem = menu.add(new MenuItem("Point Flow"));
278411 pointflowItem.addActionListener(this);
412
+ }
279413 menu.add("-");
280414 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281415 resetTransformItem.addActionListener(this);
282416 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283417 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- transformgeometryItem.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);
286424
287425 oe.menuBar.add(menu = new Menu("Geometry"));
288426 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +431,11 @@
293431 genNormalsCADItem.addActionListener(this);
294432 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295433 genNormalsMESHItem.addActionListener(this);
296
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
434
+ if (Globals.ADVANCED)
435
+ {
436
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
297437 genNormalsMINEItem.addActionListener(this);
438
+ }
298439 stripifyItem = menu.add(new MenuItem("Stripify"));
299440 stripifyItem.addActionListener(this);
300441 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +457,34 @@
316457 reduce34MeshItem.addActionListener(this);
317458 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318459 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321460 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322461 clipMeshItem.addActionListener(this);
462
+
463
+ if (Globals.ADVANCED)
464
+ {
465
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
466
+ smoothMeshItem.addActionListener(this);
467
+ }
323468
324469 oe.menuBar.add(menu = new Menu("Attributes"));
325470 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326471 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);
327476 menu.add("-");
328477 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329478 liveleavesItem.addActionListener(this);
330479 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331480 unliveleavesItem.addActionListener(this);
481
+ if (Globals.ADVANCED)
482
+ {
332483 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333484 supportleavesItem.addActionListener(this);
334485 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335486 unsupportleavesItem.addActionListener(this);
487
+ }
336488 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337489 hideleavesItem.addActionListener(this);
338490 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -341,6 +493,14 @@
341493 markleavesItem.addActionListener(this);
342494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
343495 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);
344504 menu.add("-");
345505 flipVItem = menu.add(new MenuItem("Flip V"));
346506 flipVItem.addActionListener(this);
....@@ -376,35 +536,41 @@
376536 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377537 sortbynameItem.addActionListener(this);
378538 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.
379546 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380547 extractGeometriesItem.addActionListener(this);
381548 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382549 cloneGeometriesItem.addActionListener(this);
383
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
- shareGeometriesItem.addActionListener(this);
385
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
- mergeGeometriesItem.addActionListener(this);
550
+ }
387551
388552 oe.menuBar.add(menu = new Menu("Insert"));
389553 buildCreateMenu(menu);
390554
391
-
392
- oe.menuBar.add(menu = new Menu("Include"));
393
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
- importGFDItem.addActionListener(this);
395
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
- importVRMLX3DItem.addActionListener(this);
397
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
398
- importOBJItem.addActionListener(this);
399
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
- import3DSItem.addActionListener(this);
401
-
402555 oe.menuBar.add(menu = new Menu("Tools"));
403556 buildToolsMenu(menu);
404557 }
405558
559
+
406560 void SetupUI2(ObjEditor oe)
407561 {
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
+
408574 //new Exception().printStackTrace();
409575
410576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -433,153 +599,231 @@
433599 oe.radioPanel.add(dummyButton);
434600 oe.buttonGroup.add(dummyButton);
435601 */
436
- aConstraints.gridy += 1;
437
- oe.aConstraints.gridwidth = 1;
438
- oe.aConstraints.gridx = 0;
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
439605
440
- 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");
441660 liveCB.addItemListener(this);
442661
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
445
- supportCB.addItemListener(this);
446
-
447
- // oe.aConstraints.gridx += 1;
448
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
449
- // localCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
453
- crowdCB.addItemListener(this);
454
-
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
457
- smoothCB.addItemListener(this);
458
-
459
- oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
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");
461668 fastCB.addItemListener(this);
462
- oe.aConstraints.gridx += 1;
463
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
464
- slowCB.addItemListener(this);
465
- oe.aConstraints.gridx += 1;
466
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
467
- boxCB.addItemListener(this);
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);
468675
469
-// oe.aConstraints.gridx += 1;
470
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
471
-// speakerMocapCB.addItemListener(this);
472
-
473
- if (false)
474
- {
475
- // handled in scripts
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
478
- speakerCameraCB.addItemListener(this);
479
-
480
- oe.aConstraints.gridx += 1;
481
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
482
- speakerFocusCB.addItemListener(this);
483
-
484
- oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
486
- smoothfocusCB.addItemListener(this);
487
- }
488
-
489
-//oe.aConstraints.gridx += 1;
490
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
491
-// debugCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
495
- oeilCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
499
- lookAtCB.addItemListener(this);
500
-
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
503
- trackCB.addItemListener(this);
504
-
505
- oe.aConstraints.gridx += 1;
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
507
- screenfitButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
509676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
510677 // screenfitpointButton.addActionListener(this);
511
-// oe.aConstraints.gridx += 1;
512
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
513
- snapobjectButton.addActionListener(this);
514
- oe.aConstraints.gridx += 1;
515678
516
- //aConstraints.gridx = 0;
517
- //aConstraints.gridy += 1;
518
- oe.aConstraints.weighty = 0;
519
- oe.aConstraints.gridwidth = 1;
520
-
521
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
522
- flashSelectionButton.addActionListener(this);
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));
523687
524
- oe.toolbarPanel.add(new cButton(" ", false));
525
-
526
- oe.aConstraints.gridx += 1;
527
- oe.aConstraints.weighty = 0;
528
- oe.aConstraints.gridwidth = 1;
529
-
530
- //
531
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
532
- twoButton.addActionListener(this);
533
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
534689 fourButton.addActionListener(this);
535
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
690
+ fourButton.setToolTipText("Show left panel only");
691
+
692
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ twoButton.setToolTipText("Show right view only");
694
+ twoButton.addActionListener(this);
695
+ this.fullscreenLayout = twoButton;
696
+
697
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
+ sixButton.setToolTipText("Show left and right");
536699 sixButton.addActionListener(this);
537
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
538
- threeButton.addActionListener(this);
539
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
540
- sevenButton.addActionListener(this);
700
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+// threeButton.setToolTipText("2-column layout right");
702
+// threeButton.addActionListener(this);
703
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+// sevenButton.setToolTipText("3-column layout");
705
+// sevenButton.addActionListener(this);
541706 //
542707
543
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
708
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ rootButton.setToolTipText("Open selection in new tab");
544710 rootButton.addActionListener(this);
545
- oe.aConstraints.gridx += 1;
546
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
711
+
712
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ closeButton.setToolTipText("Close tab");
547714 closeButton.addActionListener(this);
548715 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
549716 //clearButton.addActionListener(this);
550
- oe.aConstraints.gridx += 1;
551
-
552
- oe.aConstraints.gridx = 1; //
553
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
554
- editButton.addActionListener(this);
555
- oe.aConstraints.gridx += 1;
556
- oe.aConstraints.weighty = 0;
557
- oe.aConstraints.gridwidth = 1;
558717
559
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
718
+ // INSERT
719
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
720
+ gridButton.setToolTipText("Create grid");
721
+ gridButton.addActionListener(this);
722
+
723
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ boxButton.setToolTipText("Create box");
725
+ boxButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
728
+ sphereButton.setToolTipText("Create sphere");
729
+ sphereButton.addActionListener(this);
730
+
731
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
732
+ coneButton.setToolTipText("Create cone");
733
+ coneButton.addActionListener(this);
734
+
735
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+ torusButton.setToolTipText("Create torus");
737
+ torusButton.addActionListener(this);
738
+
739
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
740
+ superButton.setToolTipText("Create superellipsoid");
741
+ superButton.addActionListener(this);
742
+
743
+ if (Globals.ADVANCED)
744
+ {
745
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ kleinButton.setToolTipText("Create Klein bottle");
747
+ kleinButton.addActionListener(this);
748
+ }
749
+
750
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
751
+ particlesButton.setToolTipText("Create particle system");
752
+ particlesButton.addActionListener(this);
753
+
754
+ oe.toolboxPanel.Return();
755
+
756
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
757
+ groupButton.setToolTipText("Create group");
758
+ groupButton.addActionListener(this);
759
+
760
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
761
+ compositeButton.setToolTipText("Create composite");
762
+ compositeButton.addActionListener(this);
763
+
764
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ switchButton.setToolTipText("Create item switcher");
766
+ switchButton.addActionListener(this);
767
+
768
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ loopButton.setToolTipText("Create loop");
770
+ loopButton.addActionListener(this);
771
+
772
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ textureButton.setToolTipText("Create texture");
774
+ textureButton.addActionListener(this);
775
+
776
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ overlayButton.setToolTipText("Create overlay");
778
+ overlayButton.addActionListener(this);
779
+
780
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
+ lightButton.setToolTipText("Create light");
782
+ lightButton.addActionListener(this);
783
+
784
+ for (int i=6; --i>=0;)
785
+ {
786
+ oe.toolboxPanel.Return();
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
+ oe.toolboxPanel.add(new cGridBag());
794
+ }
795
+
796
+ // EDIT panel
797
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
798
+ editButton.setToolTipText("Pin selection controls");
799
+ editButton.addActionListener(this);
800
+
801
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
802
+ uneditButton.setToolTipText("Remove selection controls");
560803 uneditButton.addActionListener(this);
561804
562
- oe.aConstraints.gridx += 1;
563
- oe.aConstraints.weighty = 0;
564
- oe.aConstraints.gridwidth = 1;
565
-
566
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
567
- clearPanelButton.addActionListener(this);
568
-
569
- oe.aConstraints.gridx += 1;
570
- oe.aConstraints.weighty = 0;
571
- oe.aConstraints.gridwidth = 1;
572
-
573
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
805
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
806
+ allParamsButton.setToolTipText("Show all controle");
574807 allParamsButton.addActionListener(this);
575808
576
- oe.aConstraints.gridx += 1;
577
- oe.aConstraints.weighty = 0;
578
- oe.aConstraints.gridwidth = 1;
579
-
580
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
809
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
810
+ clearPanelButton.setToolTipText("Clear edit panel");
811
+ clearPanelButton.addActionListener(this);
812
+
813
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
814
+ unselectButton.setToolTipText("Unselect");
581815 unselectButton.addActionListener(this);
582816
817
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
818
+ flashSelectionButton.setToolTipText("Highlight selection");
819
+ flashSelectionButton.addActionListener(this);
820
+
821
+ editCommandsPanel.preferredHeight = 1;
822
+
823
+ SetPinStates(false);
824
+// oe.treePanel.add(commandsPanel);
825
+// oe.treePanel.Return();
826
+
583827 // oe.aConstraints.gridx += 1;
584828 // oe.aConstraints.weighty = 0;
585829 // oe.aConstraints.gridwidth = 1;
....@@ -591,40 +835,25 @@
591835 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
592836 // gcButton.addActionListener(this);
593837
594
- oe.aConstraints.gridx = 0;
595
- oe.aConstraints.gridy += 1;
596
-
597
- //ctrlPanel.add(objList = new List(5, true));
598
- oe.aConstraints.gridwidth = 100;
599
- // oe.aConstraints.gridheight = 100;
600
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
601
- oe.aConstraints.gridheight = 1;
602
- oe.aConstraints.weighty = 0.5;
603
- oe.aConstraints.gridx = 0;
604
- JScrollPane jSP;
838
+ cGridBag jSPPanel = new cGridBag();
839
+
840
+ JScrollPane jSP;
605841 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
606
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
842
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
607843 ResetModel();
608
- oe.aConstraints.weighty = 0.5;
609
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
610
- oe.aConstraints.gridy += 1;
611
- oe.aConstraints.gridwidth = 1;
612
-
613
- oe.aConstraints.weighty = 0;
614
- oe.aConstraints.gridwidth = 2;
615
-
616
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
617
- colorCB.addItemListener(this);
618
- oe.aConstraints.gridx += 2;
619
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
620
- materialCB.addItemListener(this);
621
- oe.aConstraints.gridx += 2;
622
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
623
- textureCB.addItemListener(this);
624
-
625
- oe.aConstraints.gridx = 0;
626
- oe.aConstraints.gridy += 1;
627844
845
+ oe.treePanel.add(jSPPanel);
846
+ oe.treePanel.Return();
847
+
848
+ oe.treePanel.add(copyOptionsPanel);
849
+ oe.treePanel.Return();
850
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
851
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852
+ sliderPane.preferredHeight = 1;
853
+
854
+// mainPanel.setDividerLocation(0.5); //1.0);
855
+// mainPanel.setResizeWeight(0.5);
856
+
628857 //jList.addListSelectionListener(this);
629858 oe.jTree.addTreeSelectionListener(this);
630859 //jTree.setRootVisible(false);
....@@ -643,23 +872,160 @@
643872 dgr.addDragGestureListener(this);
644873 }catch(Exception e) {}
645874 */
646
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
647876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
648877 }
878
+
879
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
880
+ {
881
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
882
+ colorCB.setToolTipText("Copy color when dropped");
883
+ colorCB.addItemListener(this);
884
+
885
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
886
+ materialCB.setToolTipText("Copy material when dropped");
887
+ materialCB.addItemListener(this);
888
+
889
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
890
+ textureCB.setToolTipText("Copy texture when dropped");
891
+ textureCB.addItemListener(this);
892
+
893
+ panel.Return();
894
+
895
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
896
+ boxCB.setToolTipText("Display bounding boxes");
897
+ boxCB.addItemListener(this);
898
+
899
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
900
+ zoomBoxCB.setToolTipText("Display only for wheel");
901
+ zoomBoxCB.addItemListener(this);
902
+
903
+ if (true) // Globals.ADVANCED)
904
+ {
905
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
906
+// supportCB.setToolTipText("Enable rigging");
907
+// supportCB.addItemListener(this);
908
+
909
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
910
+ freezeCB.setToolTipText("Fast moving camera");
911
+ freezeCB.addItemListener(this);
912
+
913
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
914
+ // localCB.addItemListener(this);
915
+
916
+ panel.Return();
917
+
918
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
919
+ crowdCB.setToolTipText("Used for crowds");
920
+ crowdCB.addItemListener(this);
921
+
922
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
923
+ smoothCB.setToolTipText("Snapping delay");
924
+ smoothCB.addItemListener(this);
925
+
926
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
927
+ slowCB.setToolTipText("Smooth interpolation");
928
+ slowCB.addItemListener(this);
929
+
930
+// constraints.gridy += 1;
931
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
932
+// speakerMocapCB.addItemListener(this);
933
+
934
+ panel.Return();
935
+
936
+ if (false)
937
+ {
938
+ // handled in scripts
939
+ //constraints.gridy += 1;
940
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
941
+ speakerCameraCB.addItemListener(this);
942
+
943
+ //constraints.gridy += 1;
944
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
945
+ speakerFocusCB.addItemListener(this);
946
+
947
+ //constraints.gridy += 1;
948
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
949
+ smoothfocusCB.addItemListener(this);
950
+ panel.Return();
951
+ }
952
+
953
+//constraints.gridx += 1;
954
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
955
+// debugCB.addItemListener(this);
956
+
957
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
958
+ trackCB.setToolTipText("Enable tracking target");
959
+ trackCB.addItemListener(this);
960
+
961
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
962
+ oeilCB.setToolTipText("Move camera when tracking");
963
+ oeilCB.addItemListener(this);
964
+
965
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
966
+ shadowCB.setToolTipText("When live compute shadows");
967
+ shadowCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
971
+ toggleTextureCB.setToolTipText("Load textures");
972
+ toggleTextureCB.addItemListener(this);
973
+
974
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
975
+ toggleSwitchCB.setToolTipText("Choose a single item");
976
+ toggleSwitchCB.addItemListener(this);
977
+
978
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
979
+ autokeepCB.setToolTipText("On structure change");
980
+ autokeepCB.addItemListener(this);
981
+
982
+ panel.Return();
983
+ if (Globals.ADVANCED)
984
+ {
985
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
986
+ lookAtCB.setToolTipText("Look-at target");
987
+ lookAtCB.addItemListener(this);
988
+ }
989
+
990
+ }
991
+
992
+ cGridBag fill = new cGridBag();
993
+ fill.preferredHeight = 200;
994
+ cGridBag fill2 = new cGridBag();
995
+ fill2.preferredHeight = 200;
996
+ cGridBag fill3 = new cGridBag();
997
+ fill3.preferredHeight = 200;
998
+
999
+ panel.add(fill);
1000
+ panel.add(fill2);
1001
+ panel.add(fill3);
1002
+
1003
+ }
6491004
6501005 void EditObject(Object3D obj)
6511006 {
6521007 cRadio radioButton = new cRadio(obj.name);
1008
+
1009
+ // June 2019. Patch to avoid bug with transparency.
1010
+ radioButton.hadMaterial = obj.material != null;
1011
+ if (!radioButton.hadMaterial)
1012
+ {
1013
+ obj.material = new cMaterial();
1014
+ }
1015
+
6531016 radioButton.SetObject(obj);
654
- radioButton.layout = sevenButton;
1017
+ radioButton.layout = sixButton; // sevenButton;
6551018 radioButton.SetCamera(cameraView.renderCamera, false);
6561019 radioButton.addActionListener(this);
6571020 radioPanel.add(radioButton);
6581021 buttonGroup.add(radioButton);
6591022 radioButton.doClick();
6601023 }
1024
+
6611025 void SetupViews(ObjEditor oe)
6621026 {
1027
+ theFrame = this;
1028
+
6631029 oe.SetupViews();
6641030
6651031 System.out.println("SetupViews");
....@@ -668,22 +1034,28 @@
6681034 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6691035 }
6701036
671
- JCheckBox liveCB;
672
- JCheckBox supportCB;
673
- JCheckBox localCB;
674
- JCheckBox crowdCB;
675
- JCheckBox smoothCB;
676
- JCheckBox fastCB;
677
- JCheckBox slowCB;
678
- JCheckBox boxCB;
679
- JCheckBox trackCB;
680
- JCheckBox smoothfocusCB;
1037
+ cToggleButton liveCB;
1038
+ cCheckBox supportCB;
1039
+ cCheckBox localCB;
1040
+ cCheckBox crowdCB;
1041
+ cCheckBox smoothCB;
1042
+ cToggleButton fastCB;
1043
+ cCheckBox slowCB;
1044
+ cCheckBox boxCB;
1045
+ cCheckBox zoomBoxCB;
1046
+ cCheckBox freezeCB;
1047
+ //cToggleButton trackCB;
1048
+ cCheckBox trackCB;
1049
+ cCheckBox smoothfocusCB;
6811050 // JCheckBox speakerMocapCB;
682
- JCheckBox speakerCameraCB;
683
- JCheckBox speakerFocusCB;
684
- JCheckBox debugCB;
685
- JCheckBox oeilCB;
686
- JCheckBox lookAtCB;
1051
+ cCheckBox speakerCameraCB;
1052
+ cCheckBox speakerFocusCB;
1053
+ cCheckBox debugCB;
1054
+
1055
+ cCheckBox oeilCB;
1056
+ cCheckBox shadowCB;
1057
+ cCheckBox autokeepCB;
1058
+ cCheckBox lookAtCB;
6871059
6881060 // static int COLOR = 1;
6891061 // static int MATERIAL = 2;
....@@ -691,9 +1063,9 @@
6911063
6921064 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6931065
694
- JCheckBox colorCB;
695
- JCheckBox materialCB;
696
- JCheckBox textureCB;
1066
+ cCheckBox colorCB;
1067
+ cCheckBox materialCB;
1068
+ cCheckBox textureCB;
6971069
6981070 public void itemStateChanged(ItemEvent e)
6991071 {
....@@ -721,6 +1093,7 @@
7211093 } else if(e.getSource() == liveCB)
7221094 {
7231095 cameraView.ToggleLive();
1096
+ refreshContents(false);
7241097 }
7251098 else if(e.getSource() == supportCB)
7261099 {
....@@ -756,6 +1129,10 @@
7561129 cameraView.repaint();
7571130 // refreshContents();
7581131 }
1132
+ else if(e.getSource() == zoomBoxCB)
1133
+ {
1134
+ cameraView.ToggleZoomBoxMode();
1135
+ }
7591136 else if(e.getSource() == smoothfocusCB)
7601137 {
7611138 cameraView.ToggleSmoothFocus();
....@@ -781,6 +1158,18 @@
7811158 {
7821159 cameraView.ToggleOeil();
7831160 }
1161
+ else if(e.getSource() == shadowCB)
1162
+ {
1163
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1164
+ }
1165
+ else if(e.getSource() == freezeCB)
1166
+ {
1167
+ Globals.FREEZEONMOVE ^= true;
1168
+ }
1169
+ else if(e.getSource() == autokeepCB)
1170
+ {
1171
+ Globals.REPLACEONMAKE ^= true;
1172
+ }
7841173 else if(e.getSource() == lookAtCB)
7851174 {
7861175 cameraView.ToggleLookAt();
....@@ -797,7 +1186,8 @@
7971186
7981187 /**/
7991188 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
800
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1190
+ TreePath path = objEditor.jTree.getSelectionPath();
8011191 if ((path == null) || (path.getPathCount() <= 1)) {
8021192 // We can't move the root node or an empty selection
8031193 return;
....@@ -860,8 +1250,6 @@
8601250 }
8611251 }
8621252
863
- String string = (String) object;
864
-
8651253 System.out.println("Transfer = " + object + "; drop : " + target);
8661254 // if( object instanceof java.io.File[])
8671255 // {
....@@ -869,7 +1257,11 @@
8691257 // objEditor.DropFile((java.io.File[]) object, true);
8701258 // return;
8711259 // }
872
- if (string.charAt(0) == '/')
1260
+
1261
+ String string = object.toString();
1262
+
1263
+ // File path for Mac and Windows
1264
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8731265 {
8741266 // file(s)
8751267 String[] names = string.split("\n");
....@@ -896,7 +1288,7 @@
8961288
8971289 flashIt = false;
8981290 CameraPane pane = (CameraPane) target;
899
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1291
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9001292 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9011293
9021294 if (group.selection.size() == 1)
....@@ -912,23 +1304,33 @@
9121304
9131305 assert target == objEditor.jTree;
9141306 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1307
+ Object3D destinationLeaf;
9151308 try {
916
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1309
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9171310 } catch (Exception e) {
9181311 System.out.println("destinationPath : " + destinationPath);
9191312 return;
9201313 }
9211314
922
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1315
+ for (int i=group.selection.size(); --i>=0;)
9231316 {
1317
+ Object3D child = (Object3D)group.selection.elementAt(i);
1318
+
1319
+ // Cannot move into itself
1320
+ if (child == destinationLeaf)
1321
+ return;
1322
+ }
1323
+
1324
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1325
+// {
9241326 loadClipboard(true);
9251327 objEditor.jTree.setSelectionPath(destinationPath);
926
- pasteInto(false);
927
- } else {
928
- loadClipboard(false);
929
- objEditor.jTree.setSelectionPath(destinationPath);
930
- pasteInto(false); // true); // ???
931
- }
1328
+ pasteInto(false, false);
1329
+// } else {
1330
+// loadClipboard(false);
1331
+// objEditor.jTree.setSelectionPath(destinationPath);
1332
+// pasteInto(false, false); // true); // ???
1333
+// }
9321334 }
9331335 public void dropActionChanged(DropTargetDragEvent dtde)
9341336 // Called if the user has modified the current drop gesture
....@@ -1033,85 +1435,107 @@
10331435 {
10341436 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10351437 //heightFieldItem.addActionListener(this);
1036
- gridItem = menu.add(new MenuItem("Grid"));
1037
- gridItem.addActionListener(this);
1038
- rectoidItem = menu.add(new MenuItem("Box"));
1039
- rectoidItem.addActionListener(this);
1040
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1041
- ellipsoidItem.addActionListener(this);
1042
- coneItem = menu.add(new MenuItem("Cone"));
1043
- coneItem.addActionListener(this);
1044
- torusItem = menu.add(new MenuItem("Torus"));
1045
- torusItem.addActionListener(this);
1046
- superItem = menu.add(new MenuItem("Superellipsoid"));
1047
- superItem.addActionListener(this);
1438
+// gridItem = menu.add(new MenuItem("Grid"));
1439
+// gridItem.addActionListener(this);
1440
+// rectoidItem = menu.add(new MenuItem("Box"));
1441
+// rectoidItem.addActionListener(this);
1442
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1443
+// ellipsoidItem.addActionListener(this);
1444
+// coneItem = menu.add(new MenuItem("Cone"));
1445
+// coneItem.addActionListener(this);
1446
+// torusItem = menu.add(new MenuItem("Torus"));
1447
+// torusItem.addActionListener(this);
1448
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1449
+// superItem.addActionListener(this);
1450
+
1451
+ cameraItem = menu.add(new MenuItem("Camera"));
1452
+ cameraItem.addActionListener(this);
1453
+
1454
+ if (!Globals.ADVANCED)
1455
+ {
10481456 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10491457 kleinItem.addActionListener(this);
1050
- particleItem = menu.add(new MenuItem("Particle system"));
1051
- particleItem.addActionListener(this);
1458
+ }
1459
+
1460
+// particleItem = menu.add(new MenuItem("Particle system"));
1461
+// particleItem.addActionListener(this);
1462
+ if (Globals.ADVANCED)
1463
+ {
10521464 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10531465 ragdollItem.addActionListener(this);
10541466 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10551467 ragdoll2Item.addActionListener(this);
1468
+ }
10561469 menu.add("-");
1057
- meshItem = menu.add(new MenuItem("Mesh"));
1470
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10581471 meshItem.addActionListener(this);
10591472 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10601473 // meshGroupItem.addActionListener(this);
1474
+ if (Globals.ADVANCED)
1475
+ {
10611476 springItem = menu.add(new MenuItem("Spring"));
10621477 springItem.addActionListener(this);
10631478 flagItem = menu.add(new MenuItem("Flag"));
10641479 flagItem.addActionListener(this);
1065
- bezierItem = menu.add(new MenuItem("Patch"));
1066
- bezierItem.addActionListener(this);
1067
- checkerItem = menu.add(new MenuItem("Checker"));
1068
- checkerItem.addActionListener(this);
10691480 blobItem = menu.add(new MenuItem("Blob"));
10701481 blobItem.addActionListener(this);
10711482 latheItem = menu.add(new MenuItem("Lathe"));
10721483 latheItem.addActionListener(this);
1073
- lightItem = menu.add(new MenuItem("Light"));
1074
- lightItem.addActionListener(this);
1484
+ }
1485
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1486
+ bezierItem.addActionListener(this);
1487
+// overlayItem = menu.add(new MenuItem("Overlay"));
1488
+// overlayItem.addActionListener(this);
1489
+// lightItem = menu.add(new MenuItem("Light"));
1490
+// lightItem.addActionListener(this);
10751491 menu.add("-");
10761492 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10771493 //superLoopItem.addActionListener(this);
1078
- loopItem = menu.add(new MenuItem("Loop"));
1079
- loopItem.addActionListener(this);
1494
+// loopItem = menu.add(new MenuItem("Loop"));
1495
+// loopItem.addActionListener(this);
10801496 doubleItem = menu.add(new MenuItem("Fork"));
10811497 doubleItem.addActionListener(this);
1498
+ if (Globals.ADVANCED)
1499
+ {
10821500 tripleItem = menu.add(new MenuItem("Trident"));
10831501 tripleItem.addActionListener(this);
1502
+ }
10841503 }
10851504
10861505 void buildToolsMenu(Menu menu)
10871506 {
10881507 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10891508 animationItem.addItemListener(this);
1090
- animationItem.setState(CameraPane.ANIMATION);
1509
+ animationItem.setState(Globals.ANIMATION);
1510
+
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
10911513
10921514 menu.add("-");
10931515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10941516 parseverticesItem.addActionListener(this);
10951517 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10961518 textureFieldItem.addActionListener(this);
1097
- alignItem = menu.add(new MenuItem("Align"));
1519
+ alignItem = menu.add(new MenuItem("Align Objects"));
10981520 alignItem.addActionListener(this);
1099
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1100
- mirrorItem.addActionListener(this);
11011521 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11021522 reduceMorphItem.addActionListener(this);
11031523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11041524 reduce34MorphItem.addActionListener(this);
1105
-
1106
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1107
- computeAOItem.addActionListener(this);
11081525 menu.add("-");
1109
-
11101526 menu.add(memoryItem = new MenuItem("Memory Usage"));
11111527 memoryItem.addActionListener(this);
1528
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1529
+ computeAOItem.addActionListener(this);
1530
+
1531
+ if (Globals.ADVANCED)
1532
+ {
1533
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1534
+ mirrorItem.addActionListener(this);
1535
+ menu.add("-");
11121536 menu.add(analyzeItem = new MenuItem("Analyze"));
11131537 analyzeItem.addActionListener(this);
1114
- menu.add(dumpItem = new MenuItem("Dump"));
1538
+ menu.add(dumpItem = new MenuItem("Print"));
11151539 dumpItem.addActionListener(this);
11161540 // menu.add(pathItem = new MenuItem("From-to path"));
11171541 // pathItem.addActionListener(this);
....@@ -1129,6 +1553,7 @@
11291553 menu.add("-");
11301554 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11311555 editScriptItem.addActionListener(this);
1556
+ }
11321557 }
11331558
11341559 void ScreenFit()
....@@ -1251,9 +1676,34 @@
12511676 shadow.material = new cMaterial(obj.material);
12521677 shadow.material.diffuse = 0.0001f;
12531678 shadow.material.specular = 0.0001f;
1679
+ //shadow.projectedVertices[1].x = 300;
12541680
12551681 makeSomething(shadow);
12561682 }
1683
+
1684
+ private void ClearUnpinned()
1685
+ {
1686
+ //for (Object3D obj : listUI)
1687
+ for (int i=listUI.size(); --i>=0;)
1688
+ {
1689
+ Object3D obj = listUI.elementAt(i);
1690
+ if (!obj.pinned)
1691
+ {
1692
+ obj.CloseUI();
1693
+ listUI.remove(i);
1694
+ }
1695
+ }
1696
+ }
1697
+
1698
+ private void EditElement(Object3D elem, boolean newWindow)
1699
+ {
1700
+ // if (!(elem instanceof Composite))
1701
+ // newWindow = false;
1702
+ listUI.add(elem);
1703
+ elem.openEditWindow(this, newWindow); //, false);
1704
+ System.out.println("edit : " + elem);
1705
+ elem.editWindow.refreshContents(true); // ? new
1706
+ }
12571707
12581708 /**
12591709 * applyExample
....@@ -1457,9 +1907,9 @@
14571907
14581908 void Overwrite(int mask)
14591909 {
1460
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1910
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14611911 {
1462
- Object3D content = GrafreeD.clipboard.get(0);
1912
+ Object3D content = Grafreed.clipboard.get(0);
14631913
14641914 if (content instanceof cGroup && ((cGroup)content).transientlink )
14651915 content = ((cGroup)content).get(0);
....@@ -1482,6 +1932,7 @@
14821932 //
14831933 public void actionPerformed(ActionEvent event) // , Object arg)
14841934 {
1935
+ Object source = event.getSource();
14851936 /*
14861937 if (event.getSource() == nameField)
14871938 {
....@@ -1493,11 +1944,11 @@
14931944 }
14941945 else
14951946 */
1496
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1947
+ if (source == lookAtItem || source == lookFromItem)
14971948 {
14981949 ScreenFit();
14991950 } else
1500
- if (event.getSource() == switchItem)
1951
+ if (source == switchViewItem)
15011952 {
15021953 cVector v1 = new cVector();
15031954 cVector v2 = new cVector();
....@@ -1506,11 +1957,11 @@
15061957 objEditor.cameraView.renderCamera.setAim(v2, v1);
15071958 objEditor.cameraView.repaint();
15081959 } else
1509
- if (event.getSource() == rectoidItem)
1960
+ if (source == rectoidItem || source == boxButton)
15101961 {
15111962 makeSomething(new Box());
15121963 } else
1513
- if (event.getSource() == particleItem)
1964
+ if (source == particleItem || source == particlesButton)
15141965 {
15151966 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15161967 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1531,9 +1982,9 @@
15311982 applyExample(particleGeom, "SMOKE");
15321983 makeSomething(particleGeom);
15331984 } else
1534
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1985
+ if (source == ragdollItem || source == ragdoll2Item)
15351986 {
1536
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1987
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15371988
15381989 ragdoll.toParent = LA.newMatrix();
15391990 ragdoll.fromParent = LA.newMatrix();
....@@ -1551,7 +2002,7 @@
15512002 } else
15522003 /*
15532004 */
1554
- if (event.getSource() == heightFieldItem)
2005
+ if (source == heightFieldItem)
15552006 {
15562007 Object3D obj = new Object3D();
15572008
....@@ -1589,31 +2040,31 @@
15892040
15902041 makeSomething(obj);
15912042 } else
1592
- if (event.getSource() == gridItem)
2043
+ if (source == gridItem || source == gridButton)
15932044 {
15942045 makeSomething(new Grid());
15952046 } else
1596
- if (event.getSource() == ellipsoidItem)
2047
+ if (source == ellipsoidItem || source == sphereButton)
15972048 {
15982049 makeSomething(new Sphere());
15992050 } else
1600
- if (event.getSource() == coneItem)
2051
+ if (source == coneItem || source == coneButton)
16012052 {
16022053 makeSomething(new Cone());
16032054 } else
1604
- if (event.getSource() == torusItem)
2055
+ if (source == torusItem || source == torusButton)
16052056 {
16062057 makeSomething(new Torus());
16072058 } else
1608
- if (event.getSource() == superItem)
2059
+ if (source == superItem || source == superButton)
16092060 {
16102061 makeSomething(new Superellipsoid());
16112062 } else
1612
- if (event.getSource() == kleinItem)
2063
+ if (source == kleinItem || source == kleinButton)
16132064 {
16142065 makeSomething(new Klein());
16152066 } else
1616
- if (event.getSource() == blobItem)
2067
+ if (source == blobItem)
16172068 {
16182069 Blob blob = new Blob();
16192070 BlobComponent comp = new BlobComponent();
....@@ -1621,15 +2072,15 @@
16212072 //blob.retile();
16222073 makeSomething(blob);
16232074 } else
1624
- if (event.getSource() == latheItem)
2075
+ if (source == latheItem)
16252076 {
16262077 makeSomething(new Lathe());
16272078 } else
1628
- if (event.getSource() == bezierItem)
2079
+ if (source == bezierItem)
16292080 {
16302081 makeSomething(new BezierSurface());
16312082 } else
1632
- if (event.getSource() == checkerItem)
2083
+ if (source == overlayItem || source == overlayButton)
16332084 {
16342085 /*
16352086 Object3D obj = new BezierSurface(5,8);
....@@ -1644,7 +2095,7 @@
16442095 */
16452096 makeSomething(new Checker());
16462097 } else
1647
- if (event.getSource() == meshItem)
2098
+ if (source == meshItem)
16482099 {
16492100 Object3D itemtomake = new Object3D();
16502101 Object3D child;
....@@ -1665,35 +2116,35 @@
16652116 makeSomething(child);
16662117 }
16672118 } else
1668
- if (event.getSource() == springItem)
2119
+ if (source == springItem)
16692120 {
16702121 cSpring s = new cSpring();
16712122 s.setup();
16722123 makeSomething(s);
16732124 } else
1674
- if (event.getSource() == flagItem)
2125
+ if (source == flagItem)
16752126 {
16762127 cSpring s = new cFlag();
16772128 s.setup();
16782129 makeSomething(s);
16792130 } else
1680
- if (event.getSource() == lightItem)
2131
+ if (source == lightItem || source == lightButton)
16812132 {
16822133 makeSomething(new Light());
16832134 } else
1684
- if (event.getSource() == csgItem)
2135
+ if (source == csgItem)
16852136 {
16862137 group(new CSG());
16872138 } else
1688
- if (event.getSource() == templateItem)
2139
+ if (source == templateItem)
16892140 {
16902141 group(new cTemplate());
16912142 } else
1692
- if (event.getSource() == attributeItem)
2143
+ if (source == attributeItem)
16932144 {
16942145 makeSomething(new Attribute());
16952146 } else
1696
- if (event.getSource() == pointflowItem)
2147
+ if (source == pointflowItem)
16972148 {
16982149 makeSomething(new PointFlow());
16992150 } else
....@@ -1705,7 +2156,7 @@
17052156 } else
17062157 */
17072158
1708
- if (event.getSource() == superLoopItem)
2159
+ if (source == superLoopItem)
17092160 {
17102161 Composite g = new cGroup();
17112162 for (int i=0; i<15; i++)
....@@ -1727,30 +2178,30 @@
17272178
17282179 group(g);
17292180 } else
1730
- if (event.getSource() == loopItem)
2181
+ if (source == loopItem || source == loopButton)
17312182 {
17322183 Composite csg = new GroupLeaf();
17332184 csg.count = 5;
17342185 group(csg);
1735
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
17362187 csg.addChild(child);
17372188 child.addChild(csg);
17382189 } else
1739
- if (event.getSource() == doubleItem)
2190
+ if (source == doubleItem)
17402191 {
1741
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
17422193 csg.count = 5;
17432194 group(csg);
1744
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
17452196 csg.addChild(child);
17462197 child.addChild(csg);
1747
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
17482199 csg.addChild(child);
17492200 child.addChild(csg);
17502201 } else
1751
- if (event.getSource() == tripleItem)
2202
+ if (source == tripleItem)
17522203 {
1753
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
17542205 csg.count = 4;
17552206 group(csg);
17562207 Composite child = new cGroup();
....@@ -1763,73 +2214,98 @@
17632214 csg.addChild(child);
17642215 child.addChild(csg);
17652216 } else
1766
-
1767
- if (event.getSource() == importGFDItem)
2217
+ if (source == computeAOItem)
17682218 {
1769
- ImportGFD();
2219
+ Globals.drawMode = CameraPane.OCCLUSION;
2220
+ Globals.theRenderer.repaint();
17702221 } else
1771
- if (event.getSource() == importVRMLX3DItem)
1772
- {
1773
- ImportVRMLX3D();
1774
- } else
1775
- if (event.getSource() == import3DSItem)
1776
- {
1777
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1778
- } else
1779
- if (event.getSource() == importOBJItem)
1780
- {
1781
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1782
- } else
1783
- if (event.getSource() == computeAOItem)
1784
- {
1785
- CameraPane.drawMode = CameraPane.OCCLUSION;
1786
- CameraPane.theRenderer.repaint();
1787
- } else
1788
- if (event.getSource() == recompileItem)
2222
+ if (source == recompileItem)
17892223 {
17902224 Recompile();
17912225 refreshContents();
17922226 } else
1793
- if (event.getSource() == editScriptItem)
2227
+ if (source == editScriptItem)
17942228 {
17952229 OpenDialog();
17962230 refreshContents();
17972231 } else
1798
- if (event.getSource() == invariantsItem)
2232
+ if (source == invariantsItem)
17992233 {
18002234 System.out.println("Invariants:");
1801
- GrafreeD.grafreeD.universe.invariants();
2235
+ Grafreed.grafreeD.universe.invariants();
18022236 } else
1803
- if (event.getSource() == memoryItem)
2237
+ if (source == memoryItem)
18042238 {
18052239 //System.out.println("Invariants:");
18062240 PrintMemory();
18072241 } else
1808
- if (event.getSource() == pathItem)
2242
+ if (source == pathItem)
18092243 {
18102244 PrintPath();
18112245 } else
1812
- if (event.getSource() == analyzeItem)
2246
+ if (source == analyzeItem)
18132247 {
18142248 AnalyzeObject();
18152249 } else
1816
- if (event.getSource() == dumpItem)
2250
+ if (source == dumpItem)
18172251 {
18182252 DumpObject();
18192253 } else
1820
- if (event.getSource() == screenfitButton)
2254
+ if (source == minButton)
18212255 {
1822
- //Reload(lastConverter, lastFilename, true);
2256
+ Minimize();
2257
+ } else
2258
+ if (source == maxButton)
2259
+ {
2260
+ Maximize();
2261
+ } else
2262
+ if (source == fullButton)
2263
+ {
2264
+ ToggleFullScreen();
2265
+ } else
2266
+ if (source == undoButton)
2267
+ {
2268
+ // Go to previous version
2269
+ //if (!Undo())
2270
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2271
+ Undo();
2272
+ } else
2273
+ if (source == restoreButton)
2274
+ {
2275
+ // Restore current version
2276
+ Restore();
2277
+ } else
2278
+ if (source == replaceButton)
2279
+ {
2280
+ // Overwrite current version
2281
+ Replace();
2282
+ } else
2283
+ if (source == redoButton)
2284
+ {
2285
+ // Go to next version
2286
+ Redo();
2287
+ } else
2288
+ if (source == saveButton)
2289
+ {
2290
+ // Save a new version
2291
+ if (!Save(true))
2292
+ java.awt.Toolkit.getDefaultToolkit().beep();
2293
+ } else
2294
+ if (source == oneStepButton)
2295
+ {
2296
+ Globals.ONESTEP = true;
2297
+ cameraView.repaint();
2298
+ } else
2299
+ if (source == screenfitButton)
2300
+ {
18232301 ScreenFit();
18242302 } else
1825
- if (event.getSource() == screenfitpointButton)
2303
+ if (source == screenfitpointButton)
18262304 {
1827
- //Reload(lastConverter, lastFilename, true);
18282305 ScreenFitPoint();
18292306 } else
1830
- if (event.getSource() == snapobjectButton)
2307
+ if (source == snapobjectButton)
18312308 {
1832
- //Reload(lastConverter, lastFilename, true);
18332309 SnapObject();
18342310 } else
18352311 // if (event.getSource() == recompileButton)
....@@ -1838,13 +2314,13 @@
18382314 // Recompile();
18392315 // refreshContents();
18402316 // } else
1841
- if (event.getSource() == gcButton)
2317
+ if (source == gcButton)
18422318 {
18432319 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18442320 System.gc();
18452321 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18462322 } else
1847
- if (event.getSource() == editLeafItem)
2323
+ if (source == editLeafItem)
18482324 {
18492325 Object3D obj;
18502326 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1858,62 +2334,74 @@
18582334 }
18592335 refreshContents(true);
18602336 } else
1861
- if (event.getSource() == openWindowItem)
2337
+ if (source == openWindowItem)
18622338 {
18632339 EditSelection(true);
18642340 } else
1865
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2341
+ if (source == cutItem || source == clearButton)
18662342 {
18672343 loadClipboard(true);
18682344 } else
1869
- if (event.getSource() == duplicateItem)
2345
+ if (source == undoItem)
18702346 {
1871
- Object3D keep = GrafreeD.clipboard;
2347
+ Undo();
2348
+ } else
2349
+ if (source == redoItem)
2350
+ {
2351
+ Redo();
2352
+ } else
2353
+ if (source == duplicateItem)
2354
+ {
2355
+ Object3D keep = Grafreed.clipboard;
18722356 loadClipboard(false);
18732357 paste(false);
1874
- GrafreeD.clipboard = keep;
2358
+ Grafreed.clipboard = keep;
18752359 } else
1876
- if (event.getSource() == cloneItem)
2360
+ if (source == cloneItem)
18772361 {
18782362 CloneSelection(false);
18792363 } else
1880
- if (event.getSource() == cloneSupportItem)
2364
+ if (source == cloneSupportItem)
18812365 {
18822366 CloneSelection(true);
18832367 } else
1884
- if (event.getSource() == copyItem)
2368
+ if (source == copyItem)
18852369 {
18862370 loadClipboard(false);
18872371 } else
1888
- if (event.getSource() == pasteItem)
2372
+ if (source == pasteItem)
18892373 {
18902374 paste(false);
18912375 } else
1892
- if (event.getSource() == pasteLinkItem)
2376
+ if (source == pasteIntoItem)
18932377 {
1894
- pasteInto(false);
2378
+ pasteInto(true, false);
18952379 } else
1896
- if (event.getSource() == pasteCloneItem)
2380
+ if (source == pasteLinkItem)
18972381 {
1898
- pasteInto(true);
2382
+ pasteInto(false, false);
18992383 } else
1900
- if (event.getSource() == pasteExpandItem)
2384
+ if (source == pasteCloneItem)
2385
+ {
2386
+ pasteInto(true, true);
2387
+ } else
2388
+ if (source == pasteExpandItem)
19012389 {
19022390 paste(true);
19032391 } else
1904
- if (event.getSource() == synchronizeItem)
2392
+ if (source == synchronizeItem)
19052393 {
19062394 Overwrite(Object3D.TRANSFORM);
19072395 } else
1908
- if (event.getSource() == overwriteNameItem)
2396
+ if (source == overwriteNameItem)
19092397 {
19102398 Overwrite(Object3D.NAME);
19112399 } else
1912
- if (event.getSource() == overwriteUVItem)
2400
+ if (source == overwriteUVItem)
19132401 {
19142402 Overwrite(Object3D.UV);
19152403 } else
1916
- if (event.getSource() == overwriteMatItem)
2404
+ if (source == overwriteMatItem)
19172405 {
19182406 /* july 2015
19192407 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1933,7 +2421,7 @@
19332421
19342422 Overwrite(dropAttributes);
19352423 }
1936
- if (event.getSource() == overwriteGeoItem)
2424
+ if (source == overwriteGeoItem)
19372425 {
19382426 Overwrite(Object3D.GEOMETRY);
19392427 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1950,7 +2438,7 @@
19502438 // refreshContents();
19512439 // }
19522440 } else
1953
- if (event.getSource() == generateMeshItem)
2441
+ if (source == generateMeshItem)
19542442 {
19552443 //if (group.selection.size() == 1)
19562444 // for (int i=0; i<group.selection.size(); i++)
....@@ -1961,7 +2449,7 @@
19612449 ResetModel();
19622450 refreshContents();
19632451 } else
1964
- if (event.getSource() == extractGeometriesItem)
2452
+ if (source == extractGeometriesItem)
19652453 {
19662454 boolean one = false;
19672455
....@@ -1988,7 +2476,7 @@
19882476 ResetModel();
19892477 refreshContents();
19902478 } else
1991
- if (event.getSource() == cloneGeometriesItem)
2479
+ if (source == cloneGeometriesItem)
19922480 {
19932481 boolean one = false;
19942482
....@@ -2014,7 +2502,7 @@
20142502 ResetModel();
20152503 refreshContents();
20162504 } else
2017
- if (event.getSource() == shareGeometriesItem)
2505
+ if (source == shareGeometriesItem)
20182506 {
20192507 boolean one = false;
20202508
....@@ -2044,7 +2532,7 @@
20442532 refreshContents();
20452533 }
20462534 } else
2047
- if (event.getSource() == mergeGeometriesItem)
2535
+ if (source == mergeGeometriesItem)
20482536 {
20492537 boolean one = false;
20502538
....@@ -2074,7 +2562,7 @@
20742562 ResetModel();
20752563 refreshContents();
20762564 } else
2077
- if (event.getSource() == linkverticesItem)
2565
+ if (source == linkverticesItem)
20782566 {
20792567 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20802568 // {
....@@ -2087,48 +2575,48 @@
20872575 // group.selection.get(0).setMasterThis(content); // should be identity
20882576 // refreshContents();
20892577 // }
2090
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2578
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20912579 {
2092
- Object3D content = GrafreeD.clipboard.get(0);
2580
+ Object3D content = Grafreed.clipboard.get(0);
20932581
20942582 if (content instanceof cGroup && ((cGroup)content).transientlink )
20952583 content = ((cGroup)content).get(0);
20962584
2097
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2585
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20982586 for (int i=0; i<group.selection.size(); i++)
20992587 {
2100
- boolean random = CameraPane.RANDOM;
2101
- CameraPane.RANDOM = false; // parse all random nodes
2588
+ boolean random = CameraPane.SWITCH;
2589
+ CameraPane.SWITCH = false; // parse all random nodes
21022590 group.selection.get(i).linkVerticesThis(content);
21032591 // group.selection.get(i).setMasterThis(content); // should be identity
2104
- CameraPane.RANDOM = random;
2592
+ CameraPane.SWITCH = random;
21052593 }
2106
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2594
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21072595 refreshContents();
21082596 }
21092597 } else
2110
- if (event.getSource() == resetsupportItem)
2598
+ if (source == resetsupportItem)
21112599 {
21122600 for (int i=0; i<group.selection.size(); i++)
21132601 {
2114
- boolean random = CameraPane.RANDOM;
2115
- CameraPane.RANDOM = false; // parse all random nodes
2602
+ boolean random = CameraPane.SWITCH;
2603
+ CameraPane.SWITCH = false; // parse all random nodes
21162604 group.selection.get(i).linkVerticesThis(null);
2117
- CameraPane.RANDOM = random;
2605
+ CameraPane.SWITCH = random;
21182606 }
21192607
21202608 refreshContents();
21212609 } else
2122
- if (event.getSource() == relinkverticesItem)
2610
+ if (source == relinkverticesItem)
21232611 {
2124
- boolean random = CameraPane.RANDOM;
2125
- CameraPane.RANDOM = false; // parse all random nodes
2612
+ boolean random = CameraPane.SWITCH;
2613
+ CameraPane.SWITCH = false; // parse all random nodes
21262614 group.selection.RelinkToSupport();
2127
- CameraPane.RANDOM = random;
2615
+ CameraPane.SWITCH = random;
21282616
21292617 refreshContents();
21302618 } else
2131
- if (event.getSource() == resetreferencesItem)
2619
+ if (source == resetreferencesItem)
21322620 {
21332621 for (int i=0; i<group.selection.size(); i++)
21342622 {
....@@ -2137,11 +2625,11 @@
21372625
21382626 refreshContents();
21392627 } else
2140
- if (event.getSource() == setMasterItem)
2628
+ if (source == setMasterItem)
21412629 {
2142
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2630
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21432631 {
2144
- Object3D content = GrafreeD.clipboard.get(0);
2632
+ Object3D content = Grafreed.clipboard.get(0);
21452633
21462634 if (content instanceof cGroup && ((cGroup)content).transientlink )
21472635 content = ((cGroup)content).get(0);
....@@ -2150,13 +2638,13 @@
21502638 refreshContents();
21512639 }
21522640 } else
2153
- if (event.getSource() == poseMeshItem)
2641
+ if (source == poseMeshItem)
21542642 {
21552643 if (group.selection.size() == 1)
21562644 {
2157
- if (GrafreeD.clipboard.size() == 1)
2645
+ if (Grafreed.clipboard.size() == 1)
21582646 {
2159
- Object3D content = GrafreeD.clipboard.get(0);
2647
+ Object3D content = Grafreed.clipboard.get(0);
21602648
21612649 if (content instanceof cGroup && ((cGroup)content).transientlink )
21622650 content = ((cGroup)content).get(0);
....@@ -2169,19 +2657,19 @@
21692657 }
21702658
21712659 } else
2172
- if (event.getSource() == revertMeshItem)
2660
+ if (source == revertMeshItem)
21732661 {
21742662 RevertMeshes();
21752663 } else
2176
- if (event.getSource() == resetMeshItem)
2664
+ if (source == resetAllItem)
21772665 {
21782666 ResetAll();
21792667 } else
2180
- if (event.getSource() == stepAllItem)
2668
+ if (source == stepAllItem)
21812669 {
21822670 StepAll();
21832671 } else
2184
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
21852673 {
21862674 //int indices[] = jList.getSelectedIndices();
21872675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2189,46 +2677,46 @@
21892677
21902678 ClearSelection(false);
21912679 } else
2192
- if (event.getSource() == clearAllItem)
2680
+ if (source == clearAllItem)
21932681 {
21942682 ClearSelection(true);
21952683 } else
2196
- if (event.getSource() == grabItem)
2684
+ if (source == grabItem || source == groupButton)
21972685 {
2198
- group(new cGroup(), true);
2686
+ group(new cGroup(), false); // true);
21992687 } else
2200
- if (event.getSource() == hideItem)
2688
+ if (source == hideItem)
22012689 {
22022690 group(new HiddenObject());
22032691 } else
2204
- if (event.getSource() == frontItem)
2692
+ if (source == frontItem)
22052693 {
22062694 front();
22072695 } else
2208
- if (event.getSource() == backItem)
2696
+ if (source == backItem)
22092697 {
22102698 back();
22112699 } else
2212
- if (event.getSource() == cameraItem)
2700
+ if (source == cameraItem)
22132701 {
22142702 makeSomething(new Camera());
22152703 } else
2216
- if (event.getSource() == compositeItem)
2704
+ if (source == compositeItem || source == compositeButton)
22172705 {
22182706 group(new Composite());
22192707 } else
2220
- if (event.getSource() == randomItem)
2708
+ if (source == switchItem || source == switchButton)
22212709 {
22222710 RandomNode random = new RandomNode();
22232711 group(random);
22242712 if (random.size() > 0)
2225
- random.name = random.get(0).name + "Rnd";
2713
+ random.name = random.get(0).name + "Switch";
22262714 } else
2227
- if (event.getSource() == physicsItem)
2715
+ if (source == physicsItem)
22282716 {
22292717 group(new PhysicsNode());
22302718 } else
2231
- if (event.getSource() == frameselectorItem)
2719
+ if (source == frameselectorItem)
22322720 {
22332721 for (int i=0; i<group.selection.size(); i++)
22342722 {
....@@ -2240,7 +2728,7 @@
22402728 ResetModel();
22412729 refreshContents();
22422730 } else
2243
- if (event.getSource() == switchGeoItem)
2731
+ if (source == switchGeoItem)
22442732 {
22452733 for (int i=0; i<group.selection.size(); i++)
22462734 {
....@@ -2252,7 +2740,7 @@
22522740 ResetModel();
22532741 refreshContents();
22542742 } else
2255
- if (event.getSource() == switchTransfoItem)
2743
+ if (source == switchTransfoItem)
22562744 {
22572745 for (int i=0; i<group.selection.size(); i++)
22582746 {
....@@ -2264,7 +2752,7 @@
22642752 ResetModel();
22652753 refreshContents();
22662754 } else
2267
- if (event.getSource() == morphItem)
2755
+ if (source == morphItem)
22682756 {
22692757 for (int i=0; i<group.selection.size(); i++)
22702758 {
....@@ -2276,7 +2764,7 @@
22762764 ResetModel();
22772765 refreshContents();
22782766 } else
2279
- if (event.getSource() == scriptNodeItem)
2767
+ if (source == scriptNodeItem)
22802768 {
22812769 boolean atleastone = false;
22822770
....@@ -2315,215 +2803,252 @@
23152803 }
23162804 }
23172805 } else
2318
- if (event.getSource() == linkerItem)
2806
+ if (source == linkerItem)
23192807 {
23202808 group(new cLinker());
23212809 } else
2322
- if (event.getSource() == textureItem)
2810
+ if (source == textureItem || source == textureButton)
23232811 {
23242812 group(new TextureNode());
23252813 } else
2326
- if (event.getSource() == billboardItem)
2814
+ if (source == billboardItem)
23272815 {
23282816 group(new BillboardNode());
23292817 } else
2330
- if (event.getSource() == shadowXItem)
2818
+ if (source == shadowXItem)
23312819 {
23322820 CastShadow(0);
23332821 } else
2334
- if (event.getSource() == shadowYItem)
2822
+ if (source == shadowYItem)
23352823 {
23362824 CastShadow(1);
23372825 } else
2338
- if (event.getSource() == shadowZItem)
2826
+ if (source == shadowZItem)
23392827 {
23402828 CastShadow(2);
23412829 } else
2342
- if (event.getSource() == ungroupItem)
2830
+ if (source == ungroupItem || source == ungroupButton)
23432831 {
2344
- //ungroup();
2832
+ boolean hasRoot = false;
2833
+
23452834 for (int i=0; i<group.selection.size(); i++)
23462835 {
2347
- Ungroup(group.selection.get(i));
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
23482841 }
23492842
2350
- ClearSelection(false);
2351
-
2352
- refreshContents();
2843
+ if (!hasRoot)
2844
+ {
2845
+ for (int i=0; i<group.selection.size(); i++)
2846
+ {
2847
+ Ungroup(group.selection.get(i));
2848
+ }
2849
+
2850
+ ClearSelection(false);
2851
+
2852
+ refreshContents();
2853
+ }
23532854 } else
2354
- if (event.getSource() == genUVItem)
2855
+ if (source == genUVItem)
23552856 {
23562857 GenUV();
23572858 } else
2358
- if (event.getSource() == genNormalsCADItem)
2859
+ if (source == genNormalsCADItem)
23592860 {
23602861 GenNormals(true);
23612862 } else
2362
- if (event.getSource() == genNormalsMESHItem)
2863
+ if (source == genNormalsMESHItem)
23632864 {
2364
- GenNormals(true); // TODO
2865
+ GenNormalsMESH();
23652866 } else
2366
- if (event.getSource() == genNormalsORGANItem)
2867
+ if (source == genNormalsORGANItem)
23672868 {
23682869 GenNormals(false);
23692870 } else
2370
- if (event.getSource() == genNormalsMINEItem)
2871
+ if (source == genNormalsMINEItem)
23712872 {
23722873 GenNormalsMINE();
23732874 } else
2374
- if (event.getSource() == stripifyItem)
2875
+ if (source == stripifyItem)
23752876 {
23762877 Stripify();
23772878 } else
2378
- if (event.getSource() == unstripifyItem)
2879
+ if (source == unstripifyItem)
23792880 {
23802881 Unstripify();
23812882 } else
2382
- if (event.getSource() == trimItem)
2883
+ if (source == trimItem)
23832884 {
23842885 Trim();
23852886 } else
2386
- if (event.getSource() == untrimItem)
2887
+ if (source == untrimItem)
23872888 {
23882889 Untrim();
23892890 } else
2390
- if (event.getSource() == clearColorsItem)
2891
+ if (source == clearColorsItem)
23912892 {
23922893 ClearColors();
23932894 } else
2394
- if (event.getSource() == clearMaterialsItem)
2895
+ if (source == clearMaterialsItem)
23952896 {
23962897 ClearMaterials();
23972898 } else
2398
- if (event.getSource() == liveleavesItem)
2899
+ if (source == liveleavesItem)
23992900 {
24002901 LiveLeaves(true);
24012902 } else
2402
- if (event.getSource() == unliveleavesItem)
2903
+ if (source == unliveleavesItem)
24032904 {
24042905 LiveLeaves(false);
24052906 } else
2406
- if (event.getSource() == supportleavesItem)
2907
+ if (source == supportleavesItem)
24072908 {
24082909 SupportLeaves(true);
24092910 } else
2410
- if (event.getSource() == unsupportleavesItem)
2911
+ if (source == unsupportleavesItem)
24112912 {
24122913 SupportLeaves(false);
24132914 } else
2414
- if (event.getSource() == hideleavesItem)
2915
+ if (source == hideleavesItem)
24152916 {
24162917 HideLeaves(true);
24172918 } else
2418
- if (event.getSource() == showleavesItem)
2919
+ if (source == showleavesItem)
24192920 {
24202921 HideLeaves(false);
24212922 } else
2422
- if (event.getSource() == markleavesItem)
2923
+ if (source == markleavesItem)
24232924 {
24242925 MarkLeaves(true);
24252926 } else
2426
- if (event.getSource() == unmarkleavesItem)
2927
+ if (source == unmarkleavesItem)
24272928 {
24282929 MarkLeaves(false);
24292930 } else
2430
- if (event.getSource() == flipVItem)
2931
+ if (source == rewindleavesItem)
2932
+ {
2933
+ RewindLeaves(true);
2934
+ } else
2935
+ if (source == unrewindleavesItem)
2936
+ {
2937
+ RewindLeaves(false);
2938
+ } else
2939
+ if (source == randomleavesItem)
2940
+ {
2941
+ RandomLeaves(true);
2942
+ } else
2943
+ if (source == unrandomleavesItem)
2944
+ {
2945
+ RandomLeaves(false);
2946
+ } else
2947
+ if (source == flipVItem)
24312948 {
24322949 FlipV(true);
24332950 } else
2434
- if (event.getSource() == unflipVItem)
2951
+ if (source == unflipVItem)
24352952 {
24362953 FlipV(false);
24372954 } else
2438
- if (event.getSource() == lowTexturesItem)
2955
+ if (source == lowTexturesItem)
24392956 {
24402957 SetTexRes(0);
24412958 } else
2442
- if (event.getSource() == normalTexturesItem)
2959
+ if (source == normalTexturesItem)
24432960 {
24442961 SetTexRes(1);
24452962 } else
2446
- if (event.getSource() == highTexturesItem)
2963
+ if (source == highTexturesItem)
24472964 {
24482965 SetTexRes(2);
24492966 } else
2450
- if (event.getSource() == veryhighTexturesItem)
2967
+ if (source == veryhighTexturesItem)
24512968 {
24522969 SetTexRes(3);
24532970 } else
2454
- if (event.getSource() == maxTexturesItem)
2971
+ if (source == maxTexturesItem)
24552972 {
24562973 SetTexRes(4);
24572974 } else
2458
- if (event.getSource() == panoTexturesItem)
2975
+ if (source == panoTexturesItem)
24592976 {
24602977 SetTexRes(5);
24612978 } else
2462
- if (event.getSource() == reverseNormalsItem)
2979
+ if (source == reverseNormalsItem)
24632980 {
24642981 ReverseNormals();
24652982 } else
2466
- if (event.getSource() == parseverticesItem)
2983
+ if (source == parseverticesItem)
24672984 {
24682985 ParseVertices();
24692986 } else
2470
- if (event.getSource() == textureFieldItem)
2987
+ if (source == textureFieldItem)
24712988 {
24722989 TextureVertices();
24732990 } else
2474
- if (event.getSource() == alignItem)
2991
+ if (source == alignItem)
24752992 {
24762993 Align();
24772994 } else
2478
- if (event.getSource() == mirrorItem)
2995
+ if (source == mirrorItem)
24792996 {
24802997 MirrorPoses();
24812998 } else
2482
- if (event.getSource() == reduceMorphItem)
2999
+ if (source == reduceMorphItem)
24833000 {
24843001 MeshReduction(false);
24853002 } else
2486
- if (event.getSource() == reduce34MorphItem)
3003
+ if (source == reduce34MorphItem)
24873004 {
24883005 MeshReduction(true);
24893006 } else
2490
- if (event.getSource() == reverseTrianglesItem)
3007
+ if (source == reverseTrianglesItem)
24913008 {
24923009 ReverseTriangles();
24933010 } else
2494
- if (event.getSource() == reduceMeshItem)
3011
+ if (source == reduceMeshItem)
24953012 {
24963013 ReduceMesh(false);
24973014 } else
2498
- if (event.getSource() == reduce34MeshItem)
3015
+ if (source == reduce34MeshItem)
24993016 {
25003017 ReduceMesh(true);
25013018 } else
2502
- if (event.getSource() == increaseMeshItem)
3019
+ if (source == increaseMeshItem)
25033020 {
25043021 IncreaseMesh();
25053022 } else
2506
- if (event.getSource() == clipMeshItem)
3023
+ if (source == clipMeshItem)
25073024 {
25083025 ClipMesh();
25093026 } else
2510
- if (event.getSource() == smoothMeshItem)
3027
+ if (source == smoothMeshItem)
25113028 {
25123029 SmoothMesh();
25133030 } else
2514
- if (event.getSource() == transformgeometryItem)
3031
+ if (source == transformGeometryItem)
25153032 {
25163033 TransformGeometry();
25173034 } else
2518
- if (event.getSource() == resetTransformItem)
3035
+ if (source == transformChildrenItem)
3036
+ {
3037
+ TransformChildren();
3038
+ } else
3039
+ if (source == resetTransformItem)
25193040 {
25203041 ResetTransform();
25213042 } else
2522
- if (event.getSource() == resetCentroidItem)
3043
+ if (source == resetCentroidItem)
25233044 {
2524
- ResetCentroid();
3045
+ ResetCentroid(true);
25253046 } else
2526
- if (event.getSource() == resetParentItem)
3047
+ if (source == resetCentroidXZItem)
3048
+ {
3049
+ ResetCentroid(false);
3050
+ } else
3051
+ if (source == resetParentItem)
25273052 {
25283053 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25293054 {
....@@ -2533,7 +3058,7 @@
25333058
25343059 refreshContents();
25353060 } else
2536
- if (event.getSource() == repairParentItem)
3061
+ if (source == repairParentItem)
25373062 {
25383063 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25393064 {
....@@ -2547,7 +3072,7 @@
25473072
25483073 refreshContents();
25493074 } else
2550
- if (event.getSource() == repairShadowItem)
3075
+ if (source == repairShadowItem)
25513076 {
25523077 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25533078 {
....@@ -2561,7 +3086,7 @@
25613086
25623087 refreshContents();
25633088 } else
2564
- if (event.getSource() == sortbysizeItem)
3089
+ if (source == sortbysizeItem)
25653090 {
25663091 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25673092 {
....@@ -2573,7 +3098,7 @@
25733098 ResetModel();
25743099 refreshContents();
25753100 } else
2576
- if (event.getSource() == sortbynameItem)
3101
+ if (source == sortbynameItem)
25773102 {
25783103 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25793104 {
....@@ -2585,7 +3110,7 @@
25853110 ResetModel();
25863111 refreshContents();
25873112 } else
2588
- if (event.getSource() == attachPigmentItem)
3113
+ if (source == attachPigmentItem)
25893114 {
25903115 String texture = GetFile("Attach pigment");
25913116 Object3D obj;
....@@ -2597,7 +3122,7 @@
25973122
25983123 refreshContents();
25993124 } else
2600
- if (event.getSource() == detachPigmentItem)
3125
+ if (source == detachPigmentItem)
26013126 {
26023127 Object3D obj;
26033128 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2608,7 +3133,7 @@
26083133
26093134 refreshContents();
26103135 } else
2611
- if (event.getSource() == attachBumpItem)
3136
+ if (source == attachBumpItem)
26123137 {
26133138 String texture = GetFile("Attach bump");
26143139 Object3D obj;
....@@ -2620,7 +3145,7 @@
26203145
26213146 refreshContents();
26223147 } else
2623
- if (event.getSource() == detachBumpItem)
3148
+ if (source == detachBumpItem)
26243149 {
26253150 Object3D obj;
26263151 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2631,7 +3156,7 @@
26313156
26323157 refreshContents();
26333158 } else
2634
- if (event.getSource() == pigmentBumpItem)
3159
+ if (source == pigmentBumpItem)
26353160 {
26363161 Object3D obj;
26373162 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2642,158 +3167,237 @@
26423167
26433168 refreshContents();
26443169 } else
2645
- if (event.getSource() == flashSelectionButton)
3170
+ if (source == flashSelectionButton)
26463171 {
26473172 CameraPane.flash = true;
26483173 refreshContents();
26493174 } else
2650
- if (event.getSource() == oneButton)
3175
+ if (source == oneButton)
26513176 {
26523177 } else
2653
- if (event.getSource() == twoButton)
3178
+ if (source == twoButton)
26543179 {
26553180 radio.layout = twoButton;
3181
+
3182
+ if (CameraPane.FULLSCREEN)
3183
+ fullscreenLayout = radio.layout;
3184
+
26563185 // bug
26573186 //gridPanel.setDividerLocation(1.0);
26583187 //bigPanel.setDividerLocation(0.0);
2659
- bigThree.remove(scenePanel);
2660
- bigThree.remove(centralPanel);
2661
- bigThree.remove(XYZPanel);
2662
- aWindowConstraints.gridx = 0;
2663
- aWindowConstraints.gridy = 0;
2664
- aWindowConstraints.gridwidth = 1;
2665
- // aConstraints.gridheight = 3;
2666
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2667
- aWindowConstraints.weightx = 0;
2668
- aWindowConstraints.weighty = 1;
2669
- //bigThree.add(jtp, aWindowConstraints);
2670
- aWindowConstraints.weightx = 1;
2671
- aWindowConstraints.gridwidth = 3;
2672
- // aConstraints.gridheight = 3;
2673
- aWindowConstraints.gridx = 1;
2674
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2675
- bigThree.add(centralPanel, aWindowConstraints);
2676
- aWindowConstraints.weightx = 0;
2677
- aWindowConstraints.gridx = 4;
2678
- aWindowConstraints.gridwidth = 1;
2679
- // aConstraints.gridheight = 3;
2680
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2681
- //bigThree.add(XYZPanel, aWindowConstraints);
2682
- bigThree.revalidate();
3188
+// bigThree.remove(scenePanel);
3189
+// bigThree.remove(centralPanel);
3190
+// bigThree.remove(XYZPanel);
3191
+// aWindowConstraints.gridx = 0;
3192
+// aWindowConstraints.gridy = 0;
3193
+// aWindowConstraints.gridwidth = 1;
3194
+// // aConstraints.gridheight = 3;
3195
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3196
+// aWindowConstraints.weightx = 0;
3197
+// aWindowConstraints.weighty = 1;
3198
+// //bigThree.add(jtp, aWindowConstraints);
3199
+// aWindowConstraints.weightx = 1;
3200
+// aWindowConstraints.gridwidth = 3;
3201
+// // aConstraints.gridheight = 3;
3202
+// aWindowConstraints.gridx = 1;
3203
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3204
+// bigThree.add(centralPanel, aWindowConstraints);
3205
+// aWindowConstraints.weightx = 0;
3206
+// aWindowConstraints.gridx = 4;
3207
+// aWindowConstraints.gridwidth = 1;
3208
+// // aConstraints.gridheight = 3;
3209
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3210
+// //bigThree.add(XYZPanel, aWindowConstraints);
3211
+// scenePanel.setVisible(false);
3212
+// centralPanel.setVisible(true);
3213
+// XYZPanel.setVisible(false);
3214
+ bigThree.ClearUI();
3215
+ bigThree.add(centralPanel);
3216
+ bigThree.FlushUI();
3217
+
3218
+ cameraView.requestFocusInWindow();
3219
+
3220
+// refreshContents(true);
3221
+//
3222
+// try
3223
+// {
3224
+// java.awt.Robot bot = new java.awt.Robot();
3225
+// int mask = InputEvent.BUTTON1_MASK;
3226
+// bot.mouseMove(100, 100);
3227
+// bot.mousePress(mask);
3228
+// bot.mouseRelease(mask);
3229
+// }
3230
+// catch (Exception e)
3231
+// {
3232
+//
3233
+// }
3234
+
26833235 } else
2684
- if (event.getSource() == threeButton)
3236
+ if (source == threeButton)
26853237 {
26863238 radio.layout = threeButton;
2687
- bigThree.remove(scenePanel);
2688
- bigThree.remove(centralPanel);
2689
- bigThree.remove(XYZPanel);
2690
- aWindowConstraints.gridx = 0;
2691
- aWindowConstraints.gridy = 0;
2692
- aWindowConstraints.gridwidth = 1;
2693
- // aConstraints.gridheight = 3;
2694
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2695
- aWindowConstraints.weightx = 0;
2696
- aWindowConstraints.weighty = 1;
2697
- //bigThree.add(jtp, aWindowConstraints);
2698
- aWindowConstraints.weightx = 1;
2699
- aWindowConstraints.gridwidth = 3;
2700
- // aConstraints.gridheight = 3;
2701
- aWindowConstraints.gridx = 1;
2702
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2703
- bigThree.add(centralPanel, aWindowConstraints);
2704
- aWindowConstraints.weightx = 0;
2705
- aWindowConstraints.gridx = 4;
2706
- aWindowConstraints.gridwidth = 1;
2707
- // aConstraints.gridheight = 3;
2708
- aConstraints.fill = GridBagConstraints.VERTICAL;
2709
- bigThree.add(XYZPanel, aWindowConstraints);
2710
- bigThree.revalidate();
3239
+
3240
+ if (CameraPane.FULLSCREEN)
3241
+ fullscreenLayout = radio.layout;
3242
+
3243
+// bigThree.remove(scenePanel);
3244
+// bigThree.remove(centralPanel);
3245
+// bigThree.remove(XYZPanel);
3246
+// aWindowConstraints.gridx = 0;
3247
+// aWindowConstraints.gridy = 0;
3248
+// aWindowConstraints.gridwidth = 1;
3249
+// // aConstraints.gridheight = 3;
3250
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3251
+// aWindowConstraints.weightx = 0;
3252
+// aWindowConstraints.weighty = 1;
3253
+// //bigThree.add(jtp, aWindowConstraints);
3254
+// aWindowConstraints.weightx = 1;
3255
+// aWindowConstraints.gridwidth = 3;
3256
+// // aConstraints.gridheight = 3;
3257
+// aWindowConstraints.gridx = 1;
3258
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3259
+// bigThree.add(centralPanel, aWindowConstraints);
3260
+// aWindowConstraints.weightx = 0;
3261
+// aWindowConstraints.gridx = 4;
3262
+// aWindowConstraints.gridwidth = 1;
3263
+// // aConstraints.gridheight = 3;
3264
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3265
+// bigThree.add(XYZPanel, aWindowConstraints);
3266
+// bigThree.validate();
3267
+// scenePanel.setVisible(false);
3268
+// centralPanel.setVisible(true);
3269
+// XYZPanel.setVisible(true);
3270
+ bigThree.ClearUI();
3271
+ bigThree.add(centralPanel);
3272
+ bigThree.add(XYZPanel);
3273
+ bigThree.FlushUI();
3274
+
3275
+ cameraView.requestFocusInWindow();
27113276 } else
2712
- if (event.getSource() == fourButton)
3277
+ if (source == fourButton)
27133278 {
27143279 radio.layout = fourButton;
2715
- bigThree.remove(scenePanel);
2716
- bigThree.remove(centralPanel);
2717
- bigThree.remove(XYZPanel);
2718
- aWindowConstraints.gridx = 0;
2719
- aWindowConstraints.gridy = 0;
2720
- aWindowConstraints.gridwidth = 1;
2721
- // aWindowConstraints.gridheight = 3;
2722
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2723
- aWindowConstraints.weightx = 1;
2724
- aWindowConstraints.weighty = 1;
2725
- bigThree.add(scenePanel, aWindowConstraints);
2726
- aWindowConstraints.weightx = 1;
2727
- aWindowConstraints.gridwidth = 3;
2728
- // aConstraints.gridheight = 3;
2729
- aWindowConstraints.gridx = 1;
2730
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2731
- //bigThree.add(cameraPanel, aWindowConstraints);
2732
- aWindowConstraints.weightx = 0;
2733
- aWindowConstraints.gridx = 4;
2734
- aWindowConstraints.gridwidth = 1;
2735
- // aWindowConstraints.gridheight = 3;
2736
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2737
- //bigThree.add(XYZPanel, aWindowConstraints);
2738
- bigThree.revalidate();
3280
+
3281
+ if (CameraPane.FULLSCREEN)
3282
+ fullscreenLayout = radio.layout;
3283
+
3284
+// bigThree.remove(scenePanel);
3285
+// bigThree.remove(centralPanel);
3286
+// bigThree.remove(XYZPanel);
3287
+// aWindowConstraints.gridx = 0;
3288
+// aWindowConstraints.gridy = 0;
3289
+// aWindowConstraints.gridwidth = 1;
3290
+// // aWindowConstraints.gridheight = 3;
3291
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3292
+// aWindowConstraints.weightx = 1;
3293
+// aWindowConstraints.weighty = 1;
3294
+// bigThree.add(scenePanel, aWindowConstraints);
3295
+// aWindowConstraints.weightx = 1;
3296
+// aWindowConstraints.gridwidth = 3;
3297
+// // aConstraints.gridheight = 3;
3298
+// aWindowConstraints.gridx = 1;
3299
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3300
+// //bigThree.add(cameraPanel, aWindowConstraints);
3301
+// aWindowConstraints.weightx = 0;
3302
+// aWindowConstraints.gridx = 4;
3303
+// aWindowConstraints.gridwidth = 1;
3304
+// // aWindowConstraints.gridheight = 3;
3305
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3306
+// //bigThree.add(XYZPanel, aWindowConstraints);
3307
+// bigThree.validate();
3308
+// scenePanel.setVisible(true);
3309
+// centralPanel.setVisible(false);
3310
+// XYZPanel.setVisible(false);
3311
+ bigThree.ClearUI();
3312
+ bigThree.add(scenePanel);
3313
+ bigThree.FlushUI();
3314
+
3315
+ cameraView.requestFocusInWindow();
27393316 } else
2740
- if (event.getSource() == sixButton)
3317
+ if (source == sixButton)
27413318 {
27423319 radio.layout = sixButton;
2743
- bigThree.remove(scenePanel);
2744
- bigThree.remove(centralPanel);
2745
- bigThree.remove(XYZPanel);
2746
- aWindowConstraints.gridx = 0;
2747
- aWindowConstraints.gridy = 0;
2748
- aWindowConstraints.gridwidth = 1;
2749
- // aConstraints.gridheight = 3;
2750
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2751
- aWindowConstraints.weightx = 0;
2752
- aWindowConstraints.weighty = 1;
2753
- bigThree.add(scenePanel, aWindowConstraints);
2754
- aWindowConstraints.weightx = 1;
2755
- aWindowConstraints.gridwidth = 3;
2756
- // aWindowConstraints.gridheight = 3;
2757
- aWindowConstraints.gridx = 1;
2758
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2759
- bigThree.add(centralPanel, aWindowConstraints);
2760
- aWindowConstraints.weightx = 0;
2761
- aWindowConstraints.gridx = 4;
2762
- aWindowConstraints.gridwidth = 1;
2763
- // aWindowConstraints.gridheight = 3;
2764
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2765
- //bigThree.add(XYZPanel, aConstraints);
2766
- bigThree.revalidate();
3320
+
3321
+ if (CameraPane.FULLSCREEN)
3322
+ fullscreenLayout = radio.layout;
3323
+
3324
+// bigThree.remove(scenePanel);
3325
+// bigThree.remove(centralPanel);
3326
+// bigThree.remove(XYZPanel);
3327
+// aWindowConstraints.gridx = 0;
3328
+// aWindowConstraints.gridy = 0;
3329
+// aWindowConstraints.gridwidth = 1;
3330
+// // aConstraints.gridheight = 3;
3331
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3332
+// aWindowConstraints.weightx = 0;
3333
+// aWindowConstraints.weighty = 1;
3334
+// bigThree.add(scenePanel, aWindowConstraints);
3335
+// aWindowConstraints.weightx = 1;
3336
+// aWindowConstraints.gridwidth = 3;
3337
+// // aWindowConstraints.gridheight = 3;
3338
+// aWindowConstraints.gridx = 1;
3339
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3340
+// bigThree.add(centralPanel, aWindowConstraints);
3341
+// aWindowConstraints.weightx = 0;
3342
+// aWindowConstraints.gridx = 4;
3343
+// aWindowConstraints.gridwidth = 1;
3344
+// // aWindowConstraints.gridheight = 3;
3345
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3346
+// //bigThree.add(XYZPanel, aConstraints);
3347
+// bigThree.validate();
3348
+// scenePanel.setVisible(true);
3349
+// centralPanel.setVisible(true);
3350
+// XYZPanel.setVisible(false);
3351
+ bigThree.ClearUI();
3352
+ bigThree.add(scenePanel);
3353
+ bigThree.add(centralPanel);
3354
+ bigThree.FlushUI();
3355
+
3356
+ cameraView.requestFocusInWindow();
27673357 } else
2768
- if (event.getSource() == sevenButton)
3358
+ if (source == sevenButton)
27693359 {
27703360 radio.layout = sevenButton;
2771
- bigThree.remove(scenePanel);
2772
- bigThree.remove(centralPanel);
2773
- bigThree.remove(XYZPanel);
2774
- aWindowConstraints.gridx = 0;
2775
- aWindowConstraints.gridy = 0;
2776
- aWindowConstraints.gridwidth = 1;
2777
- // aWindowConstraints.gridheight = 3;
2778
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2779
- aWindowConstraints.weightx = 0;
2780
- aWindowConstraints.weighty = 1;
2781
- bigThree.add(scenePanel, aWindowConstraints);
2782
- aWindowConstraints.weightx = 1;
2783
- aWindowConstraints.gridwidth = 3;
2784
- // aWindowConstraints.gridheight = 3;
2785
- aWindowConstraints.gridx = 1;
2786
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2787
- bigThree.add(centralPanel, aWindowConstraints);
2788
- aWindowConstraints.weightx = 0;
2789
- aWindowConstraints.gridx = 4;
2790
- aWindowConstraints.gridwidth = 1;
2791
- // aConstraints.gridheight = 3;
2792
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2793
- bigThree.add(XYZPanel, aWindowConstraints);
2794
- bigThree.revalidate();
3361
+
3362
+ if (CameraPane.FULLSCREEN)
3363
+ fullscreenLayout = radio.layout;
3364
+
3365
+// bigThree.remove(scenePanel);
3366
+// bigThree.remove(centralPanel);
3367
+// bigThree.remove(XYZPanel);
3368
+// aWindowConstraints.gridx = 0;
3369
+// aWindowConstraints.gridy = 0;
3370
+// aWindowConstraints.gridwidth = 1;
3371
+// // aWindowConstraints.gridheight = 3;
3372
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3373
+// aWindowConstraints.weightx = 0;
3374
+// aWindowConstraints.weighty = 1;
3375
+// bigThree.add(scenePanel, aWindowConstraints);
3376
+// aWindowConstraints.weightx = 1;
3377
+// aWindowConstraints.gridwidth = 3;
3378
+// // aWindowConstraints.gridheight = 3;
3379
+// aWindowConstraints.gridx = 1;
3380
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3381
+// bigThree.add(centralPanel, aWindowConstraints);
3382
+// aWindowConstraints.weightx = 0;
3383
+// aWindowConstraints.gridx = 4;
3384
+// aWindowConstraints.gridwidth = 1;
3385
+// // aConstraints.gridheight = 3;
3386
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3387
+// bigThree.add(XYZPanel, aWindowConstraints);
3388
+// bigThree.validate();
3389
+// scenePanel.setVisible(true);
3390
+// centralPanel.setVisible(true);
3391
+// XYZPanel.setVisible(true);
3392
+ bigThree.ClearUI();
3393
+ bigThree.add(scenePanel);
3394
+ bigThree.add(centralPanel);
3395
+ bigThree.add(XYZPanel);
3396
+ bigThree.FlushUI();
3397
+
3398
+ cameraView.requestFocusInWindow();
27953399 } else
2796
- if (event.getSource() == rootButton)
3400
+ if (source == rootButton)
27973401 {
27983402 Object3D obj;
27993403 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2803,66 +3407,84 @@
28033407 EditObject(obj);
28043408 }
28053409
3410
+ cameraView.requestFocusInWindow();
28063411 refreshContents(true);
28073412 } else
2808
- if (event.getSource() == closeButton)
3413
+ if (source == closeButton)
28093414 {
28103415 //System.out.println("CLOSE: " + buttonGroup.getSelection());
28113416 cRadio ab;
28123417 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28133418 {
28143419 ab = (cRadio)e.nextElement();
2815
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3420
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28163421 {
3422
+ // Patch to avoid bug with transparency.
3423
+ if (!ab.hadMaterial)
3424
+ {
3425
+ ab.object.material = null;
3426
+ }
3427
+
28173428 buttonGroup.remove(ab);
28183429 radioPanel.remove(ab);
28193430
2820
- ab.GetObject().editWindow = null;
3431
+ //ab.GetObject().editWindow = null;
3432
+ ab.GetObject().manipWindow = null;
28213433 // ab.GetObject().objectUI = null; // ?????????
28223434
28233435 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28243436 break;
28253437 }
28263438 }
3439
+
3440
+ cameraView.requestFocusInWindow();
28273441 refreshContents(true);
28283442 } else
2829
- if (event.getSource() == editItem || event.getSource() == editButton)
3443
+ if (source == editItem || source == editButton)
28303444 {
3445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3446
+ {
3447
+ Object3D child = (Object3D)e.nextElement();
3448
+ child.pinned = true;
3449
+ }
3450
+
28313451 EditSelection(false);
28323452 } else
2833
- if (event.getSource() == uneditButton)
3453
+ if (source == uneditButton)
28343454 {
28353455 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28363456 {
28373457 Object3D child = (Object3D)e.nextElement();
28383458 if(child.editWindow != null)
28393459 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3460
+ child.pinned = false;
28403461 child.CloseUI();
28413462 listUI.remove(child);
28423463
2843
- child.editWindow = null; // ???????????
3464
+ //child.editWindow = null; // ???????????
28443465 }
2845
- objEditor.ctrlPanel.revalidate();
3466
+ objEditor.ctrlPanel.FlushUI();
28463467 //objEditor.jTree.clearSelection();
28473468 //objEditor.ResetSliders();
28483469 refreshContents(true);
28493470 } else
2850
- if (event.getSource() == clearPanelButton)
3471
+ if (source == clearPanelButton)
28513472 {
28523473 assert(copy == group);
28533474 //copy.ClearUI();
28543475 for (Object3D obj : listUI)
28553476 {
3477
+ obj.pinned = false;
28563478 obj.CloseUI();
28573479 }
28583480 listUI.clear();
28593481 refreshContents(true);
28603482 } else
2861
- if (event.getSource() == allParamsButton)
3483
+ if (source == allParamsButton)
28623484 {
28633485 assert(copy == group);
28643486
2865
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3487
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28663488
28673489 for (Object3D obj : listUI)
28683490 {
....@@ -2879,19 +3501,19 @@
28793501
28803502 refreshContents(true);
28813503 } else
2882
- if (event.getSource() == unselectButton)
3504
+ if (source == unselectButton)
28833505 {
28843506 objEditor.jTree.clearSelection();
28853507 // ?? oct 2012 GrafreeD.clipboard.clear();
28863508 objEditor.ResetSliders();
28873509 refreshContents(true);
28883510 } else
2889
- if(event.getSource() instanceof cRadio)
3511
+ if(source instanceof cRadio)
28903512 {
28913513 group.parent = keepparent;
28923514 group.attributes = 0;
28933515 //group.editWindow = null;
2894
- /*cRadio*/ radio = (cRadio)event.getSource();
3516
+ /*cRadio*/ radio = (cRadio)source;
28953517 Object3D obj = radio.GetObject();
28963518 System.out.println("Edit " + obj);
28973519 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2911,7 +3533,10 @@
29113533 }
29123534
29133535 copy = group;
2914
- //CameraPane.theRenderer.object = group;
3536
+
3537
+ SetUndoStates();
3538
+
3539
+ //Globals.theRenderer.object = group;
29153540 if(!useclient)
29163541 {
29173542 cameraView.renderCamera = radio.camera;
....@@ -2920,25 +3545,52 @@
29203545 cameraView.cameras[cameraView.cameracount] = radio.camera;
29213546 cameraView.targetLookAt.set(radio.camera.lookAt);
29223547 cameraView.object = group;
2923
- cameraView.lighttouched = true;
3548
+ //cameraView.lighttouched = true;
3549
+ Globals.lighttouched = true;
29243550 topView.object = group;
29253551 frontView.object = group;
29263552 sideView.object = group;
29273553 }
2928
- group.editWindow = this;
3554
+
3555
+// fix "+" issue
3556
+ //group.editWindow = this;
3557
+ group.manipWindow = this;
3558
+
29293559 /*
29303560 currentLayout = radio.layout;
29313561 if (currentLayout == null)
29323562 currentLayout = sevenButton;
29333563 */
29343564 radio.layout.doClick();
3565
+
3566
+ ClearUnpinned();
3567
+ //Grafreed.Assert(group != null);
3568
+ //Grafreed.Assert(group.selection != null);
3569
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3570
+ if (group.selection == null || group.selection.size() == 1)
3571
+ EditSelection(false);
29353572 keepparent = group.parent;
29363573 // PARENT = NULL or not???
29373574 //group.parent = null; // ROOT
29383575 //group.attributes = -1;
29393576 ResetModel();
3577
+
3578
+ cameraView.requestFocusInWindow();
29403579 refreshContents(true);
2941
- }
3580
+ } else if (event.getSource() == editCameraItem)
3581
+ {
3582
+ cameraView.ProtectCamera();
3583
+ cameraView.repaint();
3584
+ return;
3585
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3586
+ {
3587
+ cameraView.RevertCamera();
3588
+ cameraView.repaint();
3589
+ return;
3590
+ // } else if (event.getSource() == textureButton)
3591
+ // {
3592
+ // return; // true;
3593
+ }
29423594 else
29433595 {
29443596 //return super.action(event, arg);
....@@ -2947,7 +3599,6 @@
29473599 }
29483600
29493601 boolean useclient = false;
2950
- cRadio radio;
29513602
29523603 void ToggleRoot()
29533604 {
....@@ -2956,7 +3607,7 @@
29563607 if (useclient)
29573608 {
29583609 cameraView.object = client;
2959
- cameraView.lighttouched = true;
3610
+ Globals.lighttouched = true;
29603611 //topView.object = client;
29613612 //frontView.object = client;
29623613 //sideView.object = client;
....@@ -2964,7 +3615,7 @@
29643615 else
29653616 {
29663617 cameraView.object = group;
2967
- cameraView.lighttouched = true;
3618
+ Globals.lighttouched = true;
29683619 //topView.object = group;
29693620 //frontView.object = group;
29703621 //sideView.object = group;
....@@ -2999,6 +3650,28 @@
29993650 refreshContents();
30003651 }
30013652
3653
+ void TransformChildren()
3654
+ {
3655
+ Object3D obj;
3656
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3657
+ {
3658
+ obj = (Object3D)e.nextElement();
3659
+ obj.KeepTextureMatrices();
3660
+ obj.TransformChildren();
3661
+ obj.RestoreTextureMatrices();
3662
+
3663
+// if (obj.parent == null)
3664
+// {
3665
+// System.out.println("NULL PARENT!");
3666
+// new Exception().printStackTrace();
3667
+// }
3668
+// else
3669
+// TouchTransform(obj);
3670
+// //obj.parent.Touch();
3671
+ }
3672
+
3673
+ refreshContents();
3674
+ }
30023675
30033676 void ResetTransform()
30043677 {
....@@ -3111,7 +3784,7 @@
31113784 refreshContents();
31123785 }
31133786
3114
- void ResetCentroid()
3787
+ void ResetCentroid(boolean full)
31153788 {
31163789 Object3D obj;
31173790 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3126,12 +3799,16 @@
31263799 LA.matIdentity(Object3D.mat);
31273800 obj.getBounds(minima, maxima, false);
31283801 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3129
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3802
+ if (full)
3803
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31303804 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31313805 obj.TransformMesh(Object3D.mat);
3806
+
31323807 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3133
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3808
+ if (full)
3809
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31343810 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3811
+
31353812 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31363813 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31373814 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3160,7 +3837,8 @@
31603837
31613838 int size = obj.MemorySize();
31623839
3163
- System.err.println((size/1024) + " KB is the size of " + obj);
3840
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3841
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
31643842 }
31653843 }
31663844 catch (Exception e)
....@@ -3197,9 +3875,9 @@
31973875 obj = (Object3D)e.nextElement();
31983876
31993877 System.out.println("Object is: " + obj);
3200
- GrafreeD.AnalyzeObject(obj);
3878
+ Grafreed.AnalyzeObject(obj);
32013879 System.out.println("Boundary rep: " + obj.bRep);
3202
- GrafreeD.AnalyzeObject(obj.bRep);
3880
+ Grafreed.AnalyzeObject(obj.bRep);
32033881
32043882 // System.err.println((size/1024) + " KB is the size of " + obj);
32053883 }
....@@ -3241,6 +3919,13 @@
32413919 void GenNormals(boolean crease)
32423920 {
32433921 group.GenNormalsS(crease);
3922
+
3923
+ refreshContents();
3924
+ }
3925
+
3926
+ void GenNormalsMESH()
3927
+ {
3928
+ group.GenNormalsMeshS();
32443929
32453930 refreshContents();
32463931 }
....@@ -3413,8 +4098,8 @@
34134098
34144099 void ParseVertices()
34154100 {
3416
- boolean epsequal = GrafreeD.epsequal;
3417
- GrafreeD.epsequal = true;
4101
+ boolean epsequal = Grafreed.epsequal;
4102
+ Grafreed.epsequal = true;
34184103
34194104 for (int i=0; i<group.selection.size(); i++)
34204105 {
....@@ -3439,7 +4124,7 @@
34394124 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34404125 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34414126
3442
- g.add(GrafreeD.clipboard);
4127
+ g.add(Grafreed.clipboard);
34434128
34444129 buffer.add(g);
34454130 }
....@@ -3454,7 +4139,7 @@
34544139 makeSomething(buffer, i==group.selection.size()-1);
34554140 }
34564141
3457
- GrafreeD.epsequal = epsequal;
4142
+ Grafreed.epsequal = epsequal;
34584143
34594144 refreshContents();
34604145 }
....@@ -3472,7 +4157,16 @@
34724157 String pigment = Object3D.GetPigment(tex);
34734158 //String bump = Object3D.GetBump(tex);
34744159
3475
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4160
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4161
+
4162
+ try
4163
+ {
4164
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4165
+ }
4166
+ catch (Exception e)
4167
+ {
4168
+ System.err.println("FAIL: " + node);
4169
+ }
34764170
34774171 double s = v.s;
34784172
....@@ -3560,11 +4254,11 @@
35604254
35614255 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35624256
3563
- boolean random = CameraPane.RANDOM;
3564
- CameraPane.RANDOM = false; // parse all random nodes
4257
+ boolean random = CameraPane.SWITCH;
4258
+ CameraPane.SWITCH = false; // parse all random nodes
35654259 lowres.linkVerticesThis(null);
35664260 lowres.linkVerticesThis(sn);
3567
- CameraPane.RANDOM = random;
4261
+ CameraPane.SWITCH = random;
35684262
35694263 System.err.flush();
35704264
....@@ -3604,7 +4298,7 @@
36044298 return;
36054299
36064300 Object3D poses = group.selection.get(0);
3607
- Object3D ref = GrafreeD.clipboard.get(0);
4301
+ Object3D ref = Grafreed.clipboard.get(0);
36084302
36094303 Object3D newgroup = new Object3D("Po:" + poses.name);
36104304
....@@ -3773,7 +4467,7 @@
37734467 group.selection.RelinkToSupport(); // july 2014
37744468 System.out.println("DONE.");
37754469 refreshContents();
3776
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4470
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
37774471 }
37784472
37794473 void ReduceMesh(boolean reduction34)
....@@ -3798,9 +4492,9 @@
37984492
37994493 void ClipMesh()
38004494 {
3801
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4495
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38024496 {
3803
- Object3D content = GrafreeD.clipboard.get(0);
4497
+ Object3D content = Grafreed.clipboard.get(0);
38044498
38054499 if (content instanceof cGroup && ((cGroup)content).transientlink )
38064500 content = ((cGroup)content).get(0);
....@@ -3809,7 +4503,7 @@
38094503 // {
38104504 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38114505 // }
3812
- group.selection.ClipMesh(GrafreeD.clipboard);
4506
+ group.selection.ClipMesh(Grafreed.clipboard);
38134507 }
38144508 // group.selection.ClipMesh(GrafreeD.clipboard);
38154509 System.out.println("DONE.");
....@@ -3856,6 +4550,18 @@
38564550 void MarkLeaves(boolean hide)
38574551 {
38584552 group.selection.MarkLeaves(hide);
4553
+ refreshContents();
4554
+ }
4555
+
4556
+ void RewindLeaves(boolean hide)
4557
+ {
4558
+ group.selection.RewindLeaves(hide);
4559
+ refreshContents();
4560
+ }
4561
+
4562
+ void RandomLeaves(boolean hide)
4563
+ {
4564
+ group.selection.RandomLeaves(hide);
38594565 refreshContents();
38604566 }
38614567
....@@ -3930,28 +4636,25 @@
39304636 // }
39314637 // }
39324638
3933
- static boolean allparams = true;
3934
-
3935
- static Vector<Object3D> listUI = new Vector<Object3D>();
3936
-
39374639 void EditSelection(boolean newWindow)
39384640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
39394647 // aConstraints.gridy = 0;
39404648 for (int i=0; i<group.selection.size(); i++)
39414649 {
39424650 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39434651 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3944
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4652
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39454653
39464654 Object3D elem = (Object3D)group.selection.elementAt(i);
3947
- if(elem != group)
4655
+ if(elem != group || !newWindow)
39484656 {
3949
- // if (!(elem instanceof Composite))
3950
- // newWindow = false;
3951
- listUI.add(elem);
3952
- elem.openEditWindow(this, newWindow); //, false);
3953
- System.out.println("edit : " + elem);
3954
- elem.editWindow.refreshContents(true); // ? new
4657
+ EditElement(elem, newWindow); // ? new
39554658 }
39564659 }
39574660 }
....@@ -4026,7 +4729,8 @@
40264729 //new Exception().printStackTrace();
40274730
40284731 freezemodel = true;
4029
-
4732
+ ClearUnpinned();
4733
+
40304734 /**/
40314735 //switch (event.id)
40324736 {
....@@ -4034,7 +4738,6 @@
40344738 //case 702: // Event.LIST_DESELECT
40354739 group.deselectAll();
40364740 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4037
- objEditor.ClearInfo(); // .GetMaterial());
40384741 if (tps != null)
40394742 {
40404743 for (int i=0; i < tps.length; i++)
....@@ -4043,33 +4746,39 @@
40434746
40444747 //if (child.parent != null)
40454748 //child.parent.addSelectee(child);
4749
+ objEditor.SetMaterial(child);
40464750 group.addSelectee(child);
4047
- objEditor.SetMaterial(child); // .GetMaterial());
4048
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4049
- System.err.println("info : " + child.GetPath());
40504751 }
40514752 }
4052
- else
4053
- {
4054
- objEditor.SetMaterial(group); // .GetMaterial());
4055
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4056
- System.err.println("info : " + group.GetPath());
4057
- }
4753
+// else
4754
+// {
4755
+// objEditor.SetMaterial(group); // .GetMaterial());
4756
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4757
+// System.err.println("info : " + group.GetPath());
4758
+// }
40584759
4059
- objEditor.SetText(); // jan 2014
4060
-
4061
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4760
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
40624761 CameraPane.flash = true;
40634762
4064
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4763
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40654764 // a camera
40664765 {
4067
- CameraPane.camerachangeframe = 0; // don't refuse it
4068
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4069
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
4070
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
4766
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4767
+ {
4768
+ CameraPane.camerachangeframe = 0; // don't refuse it
4769
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4770
+ }
4771
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4772
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
40714773 }
40724774
4775
+ if (tps != null && tps.length == 1)
4776
+ {
4777
+ EditSelection(false);
4778
+ }
4779
+
4780
+ SetPinStates(tps != null && tps.length > 0);
4781
+
40734782 refreshContents();
40744783 //return true;
40754784 }
....@@ -4078,6 +4787,35 @@
40784787
40794788 freezemodel = false;
40804789 }
4790
+
4791
+ void SetPinStates(boolean enabled)
4792
+ {
4793
+ editButton.setEnabled(enabled);
4794
+ uneditButton.setEnabled(enabled);
4795
+ unselectButton.setEnabled(enabled);
4796
+ flashSelectionButton.setEnabled(enabled);
4797
+ }
4798
+
4799
+ void refreshContents(boolean cp)
4800
+ {
4801
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4802
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4803
+ {
4804
+ objEditor.ClearInfo(); // .GetMaterial());
4805
+
4806
+ for (int i=0; i < group.selection.Size(); i++)
4807
+ {
4808
+ Object3D child = (Object3D) group.selection.get(i);
4809
+
4810
+ objEditor.AddInfo(child, this, true);
4811
+ System.err.println("info : " + child.GetPath());
4812
+ }
4813
+
4814
+ objEditor.SetText(); // jan 2014
4815
+ }
4816
+
4817
+ super.refreshContents(cp);
4818
+ }
40814819
40824820 void linkSomething(Object3D thing)
40834821 {
....@@ -4149,16 +4887,19 @@
41494887 {
41504888 if (group.selection.isEmpty())
41514889 return;
4152
- GrafreeD.clipboardIsTempGroup = false;
4890
+
4891
+ Grafreed.clipboardIsTempGroup = false;
41534892 Composite tGroup = null;
41544893 if (group.selection.size() > 0) // 1)
41554894 {
41564895 tGroup = new cGroup();
4157
- GrafreeD.clipboardIsTempGroup = true;
4896
+ Grafreed.clipboardIsTempGroup = true;
41584897 }
41594898
41604899 if (cut)
41614900 {
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
41624903 //int indices[] = jList.getSelectedIndices();
41634904 //for (int i = indices.length - 1; i >= 0; i--)
41644905 //jList.remove(indices[i]);
....@@ -4194,16 +4935,16 @@
41944935 //System.out.println("cut " + child);
41954936 //System.out.println("parent = " + child.parent);
41964937 // tmp.addChild(child);
4197
- if (GrafreeD.clipboardIsTempGroup)
4938
+ if (Grafreed.clipboardIsTempGroup)
41984939 tGroup.add/*Child*/(tmp);
41994940 else
4200
- GrafreeD.clipboard = tmp;
4941
+ Grafreed.clipboard = tmp;
42014942 }
42024943 else
4203
- if (GrafreeD.clipboardIsTempGroup)
4944
+ if (Grafreed.clipboardIsTempGroup)
42044945 tGroup.add/*Child*/(child);
42054946 else
4206
- GrafreeD.clipboard = child;
4947
+ Grafreed.clipboard = child;
42074948 }
42084949
42094950 //ResetModel();
....@@ -4235,21 +4976,23 @@
42354976 //System.out.println("cut " + elem);
42364977 //System.out.println("parent = " + elem.parent);
42374978 // tmp.addChild(elem);
4238
- if (GrafreeD.clipboardIsTempGroup)
4979
+ if (Grafreed.clipboardIsTempGroup)
42394980 tGroup.add/*Child*/(tmp);
42404981 else
4241
- GrafreeD.clipboard = tmp;
4982
+ Grafreed.clipboard = tmp;
42424983 }
42434984 else
4244
- if (GrafreeD.clipboardIsTempGroup)
4985
+ if (Grafreed.clipboardIsTempGroup)
42454986 tGroup.add/*Child*/(child);
42464987 else
4247
- GrafreeD.clipboard = child;
4988
+ Grafreed.clipboard = child;
42484989 }
42494990
42504991 }
4251
- if (GrafreeD.clipboardIsTempGroup)
4252
- GrafreeD.clipboard = tGroup;
4992
+
4993
+ if (Grafreed.clipboardIsTempGroup)
4994
+ Grafreed.clipboard = tGroup;
4995
+
42534996 if (cut)
42544997 {
42554998 ResetModel();
....@@ -4259,11 +5002,15 @@
42595002
42605003 void paste(boolean expand)
42615004 {
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
42625009 // if (GrafreeD.clipboard == null)
42635010 // return;
42645011 boolean first = true;
42655012
4266
- if (GrafreeD.clipboardIsTempGroup)
5013
+ if (Grafreed.clipboardIsTempGroup)
42675014 {
42685015 Composite temp;
42695016
....@@ -4274,7 +5021,7 @@
42745021 temp = (Composite)Applet3D.clipboard.deepCopy();
42755022 */
42765023 Object3D elem;
4277
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5024
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
42785025 {
42795026 Object3D child = (Object3D)e.nextElement();
42805027
....@@ -4308,21 +5055,22 @@
43085055 //Object3D cb = Applet3D.clipboard;
43095056 //temp.addChild(cb);
43105057 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4311
- assert(GrafreeD.clipboard.parent == null);
4312
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4313
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4314
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4315
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5058
+ assert(Grafreed.clipboard.parent == null);
5059
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5060
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5061
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5062
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43165063 else
4317
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4318
- GrafreeD.clipboard.get(0).parent = keepparent;
5064
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5065
+ Grafreed.clipboard.get(0).parent = keepparent;
43195066 }
43205067
5068
+ Globals.REPLACEONMAKE = keep;
43215069 ResetModel();
43225070 refreshContents();
43235071 }
43245072
4325
- void pasteInto(boolean copyit)
5073
+ void pasteInto(boolean copyit, boolean clone)
43265074 {
43275075 // if (GrafreeD.clipboard == null)
43285076 // return;
....@@ -4351,15 +5099,22 @@
43515099 if (copyit)
43525100 {
43535101 // paste(false);
4354
- CloneClipboard(false); // sept 2014
5102
+ if (clone)
5103
+ {
5104
+ CloneClipboard(false); // sept 2014
5105
+ }
5106
+ else
5107
+ {
5108
+ paste(false);
5109
+ }
43555110 }
43565111 else
43575112 {
43585113 boolean first = true;
43595114
4360
- if (GrafreeD.clipboardIsTempGroup)
5115
+ if (Grafreed.clipboardIsTempGroup)
43615116 {
4362
- Composite temp = (Composite)GrafreeD.clipboard;
5117
+ Composite temp = (Composite)Grafreed.clipboard;
43635118 Object3D copy;
43645119 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43655120 {
....@@ -4369,7 +5124,7 @@
43695124 }
43705125 } else
43715126 {
4372
- linkSomething(GrafreeD.clipboard); //.get(0));
5127
+ linkSomething(Grafreed.clipboard); //.get(0));
43735128 }
43745129 }
43755130 }
....@@ -4446,6 +5201,10 @@
44465201
44475202 void group(Object3D csg, boolean grab)
44485203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
44495208 if (//false) // why??
44505209 !group.selection.isEmpty())
44515210 {
....@@ -4559,10 +5318,15 @@
45595318 //node.add(csg);
45605319 //makeSomething(node);
45615320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
45625322 }
45635323
45645324 void Ungroup(Object3D g)
45655325 {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
45665330 if (g instanceof HiddenObject)
45675331 {
45685332 HiddenObject h = (HiddenObject) g;
....@@ -4579,6 +5343,7 @@
45795343 objEditor.makeSomething(g.get(i), false);
45805344 }
45815345 }
5346
+ Globals.REPLACEONMAKE = keep;
45825347 }
45835348
45845349 void ungroup()
....@@ -4774,21 +5539,6 @@
47745539 }
47755540 */
47765541
4777
- void ImportGFD()
4778
- {
4779
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4780
- browser.show();
4781
- String filename = browser.getFile();
4782
- if (filename != null && filename.length() > 0)
4783
- {
4784
- String fullname = browser.getDirectory() + filename;
4785
-
4786
- //Object3D readobj =
4787
- objEditor.ReadGFD(fullname, objEditor);
4788
- //makeSomething(readobj);
4789
- }
4790
- }
4791
-
47925542 /*
47935543 public void Callback(Object obj)
47945544 {
....@@ -4812,26 +5562,9 @@
48125562 }
48135563 */
48145564
4815
- void ImportVRMLX3D()
4816
- {
4817
- if (GrafreeD.standAlone)
4818
- {
4819
- /**/
4820
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4821
- browser.show();
4822
- String filename = browser.getFile();
4823
- if (filename != null && filename.length() > 0)
4824
- {
4825
- String fullname = browser.getDirectory() + filename;
4826
- LoadVRMLX3D(fullname);
4827
- }
4828
- /**/
4829
- }
4830
- }
4831
-
48325565 String GetFile(String dialogName)
48335566 {
4834
- if (GrafreeD.standAlone)
5567
+ if (Grafreed.standAlone)
48355568 {
48365569 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48375570 browser.show();
....@@ -4895,10 +5628,33 @@
48955628 cButton flashSelectionButton;
48965629 cButton editButton;
48975630 cButton uneditButton;
5631
+ JCheckBox allParamsButton;
48985632 cButton clearpanelButton;
4899
- cButton allParamsButton;
49005633 cButton unselectButton;
49015634
5635
+ cButton restoreCameraButton;
5636
+
5637
+ cButton saveButton;
5638
+ cButton oneStepButton;
5639
+
5640
+ cButton groupButton;
5641
+ cButton ungroupButton;
5642
+ cButton compositeButton;
5643
+ cButton switchButton;
5644
+ cButton loopButton;
5645
+ cButton textureButton;
5646
+
5647
+ cButton gridButton;
5648
+ cButton boxButton;
5649
+ cButton sphereButton;
5650
+ cButton coneButton;
5651
+ cButton torusButton;
5652
+ cButton superButton;
5653
+ cButton kleinButton;
5654
+ cButton particlesButton;
5655
+ cButton overlayButton;
5656
+ cButton lightButton;
5657
+
49025658 cButton screenfitButton;
49035659 cButton screenfitpointButton;
49045660 cButton snapobjectButton;
....@@ -4910,14 +5666,6 @@
49105666
49115667 cButton setsupportButton;
49125668
4913
- cButton twoButton;
4914
- cButton sixButton;
4915
- cButton threeButton;
4916
- cButton sevenButton;
4917
- cButton fourButton; // full panel
4918
- cButton oneButton; // full XYZ
4919
- //cButton currentLayout;
4920
-
49215669 //
49225670 //Composite
49235671 Object3D // to do !!
....@@ -4927,9 +5675,11 @@
49275675 //JTree jTree;
49285676 private MenuItem lookAtItem;
49295677 private MenuItem lookFromItem;
4930
- private MenuItem switchItem;
5678
+ private MenuItem switchViewItem;
49315679 private MenuItem cutItem;
4932
- private MenuItem duplicateItem;
5680
+ private MenuItem undoItem;
5681
+ private MenuItem redoItem;
5682
+ private JMenuItem duplicateItem;
49335683 private MenuItem cloneItem;
49345684 private MenuItem cloneSupportItem;
49355685 private MenuItem overwriteGeoItem;
....@@ -4942,7 +5692,7 @@
49425692 private MenuItem linkverticesItem;
49435693 private MenuItem relinkverticesItem;
49445694 private MenuItem setMasterItem;
4945
- private MenuItem resetMeshItem;
5695
+ private MenuItem resetAllItem;
49465696 private MenuItem stepAllItem;
49475697 private MenuItem revertMeshItem;
49485698 private MenuItem poseMeshItem;
....@@ -4953,10 +5703,11 @@
49535703 private MenuItem mergeGeometriesItem;
49545704 private MenuItem copyItem;
49555705 private MenuItem pasteItem;
5706
+ private MenuItem pasteIntoItem;
49565707 private MenuItem pasteLinkItem;
49575708 private MenuItem pasteCloneItem;
49585709 private MenuItem pasteExpandItem;
4959
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
49605711 private MenuItem clearAllItem;
49615712 private MenuItem genUVItem;
49625713 private MenuItem genNormalsMESHItem;
....@@ -4991,6 +5742,10 @@
49915742 private MenuItem showleavesItem;
49925743 private MenuItem markleavesItem;
49935744 private MenuItem unmarkleavesItem;
5745
+ private MenuItem rewindleavesItem;
5746
+ private MenuItem unrewindleavesItem;
5747
+ private MenuItem randomleavesItem;
5748
+ private MenuItem unrandomleavesItem;
49945749
49955750 private MenuItem flipVItem;
49965751 private MenuItem unflipVItem;
....@@ -5002,15 +5757,17 @@
50025757 private MenuItem panoTexturesItem;
50035758
50045759 private MenuItem resetCentroidItem;
5005
- private MenuItem transformgeometryItem;
5760
+ private MenuItem resetCentroidXZItem;
50065761 private MenuItem resetTransformItem;
5762
+ private MenuItem transformGeometryItem;
5763
+ private MenuItem transformChildrenItem;
50075764 private MenuItem hideItem;
50085765 private MenuItem grabItem;
50095766 private MenuItem backItem;
50105767 private MenuItem frontItem;
50115768 private MenuItem cameraItem;
50125769 private MenuItem compositeItem;
5013
- private MenuItem randomItem;
5770
+ private MenuItem switchItem;
50145771 private MenuItem physicsItem;
50155772 private MenuItem frameselectorItem;
50165773 private MenuItem scriptNodeItem;
....@@ -5050,7 +5807,7 @@
50505807 private MenuItem blobItem;
50515808 private MenuItem latheItem;
50525809 private MenuItem bezierItem;
5053
- private MenuItem checkerItem;
5810
+ private MenuItem overlayItem;
50545811 private MenuItem meshItem;
50555812 // private MenuItem meshGroupItem;
50565813 private MenuItem springItem;
....@@ -5072,11 +5829,6 @@
50725829 private MenuItem doubleItem;
50735830 private MenuItem tripleItem;
50745831
5075
- private MenuItem importGFDItem;
5076
- private MenuItem importVRMLX3DItem;
5077
- private MenuItem import3DSItem;
5078
- private MenuItem importOBJItem;
5079
-
50805832 private MenuItem computeAOItem;
50815833 private MenuItem recompileItem;
50825834 private MenuItem editScriptItem;
....@@ -5086,4 +5838,8 @@
50865838 private MenuItem analyzeItem;
50875839 private MenuItem dumpItem;
50885840 //boolean freezemodel = false;
5841
+
5842
+ Menu cameraMenu;
5843
+ MenuItem editCameraItem;
5844
+ MenuItem restoreCameraItem;
50895845 }