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,110 +599,231 @@
433599 oe.radioPanel.add(dummyButton);
434600 oe.buttonGroup.add(dummyButton);
435601 */
436
- aConstraints.gridy += 1;
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
437605
438606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
439607
440
- oe.aConstraints.gridwidth = 1;
441
- oe.aConstraints.gridx = 0;
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
442611
443
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
444
- liveCB.setToolTipText("Enabled animation");
445
- liveCB.addItemListener(this);
446
-
447
- oe.aConstraints.gridx += 1;
448
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
449
- trackCB.setToolTipText("Enable tracking");
450
- trackCB.addItemListener(this);
451
-
452
- oe.aConstraints.gridx += 1;
453
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
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);
454624 screenfitButton.setToolTipText("Screen fit");
455625 screenfitButton.addActionListener(this);
456
- oe.aConstraints.gridx += 1;
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");
660
+ liveCB.addItemListener(this);
661
+
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");
668
+ fastCB.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);
675
+
457676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
458677 // screenfitpointButton.addActionListener(this);
459
-// oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
461
- snapobjectButton.addActionListener(this);
462
- snapobjectButton.setToolTipText("Snap Object");
463
- oe.aConstraints.gridx += 1;
464678
465
- //aConstraints.gridx = 0;
466
- //aConstraints.gridy += 1;
467
- oe.aConstraints.weighty = 0;
468
- oe.aConstraints.gridwidth = 1;
469
-
470
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
471
- flashSelectionButton.setToolTipText("Show selection");
472
- 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));
473687
474
- oe.toolbarPanel.add(new cButton(" ", false));
475
-
476
- oe.aConstraints.gridx += 1;
477
- oe.aConstraints.weighty = 0;
478
- oe.aConstraints.gridwidth = 1;
479
-
480
- //
481
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
482
- twoButton.setToolTipText("Show center view only");
483
- twoButton.addActionListener(this);
484
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
485689 fourButton.addActionListener(this);
486690 fourButton.setToolTipText("Show left panel only");
487
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
488
- sixButton.setToolTipText("2-column layout left");
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");
489699 sixButton.addActionListener(this);
490
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
491
- threeButton.setToolTipText("2-column layout right");
492
- threeButton.addActionListener(this);
493
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
494
- sevenButton.setToolTipText("3-column layout");
495
- 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);
496706 //
497707
498
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
499
- rootButton.setToolTipText("Edit object in new tab");
708
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ rootButton.setToolTipText("Open selection in new tab");
500710 rootButton.addActionListener(this);
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
711
+
712
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
503713 closeButton.setToolTipText("Close tab");
504714 closeButton.addActionListener(this);
505715 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
506716 //clearButton.addActionListener(this);
507
- oe.aConstraints.gridx += 1;
508
-
509
- oe.aConstraints.gridx = 1; //
510
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
511
- editButton.addActionListener(this);
512
- oe.aConstraints.gridx += 1;
513
- oe.aConstraints.weighty = 0;
514
- oe.aConstraints.gridwidth = 1;
515717
516
- 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");
517803 uneditButton.addActionListener(this);
518804
519
- oe.aConstraints.gridx += 1;
520
- oe.aConstraints.weighty = 0;
521
- oe.aConstraints.gridwidth = 1;
522
-
523
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
524
- clearPanelButton.addActionListener(this);
525
-
526
- oe.aConstraints.gridx += 1;
527
- oe.aConstraints.weighty = 0;
528
- oe.aConstraints.gridwidth = 1;
529
-
530
- 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");
531807 allParamsButton.addActionListener(this);
532808
533
- oe.aConstraints.gridx += 1;
534
- oe.aConstraints.weighty = 0;
535
- oe.aConstraints.gridwidth = 1;
536
-
537
- 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");
538815 unselectButton.addActionListener(this);
539816
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
+
540827 // oe.aConstraints.gridx += 1;
541828 // oe.aConstraints.weighty = 0;
542829 // oe.aConstraints.gridwidth = 1;
....@@ -548,40 +835,25 @@
548835 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
549836 // gcButton.addActionListener(this);
550837
551
- oe.aConstraints.gridx = 0;
552
- oe.aConstraints.gridy += 1;
553
-
554
- //ctrlPanel.add(objList = new List(5, true));
555
- oe.aConstraints.gridwidth = 100;
556
- // oe.aConstraints.gridheight = 100;
557
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
558
- oe.aConstraints.gridheight = 1;
559
- oe.aConstraints.weighty = 0.5;
560
- oe.aConstraints.gridx = 0;
561
- JScrollPane jSP;
838
+ cGridBag jSPPanel = new cGridBag();
839
+
840
+ JScrollPane jSP;
562841 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
563
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
842
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
564843 ResetModel();
565
- oe.aConstraints.weighty = 0.5;
566
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
567
- oe.aConstraints.gridy += 1;
568
- oe.aConstraints.gridwidth = 1;
569
-
570
- oe.aConstraints.weighty = 0;
571
- oe.aConstraints.gridwidth = 2;
572
-
573
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
574
- colorCB.addItemListener(this);
575
- oe.aConstraints.gridx += 2;
576
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
577
- materialCB.addItemListener(this);
578
- oe.aConstraints.gridx += 2;
579
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
580
- textureCB.addItemListener(this);
581
-
582
- oe.aConstraints.gridx = 0;
583
- oe.aConstraints.gridy += 1;
584844
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
+
585857 //jList.addListSelectionListener(this);
586858 oe.jTree.addTreeSelectionListener(this);
587859 //jTree.setRootVisible(false);
....@@ -600,97 +872,160 @@
600872 dgr.addDragGestureListener(this);
601873 }catch(Exception e) {}
602874 */
603
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
604876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
605877 }
606878
607
- void AddOptions(JPanel panel, GridBagConstraints constraints)
879
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
608880 {
609
- constraints.gridx = 0;
610
- constraints.gridy = 0;
611
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), constraints);
612
- fastCB.setToolTipText("Fast mode");
613
- fastCB.addItemListener(this);
614
- constraints.gridy += 1;
615
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), constraints);
616
- supportCB.setToolTipText("Enabled rigging");
617
- supportCB.addItemListener(this);
881
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
882
+ colorCB.setToolTipText("Copy color when dropped");
883
+ colorCB.addItemListener(this);
618884
619
- // constraints.gridy += 1;
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
+
620913 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
621914 // localCB.addItemListener(this);
622915
623
- constraints.gridy += 1;
624
- panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD), constraints);
916
+ panel.Return();
917
+
918
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
625919 crowdCB.setToolTipText("Used for crowds");
626920 crowdCB.addItemListener(this);
627921
628
- constraints.gridy += 1;
629
- panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), constraints);
922
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
630923 smoothCB.setToolTipText("Snapping delay");
631924 smoothCB.addItemListener(this);
632925
633
- constraints.gridy += 1;
634
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), constraints);
926
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
635927 slowCB.setToolTipText("Smooth interpolation");
636928 slowCB.addItemListener(this);
637
- constraints.gridy += 1;
638
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE), constraints);
639
- boxCB.setToolTipText("Display bounding boxes");
640
- boxCB.addItemListener(this);
641
- constraints.gridy += 1;
642
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE), constraints);
643
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
644
- zoomBoxCB.addItemListener(this);
645
-
929
+
646930 // constraints.gridy += 1;
647931 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
648932 // speakerMocapCB.addItemListener(this);
649933
934
+ panel.Return();
935
+
650936 if (false)
651937 {
652938 // handled in scripts
653
- constraints.gridy += 1;
654
- panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), constraints);
939
+ //constraints.gridy += 1;
940
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
655941 speakerCameraCB.addItemListener(this);
656942
657
- constraints.gridy += 1;
658
- panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), constraints);
943
+ //constraints.gridy += 1;
944
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
659945 speakerFocusCB.addItemListener(this);
660946
661
- constraints.gridy += 1;
662
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), constraints);
947
+ //constraints.gridy += 1;
948
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
663949 smoothfocusCB.addItemListener(this);
950
+ panel.Return();
664951 }
665952
666953 //constraints.gridx += 1;
667954 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
668955 // debugCB.addItemListener(this);
669956
670
- constraints.gridy += 1;
671
- panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL), constraints);
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");
672963 oeilCB.addItemListener(this);
673964
674
- constraints.gridy += 1;
675
- panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT), constraints);
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);
676986 lookAtCB.setToolTipText("Look-at target");
677987 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);
6781002
6791003 }
6801004
6811005 void EditObject(Object3D obj)
6821006 {
6831007 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
+
6841016 radioButton.SetObject(obj);
685
- radioButton.layout = sevenButton;
1017
+ radioButton.layout = sixButton; // sevenButton;
6861018 radioButton.SetCamera(cameraView.renderCamera, false);
6871019 radioButton.addActionListener(this);
6881020 radioPanel.add(radioButton);
6891021 buttonGroup.add(radioButton);
6901022 radioButton.doClick();
6911023 }
1024
+
6921025 void SetupViews(ObjEditor oe)
6931026 {
1027
+ theFrame = this;
1028
+
6941029 oe.SetupViews();
6951030
6961031 System.out.println("SetupViews");
....@@ -699,23 +1034,28 @@
6991034 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7001035 }
7011036
702
- JCheckBox liveCB;
703
- JCheckBox supportCB;
704
- JCheckBox localCB;
705
- JCheckBox crowdCB;
706
- JCheckBox smoothCB;
707
- JCheckBox fastCB;
708
- JCheckBox slowCB;
709
- JCheckBox boxCB;
710
- JCheckBox zoomBoxCB;
711
- JCheckBox trackCB;
712
- 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;
7131050 // JCheckBox speakerMocapCB;
714
- JCheckBox speakerCameraCB;
715
- JCheckBox speakerFocusCB;
716
- JCheckBox debugCB;
717
- JCheckBox oeilCB;
718
- JCheckBox lookAtCB;
1051
+ cCheckBox speakerCameraCB;
1052
+ cCheckBox speakerFocusCB;
1053
+ cCheckBox debugCB;
1054
+
1055
+ cCheckBox oeilCB;
1056
+ cCheckBox shadowCB;
1057
+ cCheckBox autokeepCB;
1058
+ cCheckBox lookAtCB;
7191059
7201060 // static int COLOR = 1;
7211061 // static int MATERIAL = 2;
....@@ -723,9 +1063,9 @@
7231063
7241064 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7251065
726
- JCheckBox colorCB;
727
- JCheckBox materialCB;
728
- JCheckBox textureCB;
1066
+ cCheckBox colorCB;
1067
+ cCheckBox materialCB;
1068
+ cCheckBox textureCB;
7291069
7301070 public void itemStateChanged(ItemEvent e)
7311071 {
....@@ -753,6 +1093,7 @@
7531093 } else if(e.getSource() == liveCB)
7541094 {
7551095 cameraView.ToggleLive();
1096
+ refreshContents(false);
7561097 }
7571098 else if(e.getSource() == supportCB)
7581099 {
....@@ -817,6 +1158,18 @@
8171158 {
8181159 cameraView.ToggleOeil();
8191160 }
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
+ }
8201173 else if(e.getSource() == lookAtCB)
8211174 {
8221175 cameraView.ToggleLookAt();
....@@ -833,7 +1186,8 @@
8331186
8341187 /**/
8351188 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
836
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1190
+ TreePath path = objEditor.jTree.getSelectionPath();
8371191 if ((path == null) || (path.getPathCount() <= 1)) {
8381192 // We can't move the root node or an empty selection
8391193 return;
....@@ -896,8 +1250,6 @@
8961250 }
8971251 }
8981252
899
- String string = (String) object;
900
-
9011253 System.out.println("Transfer = " + object + "; drop : " + target);
9021254 // if( object instanceof java.io.File[])
9031255 // {
....@@ -905,7 +1257,11 @@
9051257 // objEditor.DropFile((java.io.File[]) object, true);
9061258 // return;
9071259 // }
908
- 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) == ':')
9091265 {
9101266 // file(s)
9111267 String[] names = string.split("\n");
....@@ -932,7 +1288,7 @@
9321288
9331289 flashIt = false;
9341290 CameraPane pane = (CameraPane) target;
935
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1291
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9361292 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9371293
9381294 if (group.selection.size() == 1)
....@@ -948,23 +1304,33 @@
9481304
9491305 assert target == objEditor.jTree;
9501306 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1307
+ Object3D destinationLeaf;
9511308 try {
952
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1309
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9531310 } catch (Exception e) {
9541311 System.out.println("destinationPath : " + destinationPath);
9551312 return;
9561313 }
9571314
958
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1315
+ for (int i=group.selection.size(); --i>=0;)
9591316 {
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
+// {
9601326 loadClipboard(true);
9611327 objEditor.jTree.setSelectionPath(destinationPath);
962
- pasteInto(false);
963
- } else {
964
- loadClipboard(false);
965
- objEditor.jTree.setSelectionPath(destinationPath);
966
- pasteInto(false); // true); // ???
967
- }
1328
+ pasteInto(false, false);
1329
+// } else {
1330
+// loadClipboard(false);
1331
+// objEditor.jTree.setSelectionPath(destinationPath);
1332
+// pasteInto(false, false); // true); // ???
1333
+// }
9681334 }
9691335 public void dropActionChanged(DropTargetDragEvent dtde)
9701336 // Called if the user has modified the current drop gesture
....@@ -1069,85 +1435,107 @@
10691435 {
10701436 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10711437 //heightFieldItem.addActionListener(this);
1072
- gridItem = menu.add(new MenuItem("Grid"));
1073
- gridItem.addActionListener(this);
1074
- rectoidItem = menu.add(new MenuItem("Box"));
1075
- rectoidItem.addActionListener(this);
1076
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1077
- ellipsoidItem.addActionListener(this);
1078
- coneItem = menu.add(new MenuItem("Cone"));
1079
- coneItem.addActionListener(this);
1080
- torusItem = menu.add(new MenuItem("Torus"));
1081
- torusItem.addActionListener(this);
1082
- superItem = menu.add(new MenuItem("Superellipsoid"));
1083
- 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
+ {
10841456 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10851457 kleinItem.addActionListener(this);
1086
- particleItem = menu.add(new MenuItem("Particle system"));
1087
- particleItem.addActionListener(this);
1458
+ }
1459
+
1460
+// particleItem = menu.add(new MenuItem("Particle system"));
1461
+// particleItem.addActionListener(this);
1462
+ if (Globals.ADVANCED)
1463
+ {
10881464 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10891465 ragdollItem.addActionListener(this);
10901466 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10911467 ragdoll2Item.addActionListener(this);
1468
+ }
10921469 menu.add("-");
1093
- meshItem = menu.add(new MenuItem("Mesh"));
1470
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10941471 meshItem.addActionListener(this);
10951472 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10961473 // meshGroupItem.addActionListener(this);
1474
+ if (Globals.ADVANCED)
1475
+ {
10971476 springItem = menu.add(new MenuItem("Spring"));
10981477 springItem.addActionListener(this);
10991478 flagItem = menu.add(new MenuItem("Flag"));
11001479 flagItem.addActionListener(this);
1101
- bezierItem = menu.add(new MenuItem("Patch"));
1102
- bezierItem.addActionListener(this);
1103
- checkerItem = menu.add(new MenuItem("Checker"));
1104
- checkerItem.addActionListener(this);
11051480 blobItem = menu.add(new MenuItem("Blob"));
11061481 blobItem.addActionListener(this);
11071482 latheItem = menu.add(new MenuItem("Lathe"));
11081483 latheItem.addActionListener(this);
1109
- lightItem = menu.add(new MenuItem("Light"));
1110
- 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);
11111491 menu.add("-");
11121492 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11131493 //superLoopItem.addActionListener(this);
1114
- loopItem = menu.add(new MenuItem("Loop"));
1115
- loopItem.addActionListener(this);
1494
+// loopItem = menu.add(new MenuItem("Loop"));
1495
+// loopItem.addActionListener(this);
11161496 doubleItem = menu.add(new MenuItem("Fork"));
11171497 doubleItem.addActionListener(this);
1498
+ if (Globals.ADVANCED)
1499
+ {
11181500 tripleItem = menu.add(new MenuItem("Trident"));
11191501 tripleItem.addActionListener(this);
1502
+ }
11201503 }
11211504
11221505 void buildToolsMenu(Menu menu)
11231506 {
11241507 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11251508 animationItem.addItemListener(this);
1126
- animationItem.setState(CameraPane.ANIMATION);
1509
+ animationItem.setState(Globals.ANIMATION);
1510
+
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
11271513
11281514 menu.add("-");
11291515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11301516 parseverticesItem.addActionListener(this);
11311517 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11321518 textureFieldItem.addActionListener(this);
1133
- alignItem = menu.add(new MenuItem("Align"));
1519
+ alignItem = menu.add(new MenuItem("Align Objects"));
11341520 alignItem.addActionListener(this);
1135
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1136
- mirrorItem.addActionListener(this);
11371521 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11381522 reduceMorphItem.addActionListener(this);
11391523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11401524 reduce34MorphItem.addActionListener(this);
1141
-
1142
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1143
- computeAOItem.addActionListener(this);
11441525 menu.add("-");
1145
-
11461526 menu.add(memoryItem = new MenuItem("Memory Usage"));
11471527 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("-");
11481536 menu.add(analyzeItem = new MenuItem("Analyze"));
11491537 analyzeItem.addActionListener(this);
1150
- menu.add(dumpItem = new MenuItem("Dump"));
1538
+ menu.add(dumpItem = new MenuItem("Print"));
11511539 dumpItem.addActionListener(this);
11521540 // menu.add(pathItem = new MenuItem("From-to path"));
11531541 // pathItem.addActionListener(this);
....@@ -1165,6 +1553,7 @@
11651553 menu.add("-");
11661554 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11671555 editScriptItem.addActionListener(this);
1556
+ }
11681557 }
11691558
11701559 void ScreenFit()
....@@ -1287,9 +1676,34 @@
12871676 shadow.material = new cMaterial(obj.material);
12881677 shadow.material.diffuse = 0.0001f;
12891678 shadow.material.specular = 0.0001f;
1679
+ //shadow.projectedVertices[1].x = 300;
12901680
12911681 makeSomething(shadow);
12921682 }
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
+ }
12931707
12941708 /**
12951709 * applyExample
....@@ -1493,9 +1907,9 @@
14931907
14941908 void Overwrite(int mask)
14951909 {
1496
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1910
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14971911 {
1498
- Object3D content = GrafreeD.clipboard.get(0);
1912
+ Object3D content = Grafreed.clipboard.get(0);
14991913
15001914 if (content instanceof cGroup && ((cGroup)content).transientlink )
15011915 content = ((cGroup)content).get(0);
....@@ -1518,6 +1932,7 @@
15181932 //
15191933 public void actionPerformed(ActionEvent event) // , Object arg)
15201934 {
1935
+ Object source = event.getSource();
15211936 /*
15221937 if (event.getSource() == nameField)
15231938 {
....@@ -1529,11 +1944,11 @@
15291944 }
15301945 else
15311946 */
1532
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1947
+ if (source == lookAtItem || source == lookFromItem)
15331948 {
15341949 ScreenFit();
15351950 } else
1536
- if (event.getSource() == switchItem)
1951
+ if (source == switchViewItem)
15371952 {
15381953 cVector v1 = new cVector();
15391954 cVector v2 = new cVector();
....@@ -1542,11 +1957,11 @@
15421957 objEditor.cameraView.renderCamera.setAim(v2, v1);
15431958 objEditor.cameraView.repaint();
15441959 } else
1545
- if (event.getSource() == rectoidItem)
1960
+ if (source == rectoidItem || source == boxButton)
15461961 {
15471962 makeSomething(new Box());
15481963 } else
1549
- if (event.getSource() == particleItem)
1964
+ if (source == particleItem || source == particlesButton)
15501965 {
15511966 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15521967 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1567,9 +1982,9 @@
15671982 applyExample(particleGeom, "SMOKE");
15681983 makeSomething(particleGeom);
15691984 } else
1570
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1985
+ if (source == ragdollItem || source == ragdoll2Item)
15711986 {
1572
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1987
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15731988
15741989 ragdoll.toParent = LA.newMatrix();
15751990 ragdoll.fromParent = LA.newMatrix();
....@@ -1587,7 +2002,7 @@
15872002 } else
15882003 /*
15892004 */
1590
- if (event.getSource() == heightFieldItem)
2005
+ if (source == heightFieldItem)
15912006 {
15922007 Object3D obj = new Object3D();
15932008
....@@ -1625,31 +2040,31 @@
16252040
16262041 makeSomething(obj);
16272042 } else
1628
- if (event.getSource() == gridItem)
2043
+ if (source == gridItem || source == gridButton)
16292044 {
16302045 makeSomething(new Grid());
16312046 } else
1632
- if (event.getSource() == ellipsoidItem)
2047
+ if (source == ellipsoidItem || source == sphereButton)
16332048 {
16342049 makeSomething(new Sphere());
16352050 } else
1636
- if (event.getSource() == coneItem)
2051
+ if (source == coneItem || source == coneButton)
16372052 {
16382053 makeSomething(new Cone());
16392054 } else
1640
- if (event.getSource() == torusItem)
2055
+ if (source == torusItem || source == torusButton)
16412056 {
16422057 makeSomething(new Torus());
16432058 } else
1644
- if (event.getSource() == superItem)
2059
+ if (source == superItem || source == superButton)
16452060 {
16462061 makeSomething(new Superellipsoid());
16472062 } else
1648
- if (event.getSource() == kleinItem)
2063
+ if (source == kleinItem || source == kleinButton)
16492064 {
16502065 makeSomething(new Klein());
16512066 } else
1652
- if (event.getSource() == blobItem)
2067
+ if (source == blobItem)
16532068 {
16542069 Blob blob = new Blob();
16552070 BlobComponent comp = new BlobComponent();
....@@ -1657,15 +2072,15 @@
16572072 //blob.retile();
16582073 makeSomething(blob);
16592074 } else
1660
- if (event.getSource() == latheItem)
2075
+ if (source == latheItem)
16612076 {
16622077 makeSomething(new Lathe());
16632078 } else
1664
- if (event.getSource() == bezierItem)
2079
+ if (source == bezierItem)
16652080 {
16662081 makeSomething(new BezierSurface());
16672082 } else
1668
- if (event.getSource() == checkerItem)
2083
+ if (source == overlayItem || source == overlayButton)
16692084 {
16702085 /*
16712086 Object3D obj = new BezierSurface(5,8);
....@@ -1680,7 +2095,7 @@
16802095 */
16812096 makeSomething(new Checker());
16822097 } else
1683
- if (event.getSource() == meshItem)
2098
+ if (source == meshItem)
16842099 {
16852100 Object3D itemtomake = new Object3D();
16862101 Object3D child;
....@@ -1701,35 +2116,35 @@
17012116 makeSomething(child);
17022117 }
17032118 } else
1704
- if (event.getSource() == springItem)
2119
+ if (source == springItem)
17052120 {
17062121 cSpring s = new cSpring();
17072122 s.setup();
17082123 makeSomething(s);
17092124 } else
1710
- if (event.getSource() == flagItem)
2125
+ if (source == flagItem)
17112126 {
17122127 cSpring s = new cFlag();
17132128 s.setup();
17142129 makeSomething(s);
17152130 } else
1716
- if (event.getSource() == lightItem)
2131
+ if (source == lightItem || source == lightButton)
17172132 {
17182133 makeSomething(new Light());
17192134 } else
1720
- if (event.getSource() == csgItem)
2135
+ if (source == csgItem)
17212136 {
17222137 group(new CSG());
17232138 } else
1724
- if (event.getSource() == templateItem)
2139
+ if (source == templateItem)
17252140 {
17262141 group(new cTemplate());
17272142 } else
1728
- if (event.getSource() == attributeItem)
2143
+ if (source == attributeItem)
17292144 {
17302145 makeSomething(new Attribute());
17312146 } else
1732
- if (event.getSource() == pointflowItem)
2147
+ if (source == pointflowItem)
17332148 {
17342149 makeSomething(new PointFlow());
17352150 } else
....@@ -1741,7 +2156,7 @@
17412156 } else
17422157 */
17432158
1744
- if (event.getSource() == superLoopItem)
2159
+ if (source == superLoopItem)
17452160 {
17462161 Composite g = new cGroup();
17472162 for (int i=0; i<15; i++)
....@@ -1763,30 +2178,30 @@
17632178
17642179 group(g);
17652180 } else
1766
- if (event.getSource() == loopItem)
2181
+ if (source == loopItem || source == loopButton)
17672182 {
17682183 Composite csg = new GroupLeaf();
17692184 csg.count = 5;
17702185 group(csg);
1771
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
17722187 csg.addChild(child);
17732188 child.addChild(csg);
17742189 } else
1775
- if (event.getSource() == doubleItem)
2190
+ if (source == doubleItem)
17762191 {
1777
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
17782193 csg.count = 5;
17792194 group(csg);
1780
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
17812196 csg.addChild(child);
17822197 child.addChild(csg);
1783
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
17842199 csg.addChild(child);
17852200 child.addChild(csg);
17862201 } else
1787
- if (event.getSource() == tripleItem)
2202
+ if (source == tripleItem)
17882203 {
1789
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
17902205 csg.count = 4;
17912206 group(csg);
17922207 Composite child = new cGroup();
....@@ -1799,73 +2214,98 @@
17992214 csg.addChild(child);
18002215 child.addChild(csg);
18012216 } else
1802
-
1803
- if (event.getSource() == importGFDItem)
1804
- {
1805
- ImportGFD();
1806
- } else
1807
- if (event.getSource() == importVRMLX3DItem)
1808
- {
1809
- ImportVRMLX3D();
1810
- } else
1811
- if (event.getSource() == import3DSItem)
1812
- {
1813
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1814
- } else
1815
- if (event.getSource() == importOBJItem)
1816
- {
1817
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1818
- } else
1819
- if (event.getSource() == computeAOItem)
2217
+ if (source == computeAOItem)
18202218 {
18212219 Globals.drawMode = CameraPane.OCCLUSION;
18222220 Globals.theRenderer.repaint();
18232221 } else
1824
- if (event.getSource() == recompileItem)
2222
+ if (source == recompileItem)
18252223 {
18262224 Recompile();
18272225 refreshContents();
18282226 } else
1829
- if (event.getSource() == editScriptItem)
2227
+ if (source == editScriptItem)
18302228 {
18312229 OpenDialog();
18322230 refreshContents();
18332231 } else
1834
- if (event.getSource() == invariantsItem)
2232
+ if (source == invariantsItem)
18352233 {
18362234 System.out.println("Invariants:");
1837
- GrafreeD.grafreeD.universe.invariants();
2235
+ Grafreed.grafreeD.universe.invariants();
18382236 } else
1839
- if (event.getSource() == memoryItem)
2237
+ if (source == memoryItem)
18402238 {
18412239 //System.out.println("Invariants:");
18422240 PrintMemory();
18432241 } else
1844
- if (event.getSource() == pathItem)
2242
+ if (source == pathItem)
18452243 {
18462244 PrintPath();
18472245 } else
1848
- if (event.getSource() == analyzeItem)
2246
+ if (source == analyzeItem)
18492247 {
18502248 AnalyzeObject();
18512249 } else
1852
- if (event.getSource() == dumpItem)
2250
+ if (source == dumpItem)
18532251 {
18542252 DumpObject();
18552253 } else
1856
- if (event.getSource() == screenfitButton)
2254
+ if (source == minButton)
18572255 {
1858
- //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
+ {
18592301 ScreenFit();
18602302 } else
1861
- if (event.getSource() == screenfitpointButton)
2303
+ if (source == screenfitpointButton)
18622304 {
1863
- //Reload(lastConverter, lastFilename, true);
18642305 ScreenFitPoint();
18652306 } else
1866
- if (event.getSource() == snapobjectButton)
2307
+ if (source == snapobjectButton)
18672308 {
1868
- //Reload(lastConverter, lastFilename, true);
18692309 SnapObject();
18702310 } else
18712311 // if (event.getSource() == recompileButton)
....@@ -1874,13 +2314,13 @@
18742314 // Recompile();
18752315 // refreshContents();
18762316 // } else
1877
- if (event.getSource() == gcButton)
2317
+ if (source == gcButton)
18782318 {
18792319 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18802320 System.gc();
18812321 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18822322 } else
1883
- if (event.getSource() == editLeafItem)
2323
+ if (source == editLeafItem)
18842324 {
18852325 Object3D obj;
18862326 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1894,62 +2334,74 @@
18942334 }
18952335 refreshContents(true);
18962336 } else
1897
- if (event.getSource() == openWindowItem)
2337
+ if (source == openWindowItem)
18982338 {
18992339 EditSelection(true);
19002340 } else
1901
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2341
+ if (source == cutItem || source == clearButton)
19022342 {
19032343 loadClipboard(true);
19042344 } else
1905
- if (event.getSource() == duplicateItem)
2345
+ if (source == undoItem)
19062346 {
1907
- 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;
19082356 loadClipboard(false);
19092357 paste(false);
1910
- GrafreeD.clipboard = keep;
2358
+ Grafreed.clipboard = keep;
19112359 } else
1912
- if (event.getSource() == cloneItem)
2360
+ if (source == cloneItem)
19132361 {
19142362 CloneSelection(false);
19152363 } else
1916
- if (event.getSource() == cloneSupportItem)
2364
+ if (source == cloneSupportItem)
19172365 {
19182366 CloneSelection(true);
19192367 } else
1920
- if (event.getSource() == copyItem)
2368
+ if (source == copyItem)
19212369 {
19222370 loadClipboard(false);
19232371 } else
1924
- if (event.getSource() == pasteItem)
2372
+ if (source == pasteItem)
19252373 {
19262374 paste(false);
19272375 } else
1928
- if (event.getSource() == pasteLinkItem)
2376
+ if (source == pasteIntoItem)
19292377 {
1930
- pasteInto(false);
2378
+ pasteInto(true, false);
19312379 } else
1932
- if (event.getSource() == pasteCloneItem)
2380
+ if (source == pasteLinkItem)
19332381 {
1934
- pasteInto(true);
2382
+ pasteInto(false, false);
19352383 } else
1936
- if (event.getSource() == pasteExpandItem)
2384
+ if (source == pasteCloneItem)
2385
+ {
2386
+ pasteInto(true, true);
2387
+ } else
2388
+ if (source == pasteExpandItem)
19372389 {
19382390 paste(true);
19392391 } else
1940
- if (event.getSource() == synchronizeItem)
2392
+ if (source == synchronizeItem)
19412393 {
19422394 Overwrite(Object3D.TRANSFORM);
19432395 } else
1944
- if (event.getSource() == overwriteNameItem)
2396
+ if (source == overwriteNameItem)
19452397 {
19462398 Overwrite(Object3D.NAME);
19472399 } else
1948
- if (event.getSource() == overwriteUVItem)
2400
+ if (source == overwriteUVItem)
19492401 {
19502402 Overwrite(Object3D.UV);
19512403 } else
1952
- if (event.getSource() == overwriteMatItem)
2404
+ if (source == overwriteMatItem)
19532405 {
19542406 /* july 2015
19552407 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1969,7 +2421,7 @@
19692421
19702422 Overwrite(dropAttributes);
19712423 }
1972
- if (event.getSource() == overwriteGeoItem)
2424
+ if (source == overwriteGeoItem)
19732425 {
19742426 Overwrite(Object3D.GEOMETRY);
19752427 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1986,7 +2438,7 @@
19862438 // refreshContents();
19872439 // }
19882440 } else
1989
- if (event.getSource() == generateMeshItem)
2441
+ if (source == generateMeshItem)
19902442 {
19912443 //if (group.selection.size() == 1)
19922444 // for (int i=0; i<group.selection.size(); i++)
....@@ -1997,7 +2449,7 @@
19972449 ResetModel();
19982450 refreshContents();
19992451 } else
2000
- if (event.getSource() == extractGeometriesItem)
2452
+ if (source == extractGeometriesItem)
20012453 {
20022454 boolean one = false;
20032455
....@@ -2024,7 +2476,7 @@
20242476 ResetModel();
20252477 refreshContents();
20262478 } else
2027
- if (event.getSource() == cloneGeometriesItem)
2479
+ if (source == cloneGeometriesItem)
20282480 {
20292481 boolean one = false;
20302482
....@@ -2050,7 +2502,7 @@
20502502 ResetModel();
20512503 refreshContents();
20522504 } else
2053
- if (event.getSource() == shareGeometriesItem)
2505
+ if (source == shareGeometriesItem)
20542506 {
20552507 boolean one = false;
20562508
....@@ -2080,7 +2532,7 @@
20802532 refreshContents();
20812533 }
20822534 } else
2083
- if (event.getSource() == mergeGeometriesItem)
2535
+ if (source == mergeGeometriesItem)
20842536 {
20852537 boolean one = false;
20862538
....@@ -2110,7 +2562,7 @@
21102562 ResetModel();
21112563 refreshContents();
21122564 } else
2113
- if (event.getSource() == linkverticesItem)
2565
+ if (source == linkverticesItem)
21142566 {
21152567 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
21162568 // {
....@@ -2123,9 +2575,9 @@
21232575 // group.selection.get(0).setMasterThis(content); // should be identity
21242576 // refreshContents();
21252577 // }
2126
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2578
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21272579 {
2128
- Object3D content = GrafreeD.clipboard.get(0);
2580
+ Object3D content = Grafreed.clipboard.get(0);
21292581
21302582 if (content instanceof cGroup && ((cGroup)content).transientlink )
21312583 content = ((cGroup)content).get(0);
....@@ -2133,38 +2585,38 @@
21332585 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21342586 for (int i=0; i<group.selection.size(); i++)
21352587 {
2136
- boolean random = CameraPane.RANDOM;
2137
- CameraPane.RANDOM = false; // parse all random nodes
2588
+ boolean random = CameraPane.SWITCH;
2589
+ CameraPane.SWITCH = false; // parse all random nodes
21382590 group.selection.get(i).linkVerticesThis(content);
21392591 // group.selection.get(i).setMasterThis(content); // should be identity
2140
- CameraPane.RANDOM = random;
2592
+ CameraPane.SWITCH = random;
21412593 }
21422594 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21432595 refreshContents();
21442596 }
21452597 } else
2146
- if (event.getSource() == resetsupportItem)
2598
+ if (source == resetsupportItem)
21472599 {
21482600 for (int i=0; i<group.selection.size(); i++)
21492601 {
2150
- boolean random = CameraPane.RANDOM;
2151
- CameraPane.RANDOM = false; // parse all random nodes
2602
+ boolean random = CameraPane.SWITCH;
2603
+ CameraPane.SWITCH = false; // parse all random nodes
21522604 group.selection.get(i).linkVerticesThis(null);
2153
- CameraPane.RANDOM = random;
2605
+ CameraPane.SWITCH = random;
21542606 }
21552607
21562608 refreshContents();
21572609 } else
2158
- if (event.getSource() == relinkverticesItem)
2610
+ if (source == relinkverticesItem)
21592611 {
2160
- boolean random = CameraPane.RANDOM;
2161
- CameraPane.RANDOM = false; // parse all random nodes
2612
+ boolean random = CameraPane.SWITCH;
2613
+ CameraPane.SWITCH = false; // parse all random nodes
21622614 group.selection.RelinkToSupport();
2163
- CameraPane.RANDOM = random;
2615
+ CameraPane.SWITCH = random;
21642616
21652617 refreshContents();
21662618 } else
2167
- if (event.getSource() == resetreferencesItem)
2619
+ if (source == resetreferencesItem)
21682620 {
21692621 for (int i=0; i<group.selection.size(); i++)
21702622 {
....@@ -2173,11 +2625,11 @@
21732625
21742626 refreshContents();
21752627 } else
2176
- if (event.getSource() == setMasterItem)
2628
+ if (source == setMasterItem)
21772629 {
2178
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2630
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21792631 {
2180
- Object3D content = GrafreeD.clipboard.get(0);
2632
+ Object3D content = Grafreed.clipboard.get(0);
21812633
21822634 if (content instanceof cGroup && ((cGroup)content).transientlink )
21832635 content = ((cGroup)content).get(0);
....@@ -2186,13 +2638,13 @@
21862638 refreshContents();
21872639 }
21882640 } else
2189
- if (event.getSource() == poseMeshItem)
2641
+ if (source == poseMeshItem)
21902642 {
21912643 if (group.selection.size() == 1)
21922644 {
2193
- if (GrafreeD.clipboard.size() == 1)
2645
+ if (Grafreed.clipboard.size() == 1)
21942646 {
2195
- Object3D content = GrafreeD.clipboard.get(0);
2647
+ Object3D content = Grafreed.clipboard.get(0);
21962648
21972649 if (content instanceof cGroup && ((cGroup)content).transientlink )
21982650 content = ((cGroup)content).get(0);
....@@ -2205,19 +2657,19 @@
22052657 }
22062658
22072659 } else
2208
- if (event.getSource() == revertMeshItem)
2660
+ if (source == revertMeshItem)
22092661 {
22102662 RevertMeshes();
22112663 } else
2212
- if (event.getSource() == resetMeshItem)
2664
+ if (source == resetAllItem)
22132665 {
22142666 ResetAll();
22152667 } else
2216
- if (event.getSource() == stepAllItem)
2668
+ if (source == stepAllItem)
22172669 {
22182670 StepAll();
22192671 } else
2220
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
22212673 {
22222674 //int indices[] = jList.getSelectedIndices();
22232675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2225,46 +2677,46 @@
22252677
22262678 ClearSelection(false);
22272679 } else
2228
- if (event.getSource() == clearAllItem)
2680
+ if (source == clearAllItem)
22292681 {
22302682 ClearSelection(true);
22312683 } else
2232
- if (event.getSource() == grabItem)
2684
+ if (source == grabItem || source == groupButton)
22332685 {
2234
- group(new cGroup(), true);
2686
+ group(new cGroup(), false); // true);
22352687 } else
2236
- if (event.getSource() == hideItem)
2688
+ if (source == hideItem)
22372689 {
22382690 group(new HiddenObject());
22392691 } else
2240
- if (event.getSource() == frontItem)
2692
+ if (source == frontItem)
22412693 {
22422694 front();
22432695 } else
2244
- if (event.getSource() == backItem)
2696
+ if (source == backItem)
22452697 {
22462698 back();
22472699 } else
2248
- if (event.getSource() == cameraItem)
2700
+ if (source == cameraItem)
22492701 {
22502702 makeSomething(new Camera());
22512703 } else
2252
- if (event.getSource() == compositeItem)
2704
+ if (source == compositeItem || source == compositeButton)
22532705 {
22542706 group(new Composite());
22552707 } else
2256
- if (event.getSource() == randomItem)
2708
+ if (source == switchItem || source == switchButton)
22572709 {
22582710 RandomNode random = new RandomNode();
22592711 group(random);
22602712 if (random.size() > 0)
2261
- random.name = random.get(0).name + "Rnd";
2713
+ random.name = random.get(0).name + "Switch";
22622714 } else
2263
- if (event.getSource() == physicsItem)
2715
+ if (source == physicsItem)
22642716 {
22652717 group(new PhysicsNode());
22662718 } else
2267
- if (event.getSource() == frameselectorItem)
2719
+ if (source == frameselectorItem)
22682720 {
22692721 for (int i=0; i<group.selection.size(); i++)
22702722 {
....@@ -2276,7 +2728,7 @@
22762728 ResetModel();
22772729 refreshContents();
22782730 } else
2279
- if (event.getSource() == switchGeoItem)
2731
+ if (source == switchGeoItem)
22802732 {
22812733 for (int i=0; i<group.selection.size(); i++)
22822734 {
....@@ -2288,7 +2740,7 @@
22882740 ResetModel();
22892741 refreshContents();
22902742 } else
2291
- if (event.getSource() == switchTransfoItem)
2743
+ if (source == switchTransfoItem)
22922744 {
22932745 for (int i=0; i<group.selection.size(); i++)
22942746 {
....@@ -2300,7 +2752,7 @@
23002752 ResetModel();
23012753 refreshContents();
23022754 } else
2303
- if (event.getSource() == morphItem)
2755
+ if (source == morphItem)
23042756 {
23052757 for (int i=0; i<group.selection.size(); i++)
23062758 {
....@@ -2312,7 +2764,7 @@
23122764 ResetModel();
23132765 refreshContents();
23142766 } else
2315
- if (event.getSource() == scriptNodeItem)
2767
+ if (source == scriptNodeItem)
23162768 {
23172769 boolean atleastone = false;
23182770
....@@ -2351,215 +2803,252 @@
23512803 }
23522804 }
23532805 } else
2354
- if (event.getSource() == linkerItem)
2806
+ if (source == linkerItem)
23552807 {
23562808 group(new cLinker());
23572809 } else
2358
- if (event.getSource() == textureItem)
2810
+ if (source == textureItem || source == textureButton)
23592811 {
23602812 group(new TextureNode());
23612813 } else
2362
- if (event.getSource() == billboardItem)
2814
+ if (source == billboardItem)
23632815 {
23642816 group(new BillboardNode());
23652817 } else
2366
- if (event.getSource() == shadowXItem)
2818
+ if (source == shadowXItem)
23672819 {
23682820 CastShadow(0);
23692821 } else
2370
- if (event.getSource() == shadowYItem)
2822
+ if (source == shadowYItem)
23712823 {
23722824 CastShadow(1);
23732825 } else
2374
- if (event.getSource() == shadowZItem)
2826
+ if (source == shadowZItem)
23752827 {
23762828 CastShadow(2);
23772829 } else
2378
- if (event.getSource() == ungroupItem)
2830
+ if (source == ungroupItem || source == ungroupButton)
23792831 {
2380
- //ungroup();
2832
+ boolean hasRoot = false;
2833
+
23812834 for (int i=0; i<group.selection.size(); i++)
23822835 {
2383
- Ungroup(group.selection.get(i));
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
23842841 }
23852842
2386
- ClearSelection(false);
2387
-
2388
- 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
+ }
23892854 } else
2390
- if (event.getSource() == genUVItem)
2855
+ if (source == genUVItem)
23912856 {
23922857 GenUV();
23932858 } else
2394
- if (event.getSource() == genNormalsCADItem)
2859
+ if (source == genNormalsCADItem)
23952860 {
23962861 GenNormals(true);
23972862 } else
2398
- if (event.getSource() == genNormalsMESHItem)
2863
+ if (source == genNormalsMESHItem)
23992864 {
2400
- GenNormals(true); // TODO
2865
+ GenNormalsMESH();
24012866 } else
2402
- if (event.getSource() == genNormalsORGANItem)
2867
+ if (source == genNormalsORGANItem)
24032868 {
24042869 GenNormals(false);
24052870 } else
2406
- if (event.getSource() == genNormalsMINEItem)
2871
+ if (source == genNormalsMINEItem)
24072872 {
24082873 GenNormalsMINE();
24092874 } else
2410
- if (event.getSource() == stripifyItem)
2875
+ if (source == stripifyItem)
24112876 {
24122877 Stripify();
24132878 } else
2414
- if (event.getSource() == unstripifyItem)
2879
+ if (source == unstripifyItem)
24152880 {
24162881 Unstripify();
24172882 } else
2418
- if (event.getSource() == trimItem)
2883
+ if (source == trimItem)
24192884 {
24202885 Trim();
24212886 } else
2422
- if (event.getSource() == untrimItem)
2887
+ if (source == untrimItem)
24232888 {
24242889 Untrim();
24252890 } else
2426
- if (event.getSource() == clearColorsItem)
2891
+ if (source == clearColorsItem)
24272892 {
24282893 ClearColors();
24292894 } else
2430
- if (event.getSource() == clearMaterialsItem)
2895
+ if (source == clearMaterialsItem)
24312896 {
24322897 ClearMaterials();
24332898 } else
2434
- if (event.getSource() == liveleavesItem)
2899
+ if (source == liveleavesItem)
24352900 {
24362901 LiveLeaves(true);
24372902 } else
2438
- if (event.getSource() == unliveleavesItem)
2903
+ if (source == unliveleavesItem)
24392904 {
24402905 LiveLeaves(false);
24412906 } else
2442
- if (event.getSource() == supportleavesItem)
2907
+ if (source == supportleavesItem)
24432908 {
24442909 SupportLeaves(true);
24452910 } else
2446
- if (event.getSource() == unsupportleavesItem)
2911
+ if (source == unsupportleavesItem)
24472912 {
24482913 SupportLeaves(false);
24492914 } else
2450
- if (event.getSource() == hideleavesItem)
2915
+ if (source == hideleavesItem)
24512916 {
24522917 HideLeaves(true);
24532918 } else
2454
- if (event.getSource() == showleavesItem)
2919
+ if (source == showleavesItem)
24552920 {
24562921 HideLeaves(false);
24572922 } else
2458
- if (event.getSource() == markleavesItem)
2923
+ if (source == markleavesItem)
24592924 {
24602925 MarkLeaves(true);
24612926 } else
2462
- if (event.getSource() == unmarkleavesItem)
2927
+ if (source == unmarkleavesItem)
24632928 {
24642929 MarkLeaves(false);
24652930 } else
2466
- 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)
24672948 {
24682949 FlipV(true);
24692950 } else
2470
- if (event.getSource() == unflipVItem)
2951
+ if (source == unflipVItem)
24712952 {
24722953 FlipV(false);
24732954 } else
2474
- if (event.getSource() == lowTexturesItem)
2955
+ if (source == lowTexturesItem)
24752956 {
24762957 SetTexRes(0);
24772958 } else
2478
- if (event.getSource() == normalTexturesItem)
2959
+ if (source == normalTexturesItem)
24792960 {
24802961 SetTexRes(1);
24812962 } else
2482
- if (event.getSource() == highTexturesItem)
2963
+ if (source == highTexturesItem)
24832964 {
24842965 SetTexRes(2);
24852966 } else
2486
- if (event.getSource() == veryhighTexturesItem)
2967
+ if (source == veryhighTexturesItem)
24872968 {
24882969 SetTexRes(3);
24892970 } else
2490
- if (event.getSource() == maxTexturesItem)
2971
+ if (source == maxTexturesItem)
24912972 {
24922973 SetTexRes(4);
24932974 } else
2494
- if (event.getSource() == panoTexturesItem)
2975
+ if (source == panoTexturesItem)
24952976 {
24962977 SetTexRes(5);
24972978 } else
2498
- if (event.getSource() == reverseNormalsItem)
2979
+ if (source == reverseNormalsItem)
24992980 {
25002981 ReverseNormals();
25012982 } else
2502
- if (event.getSource() == parseverticesItem)
2983
+ if (source == parseverticesItem)
25032984 {
25042985 ParseVertices();
25052986 } else
2506
- if (event.getSource() == textureFieldItem)
2987
+ if (source == textureFieldItem)
25072988 {
25082989 TextureVertices();
25092990 } else
2510
- if (event.getSource() == alignItem)
2991
+ if (source == alignItem)
25112992 {
25122993 Align();
25132994 } else
2514
- if (event.getSource() == mirrorItem)
2995
+ if (source == mirrorItem)
25152996 {
25162997 MirrorPoses();
25172998 } else
2518
- if (event.getSource() == reduceMorphItem)
2999
+ if (source == reduceMorphItem)
25193000 {
25203001 MeshReduction(false);
25213002 } else
2522
- if (event.getSource() == reduce34MorphItem)
3003
+ if (source == reduce34MorphItem)
25233004 {
25243005 MeshReduction(true);
25253006 } else
2526
- if (event.getSource() == reverseTrianglesItem)
3007
+ if (source == reverseTrianglesItem)
25273008 {
25283009 ReverseTriangles();
25293010 } else
2530
- if (event.getSource() == reduceMeshItem)
3011
+ if (source == reduceMeshItem)
25313012 {
25323013 ReduceMesh(false);
25333014 } else
2534
- if (event.getSource() == reduce34MeshItem)
3015
+ if (source == reduce34MeshItem)
25353016 {
25363017 ReduceMesh(true);
25373018 } else
2538
- if (event.getSource() == increaseMeshItem)
3019
+ if (source == increaseMeshItem)
25393020 {
25403021 IncreaseMesh();
25413022 } else
2542
- if (event.getSource() == clipMeshItem)
3023
+ if (source == clipMeshItem)
25433024 {
25443025 ClipMesh();
25453026 } else
2546
- if (event.getSource() == smoothMeshItem)
3027
+ if (source == smoothMeshItem)
25473028 {
25483029 SmoothMesh();
25493030 } else
2550
- if (event.getSource() == transformgeometryItem)
3031
+ if (source == transformGeometryItem)
25513032 {
25523033 TransformGeometry();
25533034 } else
2554
- if (event.getSource() == resetTransformItem)
3035
+ if (source == transformChildrenItem)
3036
+ {
3037
+ TransformChildren();
3038
+ } else
3039
+ if (source == resetTransformItem)
25553040 {
25563041 ResetTransform();
25573042 } else
2558
- if (event.getSource() == resetCentroidItem)
3043
+ if (source == resetCentroidItem)
25593044 {
2560
- ResetCentroid();
3045
+ ResetCentroid(true);
25613046 } else
2562
- if (event.getSource() == resetParentItem)
3047
+ if (source == resetCentroidXZItem)
3048
+ {
3049
+ ResetCentroid(false);
3050
+ } else
3051
+ if (source == resetParentItem)
25633052 {
25643053 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25653054 {
....@@ -2569,7 +3058,7 @@
25693058
25703059 refreshContents();
25713060 } else
2572
- if (event.getSource() == repairParentItem)
3061
+ if (source == repairParentItem)
25733062 {
25743063 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25753064 {
....@@ -2583,7 +3072,7 @@
25833072
25843073 refreshContents();
25853074 } else
2586
- if (event.getSource() == repairShadowItem)
3075
+ if (source == repairShadowItem)
25873076 {
25883077 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25893078 {
....@@ -2597,7 +3086,7 @@
25973086
25983087 refreshContents();
25993088 } else
2600
- if (event.getSource() == sortbysizeItem)
3089
+ if (source == sortbysizeItem)
26013090 {
26023091 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26033092 {
....@@ -2609,7 +3098,7 @@
26093098 ResetModel();
26103099 refreshContents();
26113100 } else
2612
- if (event.getSource() == sortbynameItem)
3101
+ if (source == sortbynameItem)
26133102 {
26143103 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26153104 {
....@@ -2621,7 +3110,7 @@
26213110 ResetModel();
26223111 refreshContents();
26233112 } else
2624
- if (event.getSource() == attachPigmentItem)
3113
+ if (source == attachPigmentItem)
26253114 {
26263115 String texture = GetFile("Attach pigment");
26273116 Object3D obj;
....@@ -2633,7 +3122,7 @@
26333122
26343123 refreshContents();
26353124 } else
2636
- if (event.getSource() == detachPigmentItem)
3125
+ if (source == detachPigmentItem)
26373126 {
26383127 Object3D obj;
26393128 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2644,7 +3133,7 @@
26443133
26453134 refreshContents();
26463135 } else
2647
- if (event.getSource() == attachBumpItem)
3136
+ if (source == attachBumpItem)
26483137 {
26493138 String texture = GetFile("Attach bump");
26503139 Object3D obj;
....@@ -2656,7 +3145,7 @@
26563145
26573146 refreshContents();
26583147 } else
2659
- if (event.getSource() == detachBumpItem)
3148
+ if (source == detachBumpItem)
26603149 {
26613150 Object3D obj;
26623151 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2667,7 +3156,7 @@
26673156
26683157 refreshContents();
26693158 } else
2670
- if (event.getSource() == pigmentBumpItem)
3159
+ if (source == pigmentBumpItem)
26713160 {
26723161 Object3D obj;
26733162 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2678,158 +3167,237 @@
26783167
26793168 refreshContents();
26803169 } else
2681
- if (event.getSource() == flashSelectionButton)
3170
+ if (source == flashSelectionButton)
26823171 {
26833172 CameraPane.flash = true;
26843173 refreshContents();
26853174 } else
2686
- if (event.getSource() == oneButton)
3175
+ if (source == oneButton)
26873176 {
26883177 } else
2689
- if (event.getSource() == twoButton)
3178
+ if (source == twoButton)
26903179 {
26913180 radio.layout = twoButton;
3181
+
3182
+ if (CameraPane.FULLSCREEN)
3183
+ fullscreenLayout = radio.layout;
3184
+
26923185 // bug
26933186 //gridPanel.setDividerLocation(1.0);
26943187 //bigPanel.setDividerLocation(0.0);
2695
- bigThree.remove(scenePanel);
2696
- bigThree.remove(centralPanel);
2697
- bigThree.remove(XYZPanel);
2698
- aWindowConstraints.gridx = 0;
2699
- aWindowConstraints.gridy = 0;
2700
- aWindowConstraints.gridwidth = 1;
2701
- // aConstraints.gridheight = 3;
2702
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2703
- aWindowConstraints.weightx = 0;
2704
- aWindowConstraints.weighty = 1;
2705
- //bigThree.add(jtp, aWindowConstraints);
2706
- aWindowConstraints.weightx = 1;
2707
- aWindowConstraints.gridwidth = 3;
2708
- // aConstraints.gridheight = 3;
2709
- aWindowConstraints.gridx = 1;
2710
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2711
- bigThree.add(centralPanel, aWindowConstraints);
2712
- aWindowConstraints.weightx = 0;
2713
- aWindowConstraints.gridx = 4;
2714
- aWindowConstraints.gridwidth = 1;
2715
- // aConstraints.gridheight = 3;
2716
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2717
- //bigThree.add(XYZPanel, aWindowConstraints);
2718
- 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
+
27193235 } else
2720
- if (event.getSource() == threeButton)
3236
+ if (source == threeButton)
27213237 {
27223238 radio.layout = threeButton;
2723
- bigThree.remove(scenePanel);
2724
- bigThree.remove(centralPanel);
2725
- bigThree.remove(XYZPanel);
2726
- aWindowConstraints.gridx = 0;
2727
- aWindowConstraints.gridy = 0;
2728
- aWindowConstraints.gridwidth = 1;
2729
- // aConstraints.gridheight = 3;
2730
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2731
- aWindowConstraints.weightx = 0;
2732
- aWindowConstraints.weighty = 1;
2733
- //bigThree.add(jtp, aWindowConstraints);
2734
- aWindowConstraints.weightx = 1;
2735
- aWindowConstraints.gridwidth = 3;
2736
- // aConstraints.gridheight = 3;
2737
- aWindowConstraints.gridx = 1;
2738
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2739
- bigThree.add(centralPanel, aWindowConstraints);
2740
- aWindowConstraints.weightx = 0;
2741
- aWindowConstraints.gridx = 4;
2742
- aWindowConstraints.gridwidth = 1;
2743
- // aConstraints.gridheight = 3;
2744
- aConstraints.fill = GridBagConstraints.VERTICAL;
2745
- bigThree.add(XYZPanel, aWindowConstraints);
2746
- 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();
27473276 } else
2748
- if (event.getSource() == fourButton)
3277
+ if (source == fourButton)
27493278 {
27503279 radio.layout = fourButton;
2751
- bigThree.remove(scenePanel);
2752
- bigThree.remove(centralPanel);
2753
- bigThree.remove(XYZPanel);
2754
- aWindowConstraints.gridx = 0;
2755
- aWindowConstraints.gridy = 0;
2756
- aWindowConstraints.gridwidth = 1;
2757
- // aWindowConstraints.gridheight = 3;
2758
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2759
- aWindowConstraints.weightx = 1;
2760
- aWindowConstraints.weighty = 1;
2761
- bigThree.add(scenePanel, aWindowConstraints);
2762
- aWindowConstraints.weightx = 1;
2763
- aWindowConstraints.gridwidth = 3;
2764
- // aConstraints.gridheight = 3;
2765
- aWindowConstraints.gridx = 1;
2766
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2767
- //bigThree.add(cameraPanel, aWindowConstraints);
2768
- aWindowConstraints.weightx = 0;
2769
- aWindowConstraints.gridx = 4;
2770
- aWindowConstraints.gridwidth = 1;
2771
- // aWindowConstraints.gridheight = 3;
2772
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2773
- //bigThree.add(XYZPanel, aWindowConstraints);
2774
- 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();
27753316 } else
2776
- if (event.getSource() == sixButton)
3317
+ if (source == sixButton)
27773318 {
27783319 radio.layout = sixButton;
2779
- bigThree.remove(scenePanel);
2780
- bigThree.remove(centralPanel);
2781
- bigThree.remove(XYZPanel);
2782
- aWindowConstraints.gridx = 0;
2783
- aWindowConstraints.gridy = 0;
2784
- aWindowConstraints.gridwidth = 1;
2785
- // aConstraints.gridheight = 3;
2786
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2787
- aWindowConstraints.weightx = 0;
2788
- aWindowConstraints.weighty = 1;
2789
- bigThree.add(scenePanel, aWindowConstraints);
2790
- aWindowConstraints.weightx = 1;
2791
- aWindowConstraints.gridwidth = 3;
2792
- // aWindowConstraints.gridheight = 3;
2793
- aWindowConstraints.gridx = 1;
2794
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2795
- bigThree.add(centralPanel, aWindowConstraints);
2796
- aWindowConstraints.weightx = 0;
2797
- aWindowConstraints.gridx = 4;
2798
- aWindowConstraints.gridwidth = 1;
2799
- // aWindowConstraints.gridheight = 3;
2800
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2801
- //bigThree.add(XYZPanel, aConstraints);
2802
- 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();
28033357 } else
2804
- if (event.getSource() == sevenButton)
3358
+ if (source == sevenButton)
28053359 {
28063360 radio.layout = sevenButton;
2807
- bigThree.remove(scenePanel);
2808
- bigThree.remove(centralPanel);
2809
- bigThree.remove(XYZPanel);
2810
- aWindowConstraints.gridx = 0;
2811
- aWindowConstraints.gridy = 0;
2812
- aWindowConstraints.gridwidth = 1;
2813
- // aWindowConstraints.gridheight = 3;
2814
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2815
- aWindowConstraints.weightx = 0;
2816
- aWindowConstraints.weighty = 1;
2817
- bigThree.add(scenePanel, aWindowConstraints);
2818
- aWindowConstraints.weightx = 1;
2819
- aWindowConstraints.gridwidth = 3;
2820
- // aWindowConstraints.gridheight = 3;
2821
- aWindowConstraints.gridx = 1;
2822
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2823
- bigThree.add(centralPanel, aWindowConstraints);
2824
- aWindowConstraints.weightx = 0;
2825
- aWindowConstraints.gridx = 4;
2826
- aWindowConstraints.gridwidth = 1;
2827
- // aConstraints.gridheight = 3;
2828
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2829
- bigThree.add(XYZPanel, aWindowConstraints);
2830
- 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();
28313399 } else
2832
- if (event.getSource() == rootButton)
3400
+ if (source == rootButton)
28333401 {
28343402 Object3D obj;
28353403 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2839,66 +3407,84 @@
28393407 EditObject(obj);
28403408 }
28413409
3410
+ cameraView.requestFocusInWindow();
28423411 refreshContents(true);
28433412 } else
2844
- if (event.getSource() == closeButton)
3413
+ if (source == closeButton)
28453414 {
28463415 //System.out.println("CLOSE: " + buttonGroup.getSelection());
28473416 cRadio ab;
28483417 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28493418 {
28503419 ab = (cRadio)e.nextElement();
2851
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3420
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28523421 {
3422
+ // Patch to avoid bug with transparency.
3423
+ if (!ab.hadMaterial)
3424
+ {
3425
+ ab.object.material = null;
3426
+ }
3427
+
28533428 buttonGroup.remove(ab);
28543429 radioPanel.remove(ab);
28553430
2856
- ab.GetObject().editWindow = null;
3431
+ //ab.GetObject().editWindow = null;
3432
+ ab.GetObject().manipWindow = null;
28573433 // ab.GetObject().objectUI = null; // ?????????
28583434
28593435 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28603436 break;
28613437 }
28623438 }
3439
+
3440
+ cameraView.requestFocusInWindow();
28633441 refreshContents(true);
28643442 } else
2865
- if (event.getSource() == editItem || event.getSource() == editButton)
3443
+ if (source == editItem || source == editButton)
28663444 {
3445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3446
+ {
3447
+ Object3D child = (Object3D)e.nextElement();
3448
+ child.pinned = true;
3449
+ }
3450
+
28673451 EditSelection(false);
28683452 } else
2869
- if (event.getSource() == uneditButton)
3453
+ if (source == uneditButton)
28703454 {
28713455 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28723456 {
28733457 Object3D child = (Object3D)e.nextElement();
28743458 if(child.editWindow != null)
28753459 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3460
+ child.pinned = false;
28763461 child.CloseUI();
28773462 listUI.remove(child);
28783463
2879
- child.editWindow = null; // ???????????
3464
+ //child.editWindow = null; // ???????????
28803465 }
2881
- objEditor.ctrlPanel.revalidate();
3466
+ objEditor.ctrlPanel.FlushUI();
28823467 //objEditor.jTree.clearSelection();
28833468 //objEditor.ResetSliders();
28843469 refreshContents(true);
28853470 } else
2886
- if (event.getSource() == clearPanelButton)
3471
+ if (source == clearPanelButton)
28873472 {
28883473 assert(copy == group);
28893474 //copy.ClearUI();
28903475 for (Object3D obj : listUI)
28913476 {
3477
+ obj.pinned = false;
28923478 obj.CloseUI();
28933479 }
28943480 listUI.clear();
28953481 refreshContents(true);
28963482 } else
2897
- if (event.getSource() == allParamsButton)
3483
+ if (source == allParamsButton)
28983484 {
28993485 assert(copy == group);
29003486
2901
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3487
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29023488
29033489 for (Object3D obj : listUI)
29043490 {
....@@ -2915,19 +3501,19 @@
29153501
29163502 refreshContents(true);
29173503 } else
2918
- if (event.getSource() == unselectButton)
3504
+ if (source == unselectButton)
29193505 {
29203506 objEditor.jTree.clearSelection();
29213507 // ?? oct 2012 GrafreeD.clipboard.clear();
29223508 objEditor.ResetSliders();
29233509 refreshContents(true);
29243510 } else
2925
- if(event.getSource() instanceof cRadio)
3511
+ if(source instanceof cRadio)
29263512 {
29273513 group.parent = keepparent;
29283514 group.attributes = 0;
29293515 //group.editWindow = null;
2930
- /*cRadio*/ radio = (cRadio)event.getSource();
3516
+ /*cRadio*/ radio = (cRadio)source;
29313517 Object3D obj = radio.GetObject();
29323518 System.out.println("Edit " + obj);
29333519 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2947,6 +3533,9 @@
29473533 }
29483534
29493535 copy = group;
3536
+
3537
+ SetUndoStates();
3538
+
29503539 //Globals.theRenderer.object = group;
29513540 if(!useclient)
29523541 {
....@@ -2962,20 +3551,46 @@
29623551 frontView.object = group;
29633552 sideView.object = group;
29643553 }
2965
- group.editWindow = this;
3554
+
3555
+// fix "+" issue
3556
+ //group.editWindow = this;
3557
+ group.manipWindow = this;
3558
+
29663559 /*
29673560 currentLayout = radio.layout;
29683561 if (currentLayout == null)
29693562 currentLayout = sevenButton;
29703563 */
29713564 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);
29723572 keepparent = group.parent;
29733573 // PARENT = NULL or not???
29743574 //group.parent = null; // ROOT
29753575 //group.attributes = -1;
29763576 ResetModel();
3577
+
3578
+ cameraView.requestFocusInWindow();
29773579 refreshContents(true);
2978
- }
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
+ }
29793594 else
29803595 {
29813596 //return super.action(event, arg);
....@@ -2984,7 +3599,6 @@
29843599 }
29853600
29863601 boolean useclient = false;
2987
- cRadio radio;
29883602
29893603 void ToggleRoot()
29903604 {
....@@ -3036,6 +3650,28 @@
30363650 refreshContents();
30373651 }
30383652
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
+ }
30393675
30403676 void ResetTransform()
30413677 {
....@@ -3148,7 +3784,7 @@
31483784 refreshContents();
31493785 }
31503786
3151
- void ResetCentroid()
3787
+ void ResetCentroid(boolean full)
31523788 {
31533789 Object3D obj;
31543790 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3163,12 +3799,16 @@
31633799 LA.matIdentity(Object3D.mat);
31643800 obj.getBounds(minima, maxima, false);
31653801 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3166
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3802
+ if (full)
3803
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31673804 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31683805 obj.TransformMesh(Object3D.mat);
3806
+
31693807 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3170
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3808
+ if (full)
3809
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31713810 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3811
+
31723812 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31733813 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31743814 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3197,7 +3837,8 @@
31973837
31983838 int size = obj.MemorySize();
31993839
3200
- 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)");
32013842 }
32023843 }
32033844 catch (Exception e)
....@@ -3234,9 +3875,9 @@
32343875 obj = (Object3D)e.nextElement();
32353876
32363877 System.out.println("Object is: " + obj);
3237
- GrafreeD.AnalyzeObject(obj);
3878
+ Grafreed.AnalyzeObject(obj);
32383879 System.out.println("Boundary rep: " + obj.bRep);
3239
- GrafreeD.AnalyzeObject(obj.bRep);
3880
+ Grafreed.AnalyzeObject(obj.bRep);
32403881
32413882 // System.err.println((size/1024) + " KB is the size of " + obj);
32423883 }
....@@ -3278,6 +3919,13 @@
32783919 void GenNormals(boolean crease)
32793920 {
32803921 group.GenNormalsS(crease);
3922
+
3923
+ refreshContents();
3924
+ }
3925
+
3926
+ void GenNormalsMESH()
3927
+ {
3928
+ group.GenNormalsMeshS();
32813929
32823930 refreshContents();
32833931 }
....@@ -3450,8 +4098,8 @@
34504098
34514099 void ParseVertices()
34524100 {
3453
- boolean epsequal = GrafreeD.epsequal;
3454
- GrafreeD.epsequal = true;
4101
+ boolean epsequal = Grafreed.epsequal;
4102
+ Grafreed.epsequal = true;
34554103
34564104 for (int i=0; i<group.selection.size(); i++)
34574105 {
....@@ -3476,7 +4124,7 @@
34764124 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34774125 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34784126
3479
- g.add(GrafreeD.clipboard);
4127
+ g.add(Grafreed.clipboard);
34804128
34814129 buffer.add(g);
34824130 }
....@@ -3491,7 +4139,7 @@
34914139 makeSomething(buffer, i==group.selection.size()-1);
34924140 }
34934141
3494
- GrafreeD.epsequal = epsequal;
4142
+ Grafreed.epsequal = epsequal;
34954143
34964144 refreshContents();
34974145 }
....@@ -3509,7 +4157,16 @@
35094157 String pigment = Object3D.GetPigment(tex);
35104158 //String bump = Object3D.GetBump(tex);
35114159
3512
- com.sun.opengl.util.texture.TextureData texturedata = Globals.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
+ }
35134170
35144171 double s = v.s;
35154172
....@@ -3597,11 +4254,11 @@
35974254
35984255 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35994256
3600
- boolean random = CameraPane.RANDOM;
3601
- CameraPane.RANDOM = false; // parse all random nodes
4257
+ boolean random = CameraPane.SWITCH;
4258
+ CameraPane.SWITCH = false; // parse all random nodes
36024259 lowres.linkVerticesThis(null);
36034260 lowres.linkVerticesThis(sn);
3604
- CameraPane.RANDOM = random;
4261
+ CameraPane.SWITCH = random;
36054262
36064263 System.err.flush();
36074264
....@@ -3641,7 +4298,7 @@
36414298 return;
36424299
36434300 Object3D poses = group.selection.get(0);
3644
- Object3D ref = GrafreeD.clipboard.get(0);
4301
+ Object3D ref = Grafreed.clipboard.get(0);
36454302
36464303 Object3D newgroup = new Object3D("Po:" + poses.name);
36474304
....@@ -3835,9 +4492,9 @@
38354492
38364493 void ClipMesh()
38374494 {
3838
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4495
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38394496 {
3840
- Object3D content = GrafreeD.clipboard.get(0);
4497
+ Object3D content = Grafreed.clipboard.get(0);
38414498
38424499 if (content instanceof cGroup && ((cGroup)content).transientlink )
38434500 content = ((cGroup)content).get(0);
....@@ -3846,7 +4503,7 @@
38464503 // {
38474504 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38484505 // }
3849
- group.selection.ClipMesh(GrafreeD.clipboard);
4506
+ group.selection.ClipMesh(Grafreed.clipboard);
38504507 }
38514508 // group.selection.ClipMesh(GrafreeD.clipboard);
38524509 System.out.println("DONE.");
....@@ -3893,6 +4550,18 @@
38934550 void MarkLeaves(boolean hide)
38944551 {
38954552 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);
38964565 refreshContents();
38974566 }
38984567
....@@ -3967,28 +4636,25 @@
39674636 // }
39684637 // }
39694638
3970
- static boolean allparams = true;
3971
-
3972
- static Vector<Object3D> listUI = new Vector<Object3D>();
3973
-
39744639 void EditSelection(boolean newWindow)
39754640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
39764647 // aConstraints.gridy = 0;
39774648 for (int i=0; i<group.selection.size(); i++)
39784649 {
39794650 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39804651 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3981
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4652
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39824653
39834654 Object3D elem = (Object3D)group.selection.elementAt(i);
3984
- if(elem != group)
4655
+ if(elem != group || !newWindow)
39854656 {
3986
- // if (!(elem instanceof Composite))
3987
- // newWindow = false;
3988
- listUI.add(elem);
3989
- elem.openEditWindow(this, newWindow); //, false);
3990
- System.out.println("edit : " + elem);
3991
- elem.editWindow.refreshContents(true); // ? new
4657
+ EditElement(elem, newWindow); // ? new
39924658 }
39934659 }
39944660 }
....@@ -4063,7 +4729,8 @@
40634729 //new Exception().printStackTrace();
40644730
40654731 freezemodel = true;
4066
-
4732
+ ClearUnpinned();
4733
+
40674734 /**/
40684735 //switch (event.id)
40694736 {
....@@ -4071,7 +4738,6 @@
40714738 //case 702: // Event.LIST_DESELECT
40724739 group.deselectAll();
40734740 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4074
- objEditor.ClearInfo(); // .GetMaterial());
40754741 if (tps != null)
40764742 {
40774743 for (int i=0; i < tps.length; i++)
....@@ -4080,33 +4746,39 @@
40804746
40814747 //if (child.parent != null)
40824748 //child.parent.addSelectee(child);
4749
+ objEditor.SetMaterial(child);
40834750 group.addSelectee(child);
4084
- objEditor.SetMaterial(child); // .GetMaterial());
4085
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4086
- System.err.println("info : " + child.GetPath());
40874751 }
40884752 }
4089
- else
4090
- {
4091
- objEditor.SetMaterial(group); // .GetMaterial());
4092
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4093
- System.err.println("info : " + group.GetPath());
4094
- }
4753
+// else
4754
+// {
4755
+// objEditor.SetMaterial(group); // .GetMaterial());
4756
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4757
+// System.err.println("info : " + group.GetPath());
4758
+// }
40954759
4096
- objEditor.SetText(); // jan 2014
4097
-
4098
- if (flashIt && !Globals.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))
40994761 CameraPane.flash = true;
41004762
4101
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4763
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41024764 // a camera
41034765 {
4104
- CameraPane.camerachangeframe = 0; // don't refuse it
4105
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
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
+ }
41064771 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41074772 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41084773 }
41094774
4775
+ if (tps != null && tps.length == 1)
4776
+ {
4777
+ EditSelection(false);
4778
+ }
4779
+
4780
+ SetPinStates(tps != null && tps.length > 0);
4781
+
41104782 refreshContents();
41114783 //return true;
41124784 }
....@@ -4115,6 +4787,35 @@
41154787
41164788 freezemodel = false;
41174789 }
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
+ }
41184819
41194820 void linkSomething(Object3D thing)
41204821 {
....@@ -4186,16 +4887,19 @@
41864887 {
41874888 if (group.selection.isEmpty())
41884889 return;
4189
- GrafreeD.clipboardIsTempGroup = false;
4890
+
4891
+ Grafreed.clipboardIsTempGroup = false;
41904892 Composite tGroup = null;
41914893 if (group.selection.size() > 0) // 1)
41924894 {
41934895 tGroup = new cGroup();
4194
- GrafreeD.clipboardIsTempGroup = true;
4896
+ Grafreed.clipboardIsTempGroup = true;
41954897 }
41964898
41974899 if (cut)
41984900 {
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
41994903 //int indices[] = jList.getSelectedIndices();
42004904 //for (int i = indices.length - 1; i >= 0; i--)
42014905 //jList.remove(indices[i]);
....@@ -4231,16 +4935,16 @@
42314935 //System.out.println("cut " + child);
42324936 //System.out.println("parent = " + child.parent);
42334937 // tmp.addChild(child);
4234
- if (GrafreeD.clipboardIsTempGroup)
4938
+ if (Grafreed.clipboardIsTempGroup)
42354939 tGroup.add/*Child*/(tmp);
42364940 else
4237
- GrafreeD.clipboard = tmp;
4941
+ Grafreed.clipboard = tmp;
42384942 }
42394943 else
4240
- if (GrafreeD.clipboardIsTempGroup)
4944
+ if (Grafreed.clipboardIsTempGroup)
42414945 tGroup.add/*Child*/(child);
42424946 else
4243
- GrafreeD.clipboard = child;
4947
+ Grafreed.clipboard = child;
42444948 }
42454949
42464950 //ResetModel();
....@@ -4272,21 +4976,23 @@
42724976 //System.out.println("cut " + elem);
42734977 //System.out.println("parent = " + elem.parent);
42744978 // tmp.addChild(elem);
4275
- if (GrafreeD.clipboardIsTempGroup)
4979
+ if (Grafreed.clipboardIsTempGroup)
42764980 tGroup.add/*Child*/(tmp);
42774981 else
4278
- GrafreeD.clipboard = tmp;
4982
+ Grafreed.clipboard = tmp;
42794983 }
42804984 else
4281
- if (GrafreeD.clipboardIsTempGroup)
4985
+ if (Grafreed.clipboardIsTempGroup)
42824986 tGroup.add/*Child*/(child);
42834987 else
4284
- GrafreeD.clipboard = child;
4988
+ Grafreed.clipboard = child;
42854989 }
42864990
42874991 }
4288
- if (GrafreeD.clipboardIsTempGroup)
4289
- GrafreeD.clipboard = tGroup;
4992
+
4993
+ if (Grafreed.clipboardIsTempGroup)
4994
+ Grafreed.clipboard = tGroup;
4995
+
42904996 if (cut)
42914997 {
42924998 ResetModel();
....@@ -4296,11 +5002,15 @@
42965002
42975003 void paste(boolean expand)
42985004 {
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
42995009 // if (GrafreeD.clipboard == null)
43005010 // return;
43015011 boolean first = true;
43025012
4303
- if (GrafreeD.clipboardIsTempGroup)
5013
+ if (Grafreed.clipboardIsTempGroup)
43045014 {
43055015 Composite temp;
43065016
....@@ -4311,7 +5021,7 @@
43115021 temp = (Composite)Applet3D.clipboard.deepCopy();
43125022 */
43135023 Object3D elem;
4314
- 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))
43155025 {
43165026 Object3D child = (Object3D)e.nextElement();
43175027
....@@ -4345,21 +5055,22 @@
43455055 //Object3D cb = Applet3D.clipboard;
43465056 //temp.addChild(cb);
43475057 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4348
- assert(GrafreeD.clipboard.parent == null);
4349
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4350
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4351
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4352
- 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());
43535063 else
4354
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4355
- GrafreeD.clipboard.get(0).parent = keepparent;
5064
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5065
+ Grafreed.clipboard.get(0).parent = keepparent;
43565066 }
43575067
5068
+ Globals.REPLACEONMAKE = keep;
43585069 ResetModel();
43595070 refreshContents();
43605071 }
43615072
4362
- void pasteInto(boolean copyit)
5073
+ void pasteInto(boolean copyit, boolean clone)
43635074 {
43645075 // if (GrafreeD.clipboard == null)
43655076 // return;
....@@ -4388,15 +5099,22 @@
43885099 if (copyit)
43895100 {
43905101 // paste(false);
4391
- CloneClipboard(false); // sept 2014
5102
+ if (clone)
5103
+ {
5104
+ CloneClipboard(false); // sept 2014
5105
+ }
5106
+ else
5107
+ {
5108
+ paste(false);
5109
+ }
43925110 }
43935111 else
43945112 {
43955113 boolean first = true;
43965114
4397
- if (GrafreeD.clipboardIsTempGroup)
5115
+ if (Grafreed.clipboardIsTempGroup)
43985116 {
4399
- Composite temp = (Composite)GrafreeD.clipboard;
5117
+ Composite temp = (Composite)Grafreed.clipboard;
44005118 Object3D copy;
44015119 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44025120 {
....@@ -4406,7 +5124,7 @@
44065124 }
44075125 } else
44085126 {
4409
- linkSomething(GrafreeD.clipboard); //.get(0));
5127
+ linkSomething(Grafreed.clipboard); //.get(0));
44105128 }
44115129 }
44125130 }
....@@ -4483,6 +5201,10 @@
44835201
44845202 void group(Object3D csg, boolean grab)
44855203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
44865208 if (//false) // why??
44875209 !group.selection.isEmpty())
44885210 {
....@@ -4596,10 +5318,15 @@
45965318 //node.add(csg);
45975319 //makeSomething(node);
45985320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
45995322 }
46005323
46015324 void Ungroup(Object3D g)
46025325 {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
46035330 if (g instanceof HiddenObject)
46045331 {
46055332 HiddenObject h = (HiddenObject) g;
....@@ -4616,6 +5343,7 @@
46165343 objEditor.makeSomething(g.get(i), false);
46175344 }
46185345 }
5346
+ Globals.REPLACEONMAKE = keep;
46195347 }
46205348
46215349 void ungroup()
....@@ -4811,21 +5539,6 @@
48115539 }
48125540 */
48135541
4814
- void ImportGFD()
4815
- {
4816
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4817
- browser.show();
4818
- String filename = browser.getFile();
4819
- if (filename != null && filename.length() > 0)
4820
- {
4821
- String fullname = browser.getDirectory() + filename;
4822
-
4823
- //Object3D readobj =
4824
- objEditor.ReadGFD(fullname, objEditor);
4825
- //makeSomething(readobj);
4826
- }
4827
- }
4828
-
48295542 /*
48305543 public void Callback(Object obj)
48315544 {
....@@ -4849,26 +5562,9 @@
48495562 }
48505563 */
48515564
4852
- void ImportVRMLX3D()
4853
- {
4854
- if (GrafreeD.standAlone)
4855
- {
4856
- /**/
4857
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4858
- browser.show();
4859
- String filename = browser.getFile();
4860
- if (filename != null && filename.length() > 0)
4861
- {
4862
- String fullname = browser.getDirectory() + filename;
4863
- LoadVRMLX3D(fullname);
4864
- }
4865
- /**/
4866
- }
4867
- }
4868
-
48695565 String GetFile(String dialogName)
48705566 {
4871
- if (GrafreeD.standAlone)
5567
+ if (Grafreed.standAlone)
48725568 {
48735569 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48745570 browser.show();
....@@ -4932,10 +5628,33 @@
49325628 cButton flashSelectionButton;
49335629 cButton editButton;
49345630 cButton uneditButton;
5631
+ JCheckBox allParamsButton;
49355632 cButton clearpanelButton;
4936
- cButton allParamsButton;
49375633 cButton unselectButton;
49385634
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
+
49395658 cButton screenfitButton;
49405659 cButton screenfitpointButton;
49415660 cButton snapobjectButton;
....@@ -4947,14 +5666,6 @@
49475666
49485667 cButton setsupportButton;
49495668
4950
- cButton twoButton;
4951
- cButton sixButton;
4952
- cButton threeButton;
4953
- cButton sevenButton;
4954
- cButton fourButton; // full panel
4955
- cButton oneButton; // full XYZ
4956
- //cButton currentLayout;
4957
-
49585669 //
49595670 //Composite
49605671 Object3D // to do !!
....@@ -4964,9 +5675,11 @@
49645675 //JTree jTree;
49655676 private MenuItem lookAtItem;
49665677 private MenuItem lookFromItem;
4967
- private MenuItem switchItem;
5678
+ private MenuItem switchViewItem;
49685679 private MenuItem cutItem;
4969
- private MenuItem duplicateItem;
5680
+ private MenuItem undoItem;
5681
+ private MenuItem redoItem;
5682
+ private JMenuItem duplicateItem;
49705683 private MenuItem cloneItem;
49715684 private MenuItem cloneSupportItem;
49725685 private MenuItem overwriteGeoItem;
....@@ -4979,7 +5692,7 @@
49795692 private MenuItem linkverticesItem;
49805693 private MenuItem relinkverticesItem;
49815694 private MenuItem setMasterItem;
4982
- private MenuItem resetMeshItem;
5695
+ private MenuItem resetAllItem;
49835696 private MenuItem stepAllItem;
49845697 private MenuItem revertMeshItem;
49855698 private MenuItem poseMeshItem;
....@@ -4990,10 +5703,11 @@
49905703 private MenuItem mergeGeometriesItem;
49915704 private MenuItem copyItem;
49925705 private MenuItem pasteItem;
5706
+ private MenuItem pasteIntoItem;
49935707 private MenuItem pasteLinkItem;
49945708 private MenuItem pasteCloneItem;
49955709 private MenuItem pasteExpandItem;
4996
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
49975711 private MenuItem clearAllItem;
49985712 private MenuItem genUVItem;
49995713 private MenuItem genNormalsMESHItem;
....@@ -5028,6 +5742,10 @@
50285742 private MenuItem showleavesItem;
50295743 private MenuItem markleavesItem;
50305744 private MenuItem unmarkleavesItem;
5745
+ private MenuItem rewindleavesItem;
5746
+ private MenuItem unrewindleavesItem;
5747
+ private MenuItem randomleavesItem;
5748
+ private MenuItem unrandomleavesItem;
50315749
50325750 private MenuItem flipVItem;
50335751 private MenuItem unflipVItem;
....@@ -5039,15 +5757,17 @@
50395757 private MenuItem panoTexturesItem;
50405758
50415759 private MenuItem resetCentroidItem;
5042
- private MenuItem transformgeometryItem;
5760
+ private MenuItem resetCentroidXZItem;
50435761 private MenuItem resetTransformItem;
5762
+ private MenuItem transformGeometryItem;
5763
+ private MenuItem transformChildrenItem;
50445764 private MenuItem hideItem;
50455765 private MenuItem grabItem;
50465766 private MenuItem backItem;
50475767 private MenuItem frontItem;
50485768 private MenuItem cameraItem;
50495769 private MenuItem compositeItem;
5050
- private MenuItem randomItem;
5770
+ private MenuItem switchItem;
50515771 private MenuItem physicsItem;
50525772 private MenuItem frameselectorItem;
50535773 private MenuItem scriptNodeItem;
....@@ -5087,7 +5807,7 @@
50875807 private MenuItem blobItem;
50885808 private MenuItem latheItem;
50895809 private MenuItem bezierItem;
5090
- private MenuItem checkerItem;
5810
+ private MenuItem overlayItem;
50915811 private MenuItem meshItem;
50925812 // private MenuItem meshGroupItem;
50935813 private MenuItem springItem;
....@@ -5109,11 +5829,6 @@
51095829 private MenuItem doubleItem;
51105830 private MenuItem tripleItem;
51115831
5112
- private MenuItem importGFDItem;
5113
- private MenuItem importVRMLX3DItem;
5114
- private MenuItem import3DSItem;
5115
- private MenuItem importOBJItem;
5116
-
51175832 private MenuItem computeAOItem;
51185833 private MenuItem recompileItem;
51195834 private MenuItem editScriptItem;
....@@ -5123,4 +5838,8 @@
51235838 private MenuItem analyzeItem;
51245839 private MenuItem dumpItem;
51255840 //boolean freezemodel = false;
5841
+
5842
+ Menu cameraMenu;
5843
+ MenuItem editCameraItem;
5844
+ MenuItem restoreCameraItem;
51265845 }