Normand Briere
2019-07-18 d7a17c35c443e2cb6c09eaa3cfeaf590a571faa1
GroupEditor.java
....@@ -12,6 +12,7 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
1718 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
....@@ -59,6 +60,12 @@
5960 this.copy = this.group = group;
6061 //selectees = this.group.selectees;
6162
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6269 if(ui)
6370 SetupUI(objEditor);
6471 }
....@@ -73,7 +80,13 @@
7380 this.copy = this.group = copy;
7481 //selectees = this.group.selectees;
7582
76
- SetupMenu2(objEditor);
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
89
+ SetupMenu2(this); //objEditor);
7790 SetupUI2(objEditor);
7891 objEditor.SetupUI(true);
7992 SetupViews(objEditor);
....@@ -83,6 +96,10 @@
8396
8497 void CloneSelection(boolean supports)
8598 {
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
86103 // Object3D keep = GrafreeD.clipboard;
87104 //Object3D obj;
88105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +110,19 @@
93110
94111 makeSomething(clone, i==group.selection.size()-1);
95112 }
113
+ Globals.REPLACEONMAKE = keep;
96114 }
97115
98116 void CloneClipboard(boolean supports)
99117 {
100
- assert(GrafreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
102
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
118
+ assert(Grafreed.clipboard.parent == null);
119
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
120
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
121
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
122
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105123 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
124
+ makeSomething(CloneObject(Grafreed.clipboard, false));
125
+ Grafreed.clipboard.get(0).parent = keepparent;
108126 }
109127
110128 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +136,7 @@
118136 // obj.support = null;
119137 if (!supports)
120138 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
139
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122140 obj.parent = parent;
123141 // obj.support = support;
124142 // clone.support = support; // aout 2013
....@@ -147,30 +165,29 @@
147165
148166 //JTextField nameField;
149167
150
- void SetupMenu2(ObjEditor oe)
168
+ void SetupMenu2(GroupEditor oe)
151169 {
152
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
155
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
156
- oe.cameraMenu.add("-");
157
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
158
- openWindowItem.addActionListener(this);
159
- editLeafItem.addActionListener(this);
160
- lookAtItem.addActionListener(this);
161
- //lookFromItem.addActinoListener(this);
162
- //switchItem.addActionListener(this);
170
+ oe.jTree = new cTree();
171
+
163172 Menu menu;
164173 oe.menuBar.add(menu = new Menu("Edit"));
165174 //editItem = menu.add(new MenuItem("Edit"));
166175 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
176
+
177
+// undoItem = menu.add(new MenuItem("Undo"));
178
+// undoItem.addActionListener(this);
179
+// redoItem = menu.add(new MenuItem("Redo"));
180
+// redoItem.addActionListener(this);
181
+// menu.add("-");
182
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168183 duplicateItem.addActionListener(this);
169
- menu.add("-");
170184 cloneItem = menu.add(new MenuItem("Clone"));
171185 cloneItem.addActionListener(this);
186
+ if (Globals.ADVANCED)
187
+ {
172188 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173189 cloneSupportItem.addActionListener(this);
190
+ }
174191 menu.add("-");
175192 cutItem = menu.add(new MenuItem("Cut"));
176193 cutItem.addActionListener(this);
....@@ -178,27 +195,123 @@
178195 copyItem.addActionListener(this);
179196 pasteItem = menu.add(new MenuItem("Paste"));
180197 pasteItem.addActionListener(this);
198
+
199
+ menu.add("-");
200
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
201
+ pasteIntoItem.addActionListener(this);
181202 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182203 pasteLinkItem.addActionListener(this);
183204 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184205 pasteCloneItem.addActionListener(this);
185206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186207 // pasteExpandItem.addActionListener(this);
208
+ menu.add("-");
187209 clearItem = menu.add(new MenuItem("Clear"));
188210 clearItem.addActionListener(this);
211
+
212
+ if (Globals.ADVANCED)
213
+ {
214
+ // Deletes the cameras...
189215 clearAllItem = menu.add(new MenuItem("Clear All"));
190216 clearAllItem.addActionListener(this);
217
+ }
218
+
219
+ menuBar.add(cameraMenu = new Menu("View"));
220
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
221
+ //zBufferItem.addActionListener(this);
222
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
223
+ //normalLensItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
226
+
227
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
228
+// toggleFullScreenItem.addItemListener(this);
229
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
230
+// cameraMenu.add("-");
231
+//
232
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
233
+// toggleTextureItem.addItemListener(this);
234
+// toggleTextureItem.setState(CameraPane.textureon);
235
+//
236
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
237
+// toggleSwitchItem.addItemListener(this);
238
+// toggleSwitchItem.setState(CameraPane.SWITCH);
239
+
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
241
+ toggleHandleItem.addItemListener(this);
242
+ toggleHandleItem.setState(CameraPane.HANDLES);
243
+
244
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
245
+ togglePaintItem.addItemListener(this);
246
+ togglePaintItem.setState(CameraPane.PAINTMODE);
247
+
248
+ if (Globals.ADVANCED)
249
+ {
250
+ cameraMenu.add("-");
251
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
252
+ toggleLiveItem.addItemListener(this);
253
+ toggleLiveItem.setState(Globals.isLIVE());
191254
255
+ cameraMenu.add(stepItem = new MenuItem("Step"));
256
+ stepItem.addActionListener(this);
257
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
258
+ // toggleDLItem.addItemListener(this);
259
+ // toggleDLItem.setState(false);
260
+
261
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
262
+ toggleRenderItem.addItemListener(this);
263
+ toggleRenderItem.setState(!CameraPane.frozen);
264
+
265
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
266
+ toggleDebugItem.addItemListener(this);
267
+ toggleDebugItem.setState(Globals.DEBUG);
268
+
269
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
270
+ toggleFrustumItem.addItemListener(this);
271
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
272
+
273
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
274
+ toggleFootContactItem.addItemListener(this);
275
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
276
+
277
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
278
+ toggleTimelineItem.addItemListener(this);
279
+ }
280
+
281
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
282
+// toggleRootItem.addItemListener(this);
283
+// toggleRootItem.setState(false);
284
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
285
+// animationItem.addItemListener(this);
286
+// animationItem.setState(CameraPane.ANIMATION);
287
+ cameraMenu.add("-");
288
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
289
+ editCameraItem.addActionListener(this);
290
+
291
+ if (Globals.ADVANCED)
292
+ {
293
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
294
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
296
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
297
+ oe.cameraMenu.add("-");
298
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
299
+ openWindowItem.addActionListener(this);
300
+ editLeafItem.addActionListener(this);
301
+ lookAtItem.addActionListener(this);
302
+ //lookFromItem.addActinoListener(this);
303
+ //switchViewItem.addActionListener(this);
304
+ }
305
+
192306 oe.menuBar.add(menu = new Menu("Setting"));
193
- resetMeshItem = menu.add(new MenuItem("Reset All"));
194
- resetMeshItem.addActionListener(this);
195
- stepAllItem = menu.add(new MenuItem("Step All"));
196
- stepAllItem.addActionListener(this);
307
+ if (Globals.ADVANCED)
308
+ {
197309 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198310 revertMeshItem.addActionListener(this);
199311 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200312 resetreferencesItem.addActionListener(this);
201313 menu.add("-");
314
+ }
202315 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203316 overwriteGeoItem.addActionListener(this);
204317 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,73 +323,104 @@
210323 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211324 overwriteUVItem.addActionListener(this);
212325 menu.add("-");
326
+ if (Globals.ADVANCED)
327
+ {
213328 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214329 generateMeshItem.addActionListener(this);
215330 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216331 poseMeshItem.addActionListener(this);
217332 menu.add("-");
333
+ }
218334 resetsupportItem = menu.add(new MenuItem("Reset support"));
219335 resetsupportItem.addActionListener(this);
220336 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221337 linkverticesItem.addActionListener(this);
338
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
339
+ relinkverticesItem.addActionListener(this);
340
+
341
+ if (Globals.ADVANCED)
342
+ {
222343 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223344 setMasterItem.addActionListener(this);
345
+ }
224346
225347 oe.menuBar.add(menu = new Menu("Group"));
226
- grabItem = menu.add(new MenuItem("Grab"));
227
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
228350 backItem = menu.add(new MenuItem("Back"));
229351 backItem.addActionListener(this);
230352 frontItem = menu.add(new MenuItem("Front"));
231353 frontItem.addActionListener(this);
232
- compositeItem = menu.add(new MenuItem("Composite"));
233
- compositeItem.addActionListener(this);
234
- menu.add("-");
235
- randomItem = menu.add(new MenuItem("Random"));
236
- randomItem.addActionListener(this);
237
- physicsItem = menu.add(new MenuItem("Physics"));
238
- physicsItem.addActionListener(this);
239
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
240
- frameselectorItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
359
+ hideItem = menu.add(new MenuItem("Hidden Group"));
360
+ hideItem.addActionListener(this);
361
+ }
362
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
363
+ ungroupItem.addActionListener(this);
364
+
365
+// menu.add("-");
366
+//
367
+// switchItem = menu.add(new MenuItem("Switch node"));
368
+// switchItem.addActionListener(this);
369
+ if (Globals.ADVANCED)
370
+ {
241371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
242372 switchGeoItem.addActionListener(this);
243373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
244374 switchTransfoItem.addActionListener(this);
245
- morphItem = menu.add(new MenuItem("Morph"));
375
+ morphItem = menu.add(new MenuItem("Morph Group"));
246376 morphItem.addActionListener(this);
377
+
378
+ menu.add("-");
379
+ physicsItem = menu.add(new MenuItem("Physics"));
380
+ physicsItem.addActionListener(this);
381
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
382
+ frameselectorItem.addActionListener(this);
247383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
248384 scriptNodeItem.addActionListener(this);
249
- cameraItem = menu.add(new MenuItem("Camera"));
250
- cameraItem.addActionListener(this);
385
+ }
251386
252387 oe.menuBar.add(menu = new Menu("Object"));
253
- textureItem = menu.add(new MenuItem("Texture"));
254
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
390
+ billboardItem = menu.add(new MenuItem("Billboard"));
391
+ billboardItem.addActionListener(this);
255392 csgItem = menu.add(new MenuItem("CSG"));
256393 csgItem.addActionListener(this);
257
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
258395 shadowXItem.addActionListener(this);
259
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
260397 shadowYItem.addActionListener(this);
261
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
262399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
403
+ if (Globals.ADVANCED)
404
+ {
405
+ menu.add("-");
263406 linkerItem = menu.add(new MenuItem("Linker"));
264407 linkerItem.addActionListener(this);
265408 templateItem = menu.add(new MenuItem("Template"));
266409 templateItem.addActionListener(this);
267
- attributeItem = menu.add(new MenuItem("Attribute"));
268
- attributeItem.addActionListener(this);
269410 pointflowItem = menu.add(new MenuItem("Point Flow"));
270411 pointflowItem.addActionListener(this);
412
+ }
271413 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274414 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275415 resetTransformItem.addActionListener(this);
276416 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277417 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.addActionListener(this);
418
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
419
+ resetCentroidXZItem.addActionListener(this);
420
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
421
+ transformGeometryItem.addActionListener(this);
422
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
423
+ transformChildrenItem.addActionListener(this);
280424
281425 oe.menuBar.add(menu = new Menu("Geometry"));
282426 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -285,6 +429,13 @@
285429 genNormalsORGANItem.addActionListener(this);
286430 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
287431 genNormalsCADItem.addActionListener(this);
432
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
433
+ genNormalsMESHItem.addActionListener(this);
434
+ if (Globals.ADVANCED)
435
+ {
436
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
437
+ genNormalsMINEItem.addActionListener(this);
438
+ }
288439 stripifyItem = menu.add(new MenuItem("Stripify"));
289440 stripifyItem.addActionListener(this);
290441 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -306,23 +457,34 @@
306457 reduce34MeshItem.addActionListener(this);
307458 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308459 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311460 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312461 clipMeshItem.addActionListener(this);
462
+
463
+ if (Globals.ADVANCED)
464
+ {
465
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
466
+ smoothMeshItem.addActionListener(this);
467
+ }
313468
314469 oe.menuBar.add(menu = new Menu("Attributes"));
315470 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
316471 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);
317476 menu.add("-");
318477 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
319478 liveleavesItem.addActionListener(this);
320479 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
321480 unliveleavesItem.addActionListener(this);
481
+ if (Globals.ADVANCED)
482
+ {
322483 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
323484 supportleavesItem.addActionListener(this);
324485 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
325486 unsupportleavesItem.addActionListener(this);
487
+ }
326488 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
327489 hideleavesItem.addActionListener(this);
328490 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -331,6 +493,14 @@
331493 markleavesItem.addActionListener(this);
332494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
333495 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);
334504 menu.add("-");
335505 flipVItem = menu.add(new MenuItem("Flip V"));
336506 flipVItem.addActionListener(this);
....@@ -366,35 +536,41 @@
366536 sortbynameItem = menu.add(new MenuItem("Sort by name"));
367537 sortbynameItem.addActionListener(this);
368538 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.
369546 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
370547 extractGeometriesItem.addActionListener(this);
371548 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
372549 cloneGeometriesItem.addActionListener(this);
373
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
374
- shareGeometriesItem.addActionListener(this);
375
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
376
- mergeGeometriesItem.addActionListener(this);
550
+ }
377551
378552 oe.menuBar.add(menu = new Menu("Insert"));
379553 buildCreateMenu(menu);
380554
381
-
382
- oe.menuBar.add(menu = new Menu("Include"));
383
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
384
- importGFDItem.addActionListener(this);
385
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
386
- importVRMLX3DItem.addActionListener(this);
387
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
388
- importOBJItem.addActionListener(this);
389
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
390
- import3DSItem.addActionListener(this);
391
-
392555 oe.menuBar.add(menu = new Menu("Tools"));
393556 buildToolsMenu(menu);
394557 }
395558
559
+
396560 void SetupUI2(ObjEditor oe)
397561 {
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
+
398574 //new Exception().printStackTrace();
399575
400576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -423,150 +599,230 @@
423599 oe.radioPanel.add(dummyButton);
424600 oe.buttonGroup.add(dummyButton);
425601 */
426
- aConstraints.gridy += 1;
427
- oe.aConstraints.gridwidth = 1;
428
- oe.aConstraints.gridx = 0;
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
429605
430
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
606
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
607
+
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
611
+
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
618
+
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ fullButton.setToolTipText("Full-screen window");
621
+ fullButton.addActionListener(this);
622
+
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ screenfitButton.setToolTipText("Screen fit");
625
+ screenfitButton.addActionListener(this);
626
+
627
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ restoreCameraButton.setToolTipText("Restore viewpoint");
629
+ restoreCameraButton.addActionListener(this);
630
+
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
633
+ saveButton.addActionListener(this);
634
+
635
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ undoButton.setToolTipText("Previous version");
637
+ undoButton.addActionListener(this);
638
+ undoButton.setEnabled(false);
639
+
640
+ cGridBag updown = new cGridBag().setVertical(true);
641
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ restoreButton.setToolTipText("Restore current");
643
+ restoreButton.addActionListener(this);
644
+ restoreButton.setEnabled(false);
645
+
646
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ replaceButton.setToolTipText("Replace current");
648
+ replaceButton.addActionListener(this);
649
+ replaceButton.setEnabled(false);
650
+
651
+ copyOptionsPanel.add(updown);
652
+
653
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ redoButton.setToolTipText("Next version");
655
+ redoButton.addActionListener(this);
656
+ redoButton.setEnabled(false);
657
+
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
659
+ liveCB.setToolTipText("Enable animation");
431660 liveCB.addItemListener(this);
432661
433
- oe.aConstraints.gridx += 1;
434
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
435
- supportCB.addItemListener(this);
436
-
437
- // oe.aConstraints.gridx += 1;
438
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
439
- // localCB.addItemListener(this);
440
-
441
- oe.aConstraints.gridx += 1;
442
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
443
- crowdCB.addItemListener(this);
444
-
445
- oe.aConstraints.gridx += 1;
446
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
447
- smoothCB.addItemListener(this);
448
-
449
- oe.aConstraints.gridx += 1;
450
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
+ oneStepButton.setToolTipText("Animate one step forward");
664
+ oneStepButton.addActionListener(this);
665
+
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
667
+ fastCB.setToolTipText("Fast mode");
451668 fastCB.addItemListener(this);
452
- oe.aConstraints.gridx += 1;
453
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
454
- slowCB.addItemListener(this);
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
457
- boxCB.addItemListener(this);
669
+
670
+ //oe.toolboxPanel.Return();
671
+
672
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
673
+// trackCB.setToolTipText("Enable tracking");
674
+// trackCB.addItemListener(this);
458675
459
-// oe.aConstraints.gridx += 1;
460
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
461
-// speakerMocapCB.addItemListener(this);
462
-
463
- if (false)
464
- {
465
- // handled in scripts
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
468
- speakerCameraCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
472
- speakerFocusCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
476
- smoothfocusCB.addItemListener(this);
477
- }
478
-
479
-//oe.aConstraints.gridx += 1;
480
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
481
-// debugCB.addItemListener(this);
482
-
483
- oe.aConstraints.gridx += 1;
484
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
485
- oeilCB.addItemListener(this);
486
-
487
- oe.aConstraints.gridx += 1;
488
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
489
- lookAtCB.addItemListener(this);
490
-
491
- oe.aConstraints.gridx += 1;
492
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
493
- trackCB.addItemListener(this);
494
-
495
- oe.aConstraints.gridx += 1;
496
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
497
- screenfitButton.addActionListener(this);
498
- oe.aConstraints.gridx += 1;
499676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
500677 // screenfitpointButton.addActionListener(this);
501
-// oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
503
- snapobjectButton.addActionListener(this);
504
- oe.aConstraints.gridx += 1;
505678
506
- //aConstraints.gridx = 0;
507
- //aConstraints.gridy += 1;
508
- oe.aConstraints.weighty = 0;
509
- oe.aConstraints.gridwidth = 1;
510
-
511
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
512
- flashSelectionButton.addActionListener(this);
513
- oe.aConstraints.gridx += 1;
514
- oe.aConstraints.weighty = 0;
515
- oe.aConstraints.gridwidth = 1;
679
+ if (Globals.ADVANCED)
680
+ {
681
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ snapobjectButton.addActionListener(this);
683
+ snapobjectButton.setToolTipText("Snap Object");
684
+ }
685
+
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
516687
517
- //
518
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
689
+ twoButton.setToolTipText("Show center view only");
519690 twoButton.addActionListener(this);
520
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
691
+ this.fullscreenLayout = twoButton;
692
+
693
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521694 fourButton.addActionListener(this);
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
695
+ fourButton.setToolTipText("Show left panel only");
696
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697
+ sixButton.setToolTipText("2-column layout left");
523698 sixButton.addActionListener(this);
524
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ threeButton.setToolTipText("2-column layout right");
525701 threeButton.addActionListener(this);
526
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
702
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+ sevenButton.setToolTipText("3-column layout");
527704 sevenButton.addActionListener(this);
528705 //
529706
530
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
707
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ rootButton.setToolTipText("Edit selection in new tab");
531709 rootButton.addActionListener(this);
532
- oe.aConstraints.gridx += 1;
533
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
710
+
711
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
712
+ closeButton.setToolTipText("Close tab");
534713 closeButton.addActionListener(this);
535714 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
536715 //clearButton.addActionListener(this);
537
- oe.aConstraints.gridx += 1;
538
-
539
- oe.aConstraints.gridx = 1; //
540
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
541
- editButton.addActionListener(this);
542
- oe.aConstraints.gridx += 1;
543
- oe.aConstraints.weighty = 0;
544
- oe.aConstraints.gridwidth = 1;
545716
546
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
717
+ // INSERT
718
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ gridButton.setToolTipText("Create grid");
720
+ gridButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ boxButton.setToolTipText("Create box");
724
+ boxButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ sphereButton.setToolTipText("Create sphere");
728
+ sphereButton.addActionListener(this);
729
+
730
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
731
+ coneButton.setToolTipText("Create cone");
732
+ coneButton.addActionListener(this);
733
+
734
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
735
+ torusButton.setToolTipText("Create torus");
736
+ torusButton.addActionListener(this);
737
+
738
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
739
+ superButton.setToolTipText("Create superellipsoid");
740
+ superButton.addActionListener(this);
741
+
742
+ if (Globals.ADVANCED)
743
+ {
744
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ kleinButton.setToolTipText("Create Klein bottle");
746
+ kleinButton.addActionListener(this);
747
+ }
748
+
749
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ particlesButton.setToolTipText("Create particle system");
751
+ particlesButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.Return();
754
+
755
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ groupButton.setToolTipText("Create group");
757
+ groupButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ compositeButton.setToolTipText("Create composite");
761
+ compositeButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ switchButton.setToolTipText("Create item switcher");
765
+ switchButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ loopButton.setToolTipText("Create loop");
769
+ loopButton.addActionListener(this);
770
+
771
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
772
+ textureButton.setToolTipText("Create texture");
773
+ textureButton.addActionListener(this);
774
+
775
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
776
+ overlayButton.setToolTipText("Create overlay");
777
+ overlayButton.addActionListener(this);
778
+
779
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ lightButton.setToolTipText("Create light");
781
+ lightButton.addActionListener(this);
782
+
783
+ for (int i=6; --i>=0;)
784
+ {
785
+ oe.toolboxPanel.Return();
786
+ oe.toolboxPanel.add(new cGridBag());
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ }
794
+
795
+ // EDIT panel
796
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ editButton.setToolTipText("Pin selection controls");
798
+ editButton.addActionListener(this);
799
+
800
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ uneditButton.setToolTipText("Remove selection controls");
547802 uneditButton.addActionListener(this);
548803
549
- oe.aConstraints.gridx += 1;
550
- oe.aConstraints.weighty = 0;
551
- oe.aConstraints.gridwidth = 1;
552
-
553
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
554
- clearPanelButton.addActionListener(this);
555
-
556
- oe.aConstraints.gridx += 1;
557
- oe.aConstraints.weighty = 0;
558
- oe.aConstraints.gridwidth = 1;
559
-
560
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
804
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
805
+ allParamsButton.setToolTipText("Show all controle");
561806 allParamsButton.addActionListener(this);
562807
563
- oe.aConstraints.gridx += 1;
564
- oe.aConstraints.weighty = 0;
565
- oe.aConstraints.gridwidth = 1;
566
-
567
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
808
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ clearPanelButton.setToolTipText("Clear edit panel");
810
+ clearPanelButton.addActionListener(this);
811
+
812
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ unselectButton.setToolTipText("Unselect");
568814 unselectButton.addActionListener(this);
569815
816
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ flashSelectionButton.setToolTipText("Highlight selection");
818
+ flashSelectionButton.addActionListener(this);
819
+
820
+ editCommandsPanel.preferredHeight = 1;
821
+
822
+ SetPinStates(false);
823
+// oe.treePanel.add(commandsPanel);
824
+// oe.treePanel.Return();
825
+
570826 // oe.aConstraints.gridx += 1;
571827 // oe.aConstraints.weighty = 0;
572828 // oe.aConstraints.gridwidth = 1;
....@@ -578,40 +834,25 @@
578834 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
579835 // gcButton.addActionListener(this);
580836
581
- oe.aConstraints.gridx = 0;
582
- oe.aConstraints.gridy += 1;
583
-
584
- //ctrlPanel.add(objList = new List(5, true));
585
- oe.aConstraints.gridwidth = 100;
586
- // oe.aConstraints.gridheight = 100;
587
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
588
- oe.aConstraints.gridheight = 1;
589
- oe.aConstraints.weighty = 0.5;
590
- oe.aConstraints.gridx = 0;
591
- JScrollPane jSP;
837
+ cGridBag jSPPanel = new cGridBag();
838
+
839
+ JScrollPane jSP;
592840 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
593
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
841
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
594842 ResetModel();
595
- oe.aConstraints.weighty = 0.5;
596
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
597
- oe.aConstraints.gridy += 1;
598
- oe.aConstraints.gridwidth = 1;
599
-
600
- oe.aConstraints.weighty = 0;
601
- oe.aConstraints.gridwidth = 2;
602
-
603
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
604
- colorCB.addItemListener(this);
605
- oe.aConstraints.gridx += 2;
606
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
607
- materialCB.addItemListener(this);
608
- oe.aConstraints.gridx += 2;
609
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
610
- textureCB.addItemListener(this);
611
-
612
- oe.aConstraints.gridx = 0;
613
- oe.aConstraints.gridy += 1;
614843
844
+ oe.treePanel.add(jSPPanel);
845
+ oe.treePanel.Return();
846
+
847
+ oe.treePanel.add(copyOptionsPanel);
848
+ oe.treePanel.Return();
849
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
850
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
851
+ sliderPane.preferredHeight = 1;
852
+
853
+// mainPanel.setDividerLocation(0.5); //1.0);
854
+// mainPanel.setResizeWeight(0.5);
855
+
615856 //jList.addListSelectionListener(this);
616857 oe.jTree.addTreeSelectionListener(this);
617858 //jTree.setRootVisible(false);
....@@ -633,20 +874,157 @@
633874 radio.layout = sevenButton;
634875 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
635876 }
877
+
878
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
879
+ {
880
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
881
+ colorCB.setToolTipText("Copy color when dropped");
882
+ colorCB.addItemListener(this);
883
+
884
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
885
+ materialCB.setToolTipText("Copy material when dropped");
886
+ materialCB.addItemListener(this);
887
+
888
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
889
+ textureCB.setToolTipText("Copy texture when dropped");
890
+ textureCB.addItemListener(this);
891
+
892
+ panel.Return();
893
+
894
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
895
+ boxCB.setToolTipText("Display bounding boxes");
896
+ boxCB.addItemListener(this);
897
+
898
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
899
+ zoomBoxCB.setToolTipText("Display only for wheel");
900
+ zoomBoxCB.addItemListener(this);
901
+
902
+ if (true) // Globals.ADVANCED)
903
+ {
904
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
905
+// supportCB.setToolTipText("Enable rigging");
906
+// supportCB.addItemListener(this);
907
+
908
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
909
+ freezeCB.setToolTipText("Fast moving camera");
910
+ freezeCB.addItemListener(this);
911
+
912
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
913
+ // localCB.addItemListener(this);
914
+
915
+ panel.Return();
916
+
917
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
918
+ crowdCB.setToolTipText("Used for crowds");
919
+ crowdCB.addItemListener(this);
920
+
921
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
922
+ smoothCB.setToolTipText("Snapping delay");
923
+ smoothCB.addItemListener(this);
924
+
925
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
926
+ slowCB.setToolTipText("Smooth interpolation");
927
+ slowCB.addItemListener(this);
928
+
929
+// constraints.gridy += 1;
930
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
931
+// speakerMocapCB.addItemListener(this);
932
+
933
+ panel.Return();
934
+
935
+ if (false)
936
+ {
937
+ // handled in scripts
938
+ //constraints.gridy += 1;
939
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
940
+ speakerCameraCB.addItemListener(this);
941
+
942
+ //constraints.gridy += 1;
943
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
944
+ speakerFocusCB.addItemListener(this);
945
+
946
+ //constraints.gridy += 1;
947
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
948
+ smoothfocusCB.addItemListener(this);
949
+ panel.Return();
950
+ }
951
+
952
+//constraints.gridx += 1;
953
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
954
+// debugCB.addItemListener(this);
955
+
956
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
957
+ trackCB.setToolTipText("Enable tracking target");
958
+ trackCB.addItemListener(this);
959
+
960
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
961
+ oeilCB.setToolTipText("Move camera when tracking");
962
+ oeilCB.addItemListener(this);
963
+
964
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
965
+ shadowCB.setToolTipText("When live compute shadows");
966
+ shadowCB.addItemListener(this);
967
+
968
+ panel.Return();
969
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
970
+ toggleTextureCB.setToolTipText("Load textures");
971
+ toggleTextureCB.addItemListener(this);
972
+
973
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
974
+ toggleSwitchCB.setToolTipText("Choose a single item");
975
+ toggleSwitchCB.addItemListener(this);
976
+
977
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
978
+ autokeepCB.setToolTipText("On structure change");
979
+ autokeepCB.addItemListener(this);
980
+
981
+ panel.Return();
982
+ if (Globals.ADVANCED)
983
+ {
984
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
985
+ lookAtCB.setToolTipText("Look-at target");
986
+ lookAtCB.addItemListener(this);
987
+ }
988
+
989
+ }
990
+
991
+ cGridBag fill = new cGridBag();
992
+ fill.preferredHeight = 200;
993
+ cGridBag fill2 = new cGridBag();
994
+ fill2.preferredHeight = 200;
995
+ cGridBag fill3 = new cGridBag();
996
+ fill3.preferredHeight = 200;
997
+
998
+ panel.add(fill);
999
+ panel.add(fill2);
1000
+ panel.add(fill3);
1001
+
1002
+ }
6361003
6371004 void EditObject(Object3D obj)
6381005 {
639
- cRadio dummyButton = new cRadio(obj.name);
640
- dummyButton.SetObject(obj);
641
- dummyButton.layout = sevenButton;
642
- dummyButton.SetCamera(cameraView.renderCamera, false);
643
- dummyButton.addActionListener(this);
644
- radioPanel.add(dummyButton);
645
- buttonGroup.add(dummyButton);
646
- dummyButton.doClick();
1006
+ cRadio radioButton = new cRadio(obj.name);
1007
+
1008
+ // June 2019. Patch to avoid bug with transparency.
1009
+ radioButton.hadMaterial = obj.material != null;
1010
+ if (!radioButton.hadMaterial)
1011
+ {
1012
+ obj.material = new cMaterial();
1013
+ }
1014
+
1015
+ radioButton.SetObject(obj);
1016
+ radioButton.layout = sevenButton;
1017
+ radioButton.SetCamera(cameraView.renderCamera, false);
1018
+ radioButton.addActionListener(this);
1019
+ radioPanel.add(radioButton);
1020
+ buttonGroup.add(radioButton);
1021
+ radioButton.doClick();
6471022 }
1023
+
6481024 void SetupViews(ObjEditor oe)
6491025 {
1026
+ theFrame = this;
1027
+
6501028 oe.SetupViews();
6511029
6521030 System.out.println("SetupViews");
....@@ -655,22 +1033,28 @@
6551033 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6561034 }
6571035
658
- JCheckBox liveCB;
659
- JCheckBox supportCB;
660
- JCheckBox localCB;
661
- JCheckBox crowdCB;
662
- JCheckBox smoothCB;
663
- JCheckBox fastCB;
664
- JCheckBox slowCB;
665
- JCheckBox boxCB;
666
- JCheckBox trackCB;
667
- JCheckBox smoothfocusCB;
1036
+ cToggleButton liveCB;
1037
+ cCheckBox supportCB;
1038
+ cCheckBox localCB;
1039
+ cCheckBox crowdCB;
1040
+ cCheckBox smoothCB;
1041
+ cToggleButton fastCB;
1042
+ cCheckBox slowCB;
1043
+ cCheckBox boxCB;
1044
+ cCheckBox zoomBoxCB;
1045
+ cCheckBox freezeCB;
1046
+ //cToggleButton trackCB;
1047
+ cCheckBox trackCB;
1048
+ cCheckBox smoothfocusCB;
6681049 // JCheckBox speakerMocapCB;
669
- JCheckBox speakerCameraCB;
670
- JCheckBox speakerFocusCB;
671
- JCheckBox debugCB;
672
- JCheckBox oeilCB;
673
- JCheckBox lookAtCB;
1050
+ cCheckBox speakerCameraCB;
1051
+ cCheckBox speakerFocusCB;
1052
+ cCheckBox debugCB;
1053
+
1054
+ cCheckBox oeilCB;
1055
+ cCheckBox shadowCB;
1056
+ cCheckBox autokeepCB;
1057
+ cCheckBox lookAtCB;
6741058
6751059 // static int COLOR = 1;
6761060 // static int MATERIAL = 2;
....@@ -678,9 +1062,9 @@
6781062
6791063 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6801064
681
- JCheckBox colorCB;
682
- JCheckBox materialCB;
683
- JCheckBox textureCB;
1065
+ cCheckBox colorCB;
1066
+ cCheckBox materialCB;
1067
+ cCheckBox textureCB;
6841068
6851069 public void itemStateChanged(ItemEvent e)
6861070 {
....@@ -705,10 +1089,10 @@
7051089 dropAttributes |= Object3D.TEXTURE;
7061090 else
7071091 dropAttributes &= ~Object3D.TEXTURE;
708
- }
709
- else if(e.getSource() == liveCB)
1092
+ } else if(e.getSource() == liveCB)
7101093 {
7111094 cameraView.ToggleLive();
1095
+ refreshContents(false);
7121096 }
7131097 else if(e.getSource() == supportCB)
7141098 {
....@@ -744,6 +1128,10 @@
7441128 cameraView.repaint();
7451129 // refreshContents();
7461130 }
1131
+ else if(e.getSource() == zoomBoxCB)
1132
+ {
1133
+ cameraView.ToggleZoomBoxMode();
1134
+ }
7471135 else if(e.getSource() == smoothfocusCB)
7481136 {
7491137 cameraView.ToggleSmoothFocus();
....@@ -769,6 +1157,18 @@
7691157 {
7701158 cameraView.ToggleOeil();
7711159 }
1160
+ else if(e.getSource() == shadowCB)
1161
+ {
1162
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1163
+ }
1164
+ else if(e.getSource() == freezeCB)
1165
+ {
1166
+ Globals.FREEZEONMOVE ^= true;
1167
+ }
1168
+ else if(e.getSource() == autokeepCB)
1169
+ {
1170
+ Globals.REPLACEONMAKE ^= true;
1171
+ }
7721172 else if(e.getSource() == lookAtCB)
7731173 {
7741174 cameraView.ToggleLookAt();
....@@ -785,7 +1185,8 @@
7851185
7861186 /**/
7871187 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
788
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1188
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ TreePath path = objEditor.jTree.getSelectionPath();
7891190 if ((path == null) || (path.getPathCount() <= 1)) {
7901191 // We can't move the root node or an empty selection
7911192 return;
....@@ -848,8 +1249,6 @@
8481249 }
8491250 }
8501251
851
- String string = (String) object;
852
-
8531252 System.out.println("Transfer = " + object + "; drop : " + target);
8541253 // if( object instanceof java.io.File[])
8551254 // {
....@@ -857,7 +1256,11 @@
8571256 // objEditor.DropFile((java.io.File[]) object, true);
8581257 // return;
8591258 // }
860
- if (string.charAt(0) == '/')
1259
+
1260
+ String string = object.toString();
1261
+
1262
+ // File path for Mac and Windows
1263
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8611264 {
8621265 // file(s)
8631266 String[] names = string.split("\n");
....@@ -884,7 +1287,7 @@
8841287
8851288 flashIt = false;
8861289 CameraPane pane = (CameraPane) target;
887
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1290
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8881291 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8891292
8901293 if (group.selection.size() == 1)
....@@ -900,23 +1303,33 @@
9001303
9011304 assert target == objEditor.jTree;
9021305 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1306
+ Object3D destinationLeaf;
9031307 try {
904
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1308
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9051309 } catch (Exception e) {
9061310 System.out.println("destinationPath : " + destinationPath);
9071311 return;
9081312 }
9091313
910
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1314
+ for (int i=group.selection.size(); --i>=0;)
9111315 {
1316
+ Object3D child = (Object3D)group.selection.elementAt(i);
1317
+
1318
+ // Cannot move into itself
1319
+ if (child == destinationLeaf)
1320
+ return;
1321
+ }
1322
+
1323
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1324
+// {
9121325 loadClipboard(true);
9131326 objEditor.jTree.setSelectionPath(destinationPath);
914
- pasteInto(false);
915
- } else {
916
- loadClipboard(false);
917
- objEditor.jTree.setSelectionPath(destinationPath);
918
- pasteInto(false); // true); // ???
919
- }
1327
+ pasteInto(false, false);
1328
+// } else {
1329
+// loadClipboard(false);
1330
+// objEditor.jTree.setSelectionPath(destinationPath);
1331
+// pasteInto(false, false); // true); // ???
1332
+// }
9201333 }
9211334 public void dropActionChanged(DropTargetDragEvent dtde)
9221335 // Called if the user has modified the current drop gesture
....@@ -1021,83 +1434,107 @@
10211434 {
10221435 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10231436 //heightFieldItem.addActionListener(this);
1024
- gridItem = menu.add(new MenuItem("Grid"));
1025
- gridItem.addActionListener(this);
1026
- rectoidItem = menu.add(new MenuItem("Box"));
1027
- rectoidItem.addActionListener(this);
1028
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1029
- ellipsoidItem.addActionListener(this);
1030
- coneItem = menu.add(new MenuItem("Cone"));
1031
- coneItem.addActionListener(this);
1032
- torusItem = menu.add(new MenuItem("Torus"));
1033
- torusItem.addActionListener(this);
1034
- superItem = menu.add(new MenuItem("Superellipsoid"));
1035
- superItem.addActionListener(this);
1036
- particleItem = menu.add(new MenuItem("Particle system"));
1037
- particleItem.addActionListener(this);
1437
+// gridItem = menu.add(new MenuItem("Grid"));
1438
+// gridItem.addActionListener(this);
1439
+// rectoidItem = menu.add(new MenuItem("Box"));
1440
+// rectoidItem.addActionListener(this);
1441
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1442
+// ellipsoidItem.addActionListener(this);
1443
+// coneItem = menu.add(new MenuItem("Cone"));
1444
+// coneItem.addActionListener(this);
1445
+// torusItem = menu.add(new MenuItem("Torus"));
1446
+// torusItem.addActionListener(this);
1447
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1448
+// superItem.addActionListener(this);
1449
+
1450
+ cameraItem = menu.add(new MenuItem("Camera"));
1451
+ cameraItem.addActionListener(this);
1452
+
1453
+ if (!Globals.ADVANCED)
1454
+ {
1455
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1456
+ kleinItem.addActionListener(this);
1457
+ }
1458
+
1459
+// particleItem = menu.add(new MenuItem("Particle system"));
1460
+// particleItem.addActionListener(this);
1461
+ if (Globals.ADVANCED)
1462
+ {
10381463 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10391464 ragdollItem.addActionListener(this);
10401465 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10411466 ragdoll2Item.addActionListener(this);
1467
+ }
10421468 menu.add("-");
1043
- meshItem = menu.add(new MenuItem("Mesh"));
1469
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10441470 meshItem.addActionListener(this);
10451471 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10461472 // meshGroupItem.addActionListener(this);
1473
+ if (Globals.ADVANCED)
1474
+ {
10471475 springItem = menu.add(new MenuItem("Spring"));
10481476 springItem.addActionListener(this);
10491477 flagItem = menu.add(new MenuItem("Flag"));
10501478 flagItem.addActionListener(this);
1051
- bezierItem = menu.add(new MenuItem("Patch"));
1052
- bezierItem.addActionListener(this);
1053
- checkerItem = menu.add(new MenuItem("Checker"));
1054
- checkerItem.addActionListener(this);
10551479 blobItem = menu.add(new MenuItem("Blob"));
10561480 blobItem.addActionListener(this);
10571481 latheItem = menu.add(new MenuItem("Lathe"));
10581482 latheItem.addActionListener(this);
1059
- lightItem = menu.add(new MenuItem("Light"));
1060
- lightItem.addActionListener(this);
1483
+ }
1484
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1485
+ bezierItem.addActionListener(this);
1486
+// overlayItem = menu.add(new MenuItem("Overlay"));
1487
+// overlayItem.addActionListener(this);
1488
+// lightItem = menu.add(new MenuItem("Light"));
1489
+// lightItem.addActionListener(this);
10611490 menu.add("-");
10621491 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10631492 //superLoopItem.addActionListener(this);
1064
- loopItem = menu.add(new MenuItem("Loop"));
1065
- loopItem.addActionListener(this);
1493
+// loopItem = menu.add(new MenuItem("Loop"));
1494
+// loopItem.addActionListener(this);
10661495 doubleItem = menu.add(new MenuItem("Fork"));
10671496 doubleItem.addActionListener(this);
1497
+ if (Globals.ADVANCED)
1498
+ {
10681499 tripleItem = menu.add(new MenuItem("Trident"));
10691500 tripleItem.addActionListener(this);
1501
+ }
10701502 }
10711503
10721504 void buildToolsMenu(Menu menu)
10731505 {
10741506 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10751507 animationItem.addItemListener(this);
1076
- animationItem.setState(CameraPane.ANIMATION);
1508
+ animationItem.setState(Globals.ANIMATION);
1509
+
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
10771512
10781513 menu.add("-");
10791514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10801515 parseverticesItem.addActionListener(this);
10811516 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10821517 textureFieldItem.addActionListener(this);
1083
- alignItem = menu.add(new MenuItem("Align"));
1518
+ alignItem = menu.add(new MenuItem("Align Objects"));
10841519 alignItem.addActionListener(this);
1085
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1086
- mirrorItem.addActionListener(this);
10871520 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10881521 reduceMorphItem.addActionListener(this);
10891522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10901523 reduce34MorphItem.addActionListener(this);
1091
-
1092
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1093
- computeAOItem.addActionListener(this);
10941524 menu.add("-");
1095
-
10961525 menu.add(memoryItem = new MenuItem("Memory Usage"));
10971526 memoryItem.addActionListener(this);
1527
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1528
+ computeAOItem.addActionListener(this);
1529
+
1530
+ if (Globals.ADVANCED)
1531
+ {
1532
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1533
+ mirrorItem.addActionListener(this);
1534
+ menu.add("-");
10981535 menu.add(analyzeItem = new MenuItem("Analyze"));
10991536 analyzeItem.addActionListener(this);
1100
- menu.add(dumpItem = new MenuItem("Dump"));
1537
+ menu.add(dumpItem = new MenuItem("Print"));
11011538 dumpItem.addActionListener(this);
11021539 // menu.add(pathItem = new MenuItem("From-to path"));
11031540 // pathItem.addActionListener(this);
....@@ -1106,6 +1543,8 @@
11061543 resetParentItem.addActionListener(this);
11071544 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11081545 repairParentItem.addActionListener(this);
1546
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1547
+ repairShadowItem.addActionListener(this);
11091548 menu.add(invariantsItem = new MenuItem("Invariants"));
11101549 invariantsItem.addActionListener(this);
11111550 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1113,6 +1552,7 @@
11131552 menu.add("-");
11141553 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11151554 editScriptItem.addActionListener(this);
1555
+ }
11161556 }
11171557
11181558 void ScreenFit()
....@@ -1235,9 +1675,24 @@
12351675 shadow.material = new cMaterial(obj.material);
12361676 shadow.material.diffuse = 0.0001f;
12371677 shadow.material.specular = 0.0001f;
1678
+ //shadow.projectedVertices[1].x = 300;
12381679
12391680 makeSomething(shadow);
12401681 }
1682
+
1683
+ private void ClearUnpinned()
1684
+ {
1685
+ //for (Object3D obj : listUI)
1686
+ for (int i=listUI.size(); --i>=0;)
1687
+ {
1688
+ Object3D obj = listUI.elementAt(i);
1689
+ if (!obj.pinned)
1690
+ {
1691
+ obj.CloseUI();
1692
+ listUI.remove(i);
1693
+ }
1694
+ }
1695
+ }
12411696
12421697 /**
12431698 * applyExample
....@@ -1441,9 +1896,9 @@
14411896
14421897 void Overwrite(int mask)
14431898 {
1444
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1899
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14451900 {
1446
- Object3D content = GrafreeD.clipboard.get(0);
1901
+ Object3D content = Grafreed.clipboard.get(0);
14471902
14481903 if (content instanceof cGroup && ((cGroup)content).transientlink )
14491904 content = ((cGroup)content).get(0);
....@@ -1466,6 +1921,7 @@
14661921 //
14671922 public void actionPerformed(ActionEvent event) // , Object arg)
14681923 {
1924
+ Object source = event.getSource();
14691925 /*
14701926 if (event.getSource() == nameField)
14711927 {
....@@ -1477,11 +1933,11 @@
14771933 }
14781934 else
14791935 */
1480
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1936
+ if (source == lookAtItem || source == lookFromItem)
14811937 {
14821938 ScreenFit();
14831939 } else
1484
- if (event.getSource() == switchItem)
1940
+ if (source == switchViewItem)
14851941 {
14861942 cVector v1 = new cVector();
14871943 cVector v2 = new cVector();
....@@ -1490,11 +1946,11 @@
14901946 objEditor.cameraView.renderCamera.setAim(v2, v1);
14911947 objEditor.cameraView.repaint();
14921948 } else
1493
- if (event.getSource() == rectoidItem)
1949
+ if (source == rectoidItem || source == boxButton)
14941950 {
14951951 makeSomething(new Box());
14961952 } else
1497
- if (event.getSource() == particleItem)
1953
+ if (source == particleItem || source == particlesButton)
14981954 {
14991955 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15001956 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1515,9 +1971,9 @@
15151971 applyExample(particleGeom, "SMOKE");
15161972 makeSomething(particleGeom);
15171973 } else
1518
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1974
+ if (source == ragdollItem || source == ragdoll2Item)
15191975 {
1520
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1976
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15211977
15221978 ragdoll.toParent = LA.newMatrix();
15231979 ragdoll.fromParent = LA.newMatrix();
....@@ -1535,7 +1991,7 @@
15351991 } else
15361992 /*
15371993 */
1538
- if (event.getSource() == heightFieldItem)
1994
+ if (source == heightFieldItem)
15391995 {
15401996 Object3D obj = new Object3D();
15411997
....@@ -1573,27 +2029,31 @@
15732029
15742030 makeSomething(obj);
15752031 } else
1576
- if (event.getSource() == gridItem)
2032
+ if (source == gridItem || source == gridButton)
15772033 {
15782034 makeSomething(new Grid());
15792035 } else
1580
- if (event.getSource() == ellipsoidItem)
2036
+ if (source == ellipsoidItem || source == sphereButton)
15812037 {
15822038 makeSomething(new Sphere());
15832039 } else
1584
- if (event.getSource() == coneItem)
2040
+ if (source == coneItem || source == coneButton)
15852041 {
15862042 makeSomething(new Cone());
15872043 } else
1588
- if (event.getSource() == torusItem)
2044
+ if (source == torusItem || source == torusButton)
15892045 {
15902046 makeSomething(new Torus());
15912047 } else
1592
- if (event.getSource() == superItem)
2048
+ if (source == superItem || source == superButton)
15932049 {
15942050 makeSomething(new Superellipsoid());
15952051 } else
1596
- if (event.getSource() == blobItem)
2052
+ if (source == kleinItem || source == kleinButton)
2053
+ {
2054
+ makeSomething(new Klein());
2055
+ } else
2056
+ if (source == blobItem)
15972057 {
15982058 Blob blob = new Blob();
15992059 BlobComponent comp = new BlobComponent();
....@@ -1601,15 +2061,15 @@
16012061 //blob.retile();
16022062 makeSomething(blob);
16032063 } else
1604
- if (event.getSource() == latheItem)
2064
+ if (source == latheItem)
16052065 {
16062066 makeSomething(new Lathe());
16072067 } else
1608
- if (event.getSource() == bezierItem)
2068
+ if (source == bezierItem)
16092069 {
16102070 makeSomething(new BezierSurface());
16112071 } else
1612
- if (event.getSource() == checkerItem)
2072
+ if (source == overlayItem || source == overlayButton)
16132073 {
16142074 /*
16152075 Object3D obj = new BezierSurface(5,8);
....@@ -1624,7 +2084,7 @@
16242084 */
16252085 makeSomething(new Checker());
16262086 } else
1627
- if (event.getSource() == meshItem)
2087
+ if (source == meshItem)
16282088 {
16292089 Object3D itemtomake = new Object3D();
16302090 Object3D child;
....@@ -1645,35 +2105,35 @@
16452105 makeSomething(child);
16462106 }
16472107 } else
1648
- if (event.getSource() == springItem)
2108
+ if (source == springItem)
16492109 {
16502110 cSpring s = new cSpring();
16512111 s.setup();
16522112 makeSomething(s);
16532113 } else
1654
- if (event.getSource() == flagItem)
2114
+ if (source == flagItem)
16552115 {
16562116 cSpring s = new cFlag();
16572117 s.setup();
16582118 makeSomething(s);
16592119 } else
1660
- if (event.getSource() == lightItem)
2120
+ if (source == lightItem || source == lightButton)
16612121 {
16622122 makeSomething(new Light());
16632123 } else
1664
- if (event.getSource() == csgItem)
2124
+ if (source == csgItem)
16652125 {
16662126 group(new CSG());
16672127 } else
1668
- if (event.getSource() == templateItem)
2128
+ if (source == templateItem)
16692129 {
16702130 group(new cTemplate());
16712131 } else
1672
- if (event.getSource() == attributeItem)
2132
+ if (source == attributeItem)
16732133 {
16742134 makeSomething(new Attribute());
16752135 } else
1676
- if (event.getSource() == pointflowItem)
2136
+ if (source == pointflowItem)
16772137 {
16782138 makeSomething(new PointFlow());
16792139 } else
....@@ -1685,7 +2145,7 @@
16852145 } else
16862146 */
16872147
1688
- if (event.getSource() == superLoopItem)
2148
+ if (source == superLoopItem)
16892149 {
16902150 Composite g = new cGroup();
16912151 for (int i=0; i<15; i++)
....@@ -1707,30 +2167,30 @@
17072167
17082168 group(g);
17092169 } else
1710
- if (event.getSource() == loopItem)
2170
+ if (source == loopItem || source == loopButton)
17112171 {
17122172 Composite csg = new GroupLeaf();
17132173 csg.count = 5;
17142174 group(csg);
1715
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
17162176 csg.addChild(child);
17172177 child.addChild(csg);
17182178 } else
1719
- if (event.getSource() == doubleItem)
2179
+ if (source == doubleItem)
17202180 {
1721
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
17222182 csg.count = 5;
17232183 group(csg);
1724
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
17252185 csg.addChild(child);
17262186 child.addChild(csg);
1727
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
17282188 csg.addChild(child);
17292189 child.addChild(csg);
17302190 } else
1731
- if (event.getSource() == tripleItem)
2191
+ if (source == tripleItem)
17322192 {
1733
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
17342194 csg.count = 4;
17352195 group(csg);
17362196 Composite child = new cGroup();
....@@ -1743,73 +2203,98 @@
17432203 csg.addChild(child);
17442204 child.addChild(csg);
17452205 } else
1746
-
1747
- if (event.getSource() == importGFDItem)
2206
+ if (source == computeAOItem)
17482207 {
1749
- ImportGFD();
2208
+ Globals.drawMode = CameraPane.OCCLUSION;
2209
+ Globals.theRenderer.repaint();
17502210 } else
1751
- if (event.getSource() == importVRMLX3DItem)
1752
- {
1753
- ImportVRMLX3D();
1754
- } else
1755
- if (event.getSource() == import3DSItem)
1756
- {
1757
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1758
- } else
1759
- if (event.getSource() == importOBJItem)
1760
- {
1761
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1762
- } else
1763
- if (event.getSource() == computeAOItem)
1764
- {
1765
- CameraPane.drawMode = CameraPane.OCCLUSION;
1766
- CameraPane.theRenderer.repaint();
1767
- } else
1768
- if (event.getSource() == recompileItem)
2211
+ if (source == recompileItem)
17692212 {
17702213 Recompile();
17712214 refreshContents();
17722215 } else
1773
- if (event.getSource() == editScriptItem)
2216
+ if (source == editScriptItem)
17742217 {
17752218 OpenDialog();
17762219 refreshContents();
17772220 } else
1778
- if (event.getSource() == invariantsItem)
2221
+ if (source == invariantsItem)
17792222 {
17802223 System.out.println("Invariants:");
1781
- GrafreeD.theApplet3D.universe.invariants();
2224
+ Grafreed.grafreeD.universe.invariants();
17822225 } else
1783
- if (event.getSource() == memoryItem)
2226
+ if (source == memoryItem)
17842227 {
17852228 //System.out.println("Invariants:");
17862229 PrintMemory();
17872230 } else
1788
- if (event.getSource() == pathItem)
2231
+ if (source == pathItem)
17892232 {
17902233 PrintPath();
17912234 } else
1792
- if (event.getSource() == analyzeItem)
2235
+ if (source == analyzeItem)
17932236 {
17942237 AnalyzeObject();
17952238 } else
1796
- if (event.getSource() == dumpItem)
2239
+ if (source == dumpItem)
17972240 {
17982241 DumpObject();
17992242 } else
1800
- if (event.getSource() == screenfitButton)
2243
+ if (source == minButton)
18012244 {
1802
- //Reload(lastConverter, lastFilename, true);
2245
+ Minimize();
2246
+ } else
2247
+ if (source == maxButton)
2248
+ {
2249
+ Maximize();
2250
+ } else
2251
+ if (source == fullButton)
2252
+ {
2253
+ ToggleFullScreen();
2254
+ } else
2255
+ if (source == undoButton)
2256
+ {
2257
+ // Go to previous version
2258
+ //if (!Undo())
2259
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2260
+ Undo();
2261
+ } else
2262
+ if (source == restoreButton)
2263
+ {
2264
+ // Restore current version
2265
+ Restore();
2266
+ } else
2267
+ if (source == replaceButton)
2268
+ {
2269
+ // Overwrite current version
2270
+ Replace();
2271
+ } else
2272
+ if (source == redoButton)
2273
+ {
2274
+ // Go to next version
2275
+ Redo();
2276
+ } else
2277
+ if (source == saveButton)
2278
+ {
2279
+ // Save a new version
2280
+ if (!Save(true))
2281
+ java.awt.Toolkit.getDefaultToolkit().beep();
2282
+ } else
2283
+ if (source == oneStepButton)
2284
+ {
2285
+ Globals.ONESTEP = true;
2286
+ cameraView.repaint();
2287
+ } else
2288
+ if (source == screenfitButton)
2289
+ {
18032290 ScreenFit();
18042291 } else
1805
- if (event.getSource() == screenfitpointButton)
2292
+ if (source == screenfitpointButton)
18062293 {
1807
- //Reload(lastConverter, lastFilename, true);
18082294 ScreenFitPoint();
18092295 } else
1810
- if (event.getSource() == snapobjectButton)
2296
+ if (source == snapobjectButton)
18112297 {
1812
- //Reload(lastConverter, lastFilename, true);
18132298 SnapObject();
18142299 } else
18152300 // if (event.getSource() == recompileButton)
....@@ -1818,13 +2303,13 @@
18182303 // Recompile();
18192304 // refreshContents();
18202305 // } else
1821
- if (event.getSource() == gcButton)
2306
+ if (source == gcButton)
18222307 {
18232308 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18242309 System.gc();
18252310 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262311 } else
1827
- if (event.getSource() == editLeafItem)
2312
+ if (source == editLeafItem)
18282313 {
18292314 Object3D obj;
18302315 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1838,62 +2323,74 @@
18382323 }
18392324 refreshContents(true);
18402325 } else
1841
- if (event.getSource() == openWindowItem)
2326
+ if (source == openWindowItem)
18422327 {
18432328 EditSelection(true);
18442329 } else
1845
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2330
+ if (source == cutItem || source == clearButton)
18462331 {
18472332 loadClipboard(true);
18482333 } else
1849
- if (event.getSource() == duplicateItem)
2334
+ if (source == undoItem)
18502335 {
1851
- Object3D keep = GrafreeD.clipboard;
2336
+ Undo();
2337
+ } else
2338
+ if (source == redoItem)
2339
+ {
2340
+ Redo();
2341
+ } else
2342
+ if (source == duplicateItem)
2343
+ {
2344
+ Object3D keep = Grafreed.clipboard;
18522345 loadClipboard(false);
18532346 paste(false);
1854
- GrafreeD.clipboard = keep;
2347
+ Grafreed.clipboard = keep;
18552348 } else
1856
- if (event.getSource() == cloneItem)
2349
+ if (source == cloneItem)
18572350 {
18582351 CloneSelection(false);
18592352 } else
1860
- if (event.getSource() == cloneSupportItem)
2353
+ if (source == cloneSupportItem)
18612354 {
18622355 CloneSelection(true);
18632356 } else
1864
- if (event.getSource() == copyItem)
2357
+ if (source == copyItem)
18652358 {
18662359 loadClipboard(false);
18672360 } else
1868
- if (event.getSource() == pasteItem)
2361
+ if (source == pasteItem)
18692362 {
18702363 paste(false);
18712364 } else
1872
- if (event.getSource() == pasteLinkItem)
2365
+ if (source == pasteIntoItem)
18732366 {
1874
- pasteInto(false);
2367
+ pasteInto(true, false);
18752368 } else
1876
- if (event.getSource() == pasteCloneItem)
2369
+ if (source == pasteLinkItem)
18772370 {
1878
- pasteInto(true);
2371
+ pasteInto(false, false);
18792372 } else
1880
- if (event.getSource() == pasteExpandItem)
2373
+ if (source == pasteCloneItem)
2374
+ {
2375
+ pasteInto(true, true);
2376
+ } else
2377
+ if (source == pasteExpandItem)
18812378 {
18822379 paste(true);
18832380 } else
1884
- if (event.getSource() == synchronizeItem)
2381
+ if (source == synchronizeItem)
18852382 {
18862383 Overwrite(Object3D.TRANSFORM);
18872384 } else
1888
- if (event.getSource() == overwriteNameItem)
2385
+ if (source == overwriteNameItem)
18892386 {
18902387 Overwrite(Object3D.NAME);
18912388 } else
1892
- if (event.getSource() == overwriteUVItem)
2389
+ if (source == overwriteUVItem)
18932390 {
18942391 Overwrite(Object3D.UV);
18952392 } else
1896
- if (event.getSource() == overwriteMatItem)
2393
+ if (source == overwriteMatItem)
18972394 {
18982395 /* july 2015
18992396 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1913,7 +2410,7 @@
19132410
19142411 Overwrite(dropAttributes);
19152412 }
1916
- if (event.getSource() == overwriteGeoItem)
2413
+ if (source == overwriteGeoItem)
19172414 {
19182415 Overwrite(Object3D.GEOMETRY);
19192416 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1930,7 +2427,7 @@
19302427 // refreshContents();
19312428 // }
19322429 } else
1933
- if (event.getSource() == generateMeshItem)
2430
+ if (source == generateMeshItem)
19342431 {
19352432 //if (group.selection.size() == 1)
19362433 // for (int i=0; i<group.selection.size(); i++)
....@@ -1941,7 +2438,7 @@
19412438 ResetModel();
19422439 refreshContents();
19432440 } else
1944
- if (event.getSource() == extractGeometriesItem)
2441
+ if (source == extractGeometriesItem)
19452442 {
19462443 boolean one = false;
19472444
....@@ -1968,7 +2465,7 @@
19682465 ResetModel();
19692466 refreshContents();
19702467 } else
1971
- if (event.getSource() == cloneGeometriesItem)
2468
+ if (source == cloneGeometriesItem)
19722469 {
19732470 boolean one = false;
19742471
....@@ -1994,32 +2491,37 @@
19942491 ResetModel();
19952492 refreshContents();
19962493 } else
1997
- if (event.getSource() == shareGeometriesItem)
2494
+ if (source == shareGeometriesItem)
19982495 {
19992496 boolean one = false;
20002497
20012498 if (group.selection.size() == 1)
20022499 one = true;
20032500
2501
+ Object3D merge = null;
2502
+
20042503 Object3D content = new cGroup();
20052504
20062505 for (int i=0; i<group.selection.size(); i++)
20072506 {
2008
- Object3D sel = new Merge(group.selection.get(i));
2507
+ merge = new Merge(group.selection.get(i));
20092508
20102509 if (one)
2011
- makeSomething(sel, false);
2510
+ makeSomething(merge, false);
20122511 else
2013
- content.addChild(sel);
2512
+ content.addChild(merge);
20142513 }
20152514
20162515 if (!one)
2017
- makeSomething(content, false);
2018
-
2019
- ResetModel();
2020
- refreshContents();
2516
+ makeSomething(content, true);
2517
+ else
2518
+ {
2519
+ ResetModel();
2520
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2521
+ refreshContents();
2522
+ }
20212523 } else
2022
- if (event.getSource() == mergeGeometriesItem)
2524
+ if (source == mergeGeometriesItem)
20232525 {
20242526 boolean one = false;
20252527
....@@ -2049,7 +2551,7 @@
20492551 ResetModel();
20502552 refreshContents();
20512553 } else
2052
- if (event.getSource() == linkverticesItem)
2554
+ if (source == linkverticesItem)
20532555 {
20542556 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20552557 // {
....@@ -2062,39 +2564,48 @@
20622564 // group.selection.get(0).setMasterThis(content); // should be identity
20632565 // refreshContents();
20642566 // }
2065
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2567
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20662568 {
2067
- Object3D content = GrafreeD.clipboard.get(0);
2569
+ Object3D content = Grafreed.clipboard.get(0);
20682570
20692571 if (content instanceof cGroup && ((cGroup)content).transientlink )
20702572 content = ((cGroup)content).get(0);
20712573
2072
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2574
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20732575 for (int i=0; i<group.selection.size(); i++)
20742576 {
2075
- boolean random = CameraPane.RANDOM;
2076
- CameraPane.RANDOM = false; // parse all random nodes
2577
+ boolean random = CameraPane.SWITCH;
2578
+ CameraPane.SWITCH = false; // parse all random nodes
20772579 group.selection.get(i).linkVerticesThis(content);
20782580 // group.selection.get(i).setMasterThis(content); // should be identity
2079
- CameraPane.RANDOM = random;
2581
+ CameraPane.SWITCH = random;
20802582 }
2081
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2583
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20822584 refreshContents();
20832585 }
20842586 } else
2085
- if (event.getSource() == resetsupportItem)
2587
+ if (source == resetsupportItem)
20862588 {
20872589 for (int i=0; i<group.selection.size(); i++)
20882590 {
2089
- boolean random = CameraPane.RANDOM;
2090
- CameraPane.RANDOM = false; // parse all random nodes
2591
+ boolean random = CameraPane.SWITCH;
2592
+ CameraPane.SWITCH = false; // parse all random nodes
20912593 group.selection.get(i).linkVerticesThis(null);
2092
- CameraPane.RANDOM = random;
2594
+ CameraPane.SWITCH = random;
20932595 }
20942596
20952597 refreshContents();
20962598 } else
2097
- if (event.getSource() == resetreferencesItem)
2599
+ if (source == relinkverticesItem)
2600
+ {
2601
+ boolean random = CameraPane.SWITCH;
2602
+ CameraPane.SWITCH = false; // parse all random nodes
2603
+ group.selection.RelinkToSupport();
2604
+ CameraPane.SWITCH = random;
2605
+
2606
+ refreshContents();
2607
+ } else
2608
+ if (source == resetreferencesItem)
20982609 {
20992610 for (int i=0; i<group.selection.size(); i++)
21002611 {
....@@ -2103,11 +2614,11 @@
21032614
21042615 refreshContents();
21052616 } else
2106
- if (event.getSource() == setMasterItem)
2617
+ if (source == setMasterItem)
21072618 {
2108
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2619
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21092620 {
2110
- Object3D content = GrafreeD.clipboard.get(0);
2621
+ Object3D content = Grafreed.clipboard.get(0);
21112622
21122623 if (content instanceof cGroup && ((cGroup)content).transientlink )
21132624 content = ((cGroup)content).get(0);
....@@ -2116,13 +2627,13 @@
21162627 refreshContents();
21172628 }
21182629 } else
2119
- if (event.getSource() == poseMeshItem)
2630
+ if (source == poseMeshItem)
21202631 {
21212632 if (group.selection.size() == 1)
21222633 {
2123
- if (GrafreeD.clipboard.size() == 1)
2634
+ if (Grafreed.clipboard.size() == 1)
21242635 {
2125
- Object3D content = GrafreeD.clipboard.get(0);
2636
+ Object3D content = Grafreed.clipboard.get(0);
21262637
21272638 if (content instanceof cGroup && ((cGroup)content).transientlink )
21282639 content = ((cGroup)content).get(0);
....@@ -2135,19 +2646,19 @@
21352646 }
21362647
21372648 } else
2138
- if (event.getSource() == revertMeshItem)
2649
+ if (source == revertMeshItem)
21392650 {
21402651 RevertMeshes();
21412652 } else
2142
- if (event.getSource() == resetMeshItem)
2653
+ if (source == resetAllItem)
21432654 {
21442655 ResetAll();
21452656 } else
2146
- if (event.getSource() == stepAllItem)
2657
+ if (source == stepAllItem)
21472658 {
21482659 StepAll();
21492660 } else
2150
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2661
+ if (source == clearItem) // || event.getSource() == clearButton)
21512662 {
21522663 //int indices[] = jList.getSelectedIndices();
21532664 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2155,42 +2666,46 @@
21552666
21562667 ClearSelection(false);
21572668 } else
2158
- if (event.getSource() == clearAllItem)
2669
+ if (source == clearAllItem)
21592670 {
21602671 ClearSelection(true);
21612672 } else
2162
- if (event.getSource() == grabItem)
2673
+ if (source == grabItem || source == groupButton)
21632674 {
2164
- group(new cGroup(), true);
2675
+ group(new cGroup(), false); // true);
21652676 } else
2166
- if (event.getSource() == frontItem)
2677
+ if (source == hideItem)
2678
+ {
2679
+ group(new HiddenObject());
2680
+ } else
2681
+ if (source == frontItem)
21672682 {
21682683 front();
21692684 } else
2170
- if (event.getSource() == backItem)
2685
+ if (source == backItem)
21712686 {
21722687 back();
21732688 } else
2174
- if (event.getSource() == cameraItem)
2689
+ if (source == cameraItem)
21752690 {
21762691 makeSomething(new Camera());
21772692 } else
2178
- if (event.getSource() == compositeItem)
2693
+ if (source == compositeItem || source == compositeButton)
21792694 {
21802695 group(new Composite());
21812696 } else
2182
- if (event.getSource() == randomItem)
2697
+ if (source == switchItem || source == switchButton)
21832698 {
21842699 RandomNode random = new RandomNode();
21852700 group(random);
21862701 if (random.size() > 0)
2187
- random.name = random.get(0).name + "Rnd";
2702
+ random.name = random.get(0).name + "Switch";
21882703 } else
2189
- if (event.getSource() == physicsItem)
2704
+ if (source == physicsItem)
21902705 {
21912706 group(new PhysicsNode());
21922707 } else
2193
- if (event.getSource() == frameselectorItem)
2708
+ if (source == frameselectorItem)
21942709 {
21952710 for (int i=0; i<group.selection.size(); i++)
21962711 {
....@@ -2202,7 +2717,7 @@
22022717 ResetModel();
22032718 refreshContents();
22042719 } else
2205
- if (event.getSource() == switchGeoItem)
2720
+ if (source == switchGeoItem)
22062721 {
22072722 for (int i=0; i<group.selection.size(); i++)
22082723 {
....@@ -2214,7 +2729,7 @@
22142729 ResetModel();
22152730 refreshContents();
22162731 } else
2217
- if (event.getSource() == switchTransfoItem)
2732
+ if (source == switchTransfoItem)
22182733 {
22192734 for (int i=0; i<group.selection.size(); i++)
22202735 {
....@@ -2226,7 +2741,7 @@
22262741 ResetModel();
22272742 refreshContents();
22282743 } else
2229
- if (event.getSource() == morphItem)
2744
+ if (source == morphItem)
22302745 {
22312746 for (int i=0; i<group.selection.size(); i++)
22322747 {
....@@ -2238,7 +2753,7 @@
22382753 ResetModel();
22392754 refreshContents();
22402755 } else
2241
- if (event.getSource() == scriptNodeItem)
2756
+ if (source == scriptNodeItem)
22422757 {
22432758 boolean atleastone = false;
22442759
....@@ -2277,195 +2792,252 @@
22772792 }
22782793 }
22792794 } else
2280
- if (event.getSource() == linkerItem)
2795
+ if (source == linkerItem)
22812796 {
22822797 group(new cLinker());
22832798 } else
2284
- if (event.getSource() == textureItem)
2799
+ if (source == textureItem || source == textureButton)
22852800 {
22862801 group(new TextureNode());
22872802 } else
2288
- if (event.getSource() == shadowXItem)
2803
+ if (source == billboardItem)
2804
+ {
2805
+ group(new BillboardNode());
2806
+ } else
2807
+ if (source == shadowXItem)
22892808 {
22902809 CastShadow(0);
22912810 } else
2292
- if (event.getSource() == shadowYItem)
2811
+ if (source == shadowYItem)
22932812 {
22942813 CastShadow(1);
22952814 } else
2296
- if (event.getSource() == shadowZItem)
2815
+ if (source == shadowZItem)
22972816 {
22982817 CastShadow(2);
22992818 } else
2300
- if (event.getSource() == ungroupItem)
2819
+ if (source == ungroupItem || source == ungroupButton)
23012820 {
2302
- ungroup();
2821
+ boolean hasRoot = false;
2822
+
2823
+ for (int i=0; i<group.selection.size(); i++)
2824
+ {
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
2830
+ }
2831
+
2832
+ if (!hasRoot)
2833
+ {
2834
+ for (int i=0; i<group.selection.size(); i++)
2835
+ {
2836
+ Ungroup(group.selection.get(i));
2837
+ }
2838
+
2839
+ ClearSelection(false);
2840
+
2841
+ refreshContents();
2842
+ }
23032843 } else
2304
- if (event.getSource() == genUVItem)
2844
+ if (source == genUVItem)
23052845 {
23062846 GenUV();
23072847 } else
2308
- if (event.getSource() == genNormalsCADItem)
2848
+ if (source == genNormalsCADItem)
23092849 {
23102850 GenNormals(true);
23112851 } else
2312
- if (event.getSource() == genNormalsORGANItem)
2852
+ if (source == genNormalsMESHItem)
2853
+ {
2854
+ GenNormalsMESH();
2855
+ } else
2856
+ if (source == genNormalsORGANItem)
23132857 {
23142858 GenNormals(false);
23152859 } else
2316
- if (event.getSource() == stripifyItem)
2860
+ if (source == genNormalsMINEItem)
2861
+ {
2862
+ GenNormalsMINE();
2863
+ } else
2864
+ if (source == stripifyItem)
23172865 {
23182866 Stripify();
23192867 } else
2320
- if (event.getSource() == unstripifyItem)
2868
+ if (source == unstripifyItem)
23212869 {
23222870 Unstripify();
23232871 } else
2324
- if (event.getSource() == trimItem)
2872
+ if (source == trimItem)
23252873 {
23262874 Trim();
23272875 } else
2328
- if (event.getSource() == untrimItem)
2876
+ if (source == untrimItem)
23292877 {
23302878 Untrim();
23312879 } else
2332
- if (event.getSource() == clearColorsItem)
2880
+ if (source == clearColorsItem)
23332881 {
23342882 ClearColors();
23352883 } else
2336
- if (event.getSource() == clearMaterialsItem)
2884
+ if (source == clearMaterialsItem)
23372885 {
23382886 ClearMaterials();
23392887 } else
2340
- if (event.getSource() == liveleavesItem)
2888
+ if (source == liveleavesItem)
23412889 {
23422890 LiveLeaves(true);
23432891 } else
2344
- if (event.getSource() == unliveleavesItem)
2892
+ if (source == unliveleavesItem)
23452893 {
23462894 LiveLeaves(false);
23472895 } else
2348
- if (event.getSource() == supportleavesItem)
2896
+ if (source == supportleavesItem)
23492897 {
23502898 SupportLeaves(true);
23512899 } else
2352
- if (event.getSource() == unsupportleavesItem)
2900
+ if (source == unsupportleavesItem)
23532901 {
23542902 SupportLeaves(false);
23552903 } else
2356
- if (event.getSource() == hideleavesItem)
2904
+ if (source == hideleavesItem)
23572905 {
23582906 HideLeaves(true);
23592907 } else
2360
- if (event.getSource() == showleavesItem)
2908
+ if (source == showleavesItem)
23612909 {
23622910 HideLeaves(false);
23632911 } else
2364
- if (event.getSource() == markleavesItem)
2912
+ if (source == markleavesItem)
23652913 {
23662914 MarkLeaves(true);
23672915 } else
2368
- if (event.getSource() == unmarkleavesItem)
2916
+ if (source == unmarkleavesItem)
23692917 {
23702918 MarkLeaves(false);
23712919 } else
2372
- if (event.getSource() == flipVItem)
2920
+ if (source == rewindleavesItem)
2921
+ {
2922
+ RewindLeaves(true);
2923
+ } else
2924
+ if (source == unrewindleavesItem)
2925
+ {
2926
+ RewindLeaves(false);
2927
+ } else
2928
+ if (source == randomleavesItem)
2929
+ {
2930
+ RandomLeaves(true);
2931
+ } else
2932
+ if (source == unrandomleavesItem)
2933
+ {
2934
+ RandomLeaves(false);
2935
+ } else
2936
+ if (source == flipVItem)
23732937 {
23742938 FlipV(true);
23752939 } else
2376
- if (event.getSource() == unflipVItem)
2940
+ if (source == unflipVItem)
23772941 {
23782942 FlipV(false);
23792943 } else
2380
- if (event.getSource() == lowTexturesItem)
2944
+ if (source == lowTexturesItem)
23812945 {
23822946 SetTexRes(0);
23832947 } else
2384
- if (event.getSource() == normalTexturesItem)
2948
+ if (source == normalTexturesItem)
23852949 {
23862950 SetTexRes(1);
23872951 } else
2388
- if (event.getSource() == highTexturesItem)
2952
+ if (source == highTexturesItem)
23892953 {
23902954 SetTexRes(2);
23912955 } else
2392
- if (event.getSource() == veryhighTexturesItem)
2956
+ if (source == veryhighTexturesItem)
23932957 {
23942958 SetTexRes(3);
23952959 } else
2396
- if (event.getSource() == maxTexturesItem)
2960
+ if (source == maxTexturesItem)
23972961 {
23982962 SetTexRes(4);
23992963 } else
2400
- if (event.getSource() == panoTexturesItem)
2964
+ if (source == panoTexturesItem)
24012965 {
24022966 SetTexRes(5);
24032967 } else
2404
- if (event.getSource() == reverseNormalsItem)
2968
+ if (source == reverseNormalsItem)
24052969 {
24062970 ReverseNormals();
24072971 } else
2408
- if (event.getSource() == parseverticesItem)
2972
+ if (source == parseverticesItem)
24092973 {
24102974 ParseVertices();
24112975 } else
2412
- if (event.getSource() == textureFieldItem)
2976
+ if (source == textureFieldItem)
24132977 {
24142978 TextureVertices();
24152979 } else
2416
- if (event.getSource() == alignItem)
2980
+ if (source == alignItem)
24172981 {
24182982 Align();
24192983 } else
2420
- if (event.getSource() == mirrorItem)
2984
+ if (source == mirrorItem)
24212985 {
24222986 MirrorPoses();
24232987 } else
2424
- if (event.getSource() == reduceMorphItem)
2988
+ if (source == reduceMorphItem)
24252989 {
24262990 MeshReduction(false);
24272991 } else
2428
- if (event.getSource() == reduce34MorphItem)
2992
+ if (source == reduce34MorphItem)
24292993 {
24302994 MeshReduction(true);
24312995 } else
2432
- if (event.getSource() == reverseTrianglesItem)
2996
+ if (source == reverseTrianglesItem)
24332997 {
24342998 ReverseTriangles();
24352999 } else
2436
- if (event.getSource() == reduceMeshItem)
3000
+ if (source == reduceMeshItem)
24373001 {
24383002 ReduceMesh(false);
24393003 } else
2440
- if (event.getSource() == reduce34MeshItem)
3004
+ if (source == reduce34MeshItem)
24413005 {
24423006 ReduceMesh(true);
24433007 } else
2444
- if (event.getSource() == increaseMeshItem)
3008
+ if (source == increaseMeshItem)
24453009 {
24463010 IncreaseMesh();
24473011 } else
2448
- if (event.getSource() == clipMeshItem)
3012
+ if (source == clipMeshItem)
24493013 {
24503014 ClipMesh();
24513015 } else
2452
- if (event.getSource() == smoothMeshItem)
3016
+ if (source == smoothMeshItem)
24533017 {
24543018 SmoothMesh();
24553019 } else
2456
- if (event.getSource() == transformgeometryItem)
3020
+ if (source == transformGeometryItem)
24573021 {
24583022 TransformGeometry();
24593023 } else
2460
- if (event.getSource() == resetTransformItem)
3024
+ if (source == transformChildrenItem)
3025
+ {
3026
+ TransformChildren();
3027
+ } else
3028
+ if (source == resetTransformItem)
24613029 {
24623030 ResetTransform();
24633031 } else
2464
- if (event.getSource() == resetCentroidItem)
3032
+ if (source == resetCentroidItem)
24653033 {
2466
- ResetCentroid();
3034
+ ResetCentroid(true);
24673035 } else
2468
- if (event.getSource() == resetParentItem)
3036
+ if (source == resetCentroidXZItem)
3037
+ {
3038
+ ResetCentroid(false);
3039
+ } else
3040
+ if (source == resetParentItem)
24693041 {
24703042 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24713043 {
....@@ -2475,7 +3047,7 @@
24753047
24763048 refreshContents();
24773049 } else
2478
- if (event.getSource() == repairParentItem)
3050
+ if (source == repairParentItem)
24793051 {
24803052 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24813053 {
....@@ -2489,7 +3061,21 @@
24893061
24903062 refreshContents();
24913063 } else
2492
- if (event.getSource() == sortbysizeItem)
3064
+ if (source == repairShadowItem)
3065
+ {
3066
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3067
+ {
3068
+ Object3D obj = (Object3D)e.nextElement();
3069
+ obj.RepairShadow();
3070
+// for (int i=0; i<obj.size(); i++)
3071
+// {
3072
+// obj.get(i).parent = obj;
3073
+// }
3074
+ }
3075
+
3076
+ refreshContents();
3077
+ } else
3078
+ if (source == sortbysizeItem)
24933079 {
24943080 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24953081 {
....@@ -2501,7 +3087,7 @@
25013087 ResetModel();
25023088 refreshContents();
25033089 } else
2504
- if (event.getSource() == sortbynameItem)
3090
+ if (source == sortbynameItem)
25053091 {
25063092 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25073093 {
....@@ -2513,7 +3099,7 @@
25133099 ResetModel();
25143100 refreshContents();
25153101 } else
2516
- if (event.getSource() == attachPigmentItem)
3102
+ if (source == attachPigmentItem)
25173103 {
25183104 String texture = GetFile("Attach pigment");
25193105 Object3D obj;
....@@ -2525,7 +3111,7 @@
25253111
25263112 refreshContents();
25273113 } else
2528
- if (event.getSource() == detachPigmentItem)
3114
+ if (source == detachPigmentItem)
25293115 {
25303116 Object3D obj;
25313117 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2536,7 +3122,7 @@
25363122
25373123 refreshContents();
25383124 } else
2539
- if (event.getSource() == attachBumpItem)
3125
+ if (source == attachBumpItem)
25403126 {
25413127 String texture = GetFile("Attach bump");
25423128 Object3D obj;
....@@ -2548,7 +3134,7 @@
25483134
25493135 refreshContents();
25503136 } else
2551
- if (event.getSource() == detachBumpItem)
3137
+ if (source == detachBumpItem)
25523138 {
25533139 Object3D obj;
25543140 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2559,7 +3145,7 @@
25593145
25603146 refreshContents();
25613147 } else
2562
- if (event.getSource() == pigmentBumpItem)
3148
+ if (source == pigmentBumpItem)
25633149 {
25643150 Object3D obj;
25653151 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2570,158 +3156,237 @@
25703156
25713157 refreshContents();
25723158 } else
2573
- if (event.getSource() == flashSelectionButton)
3159
+ if (source == flashSelectionButton)
25743160 {
25753161 CameraPane.flash = true;
25763162 refreshContents();
25773163 } else
2578
- if (event.getSource() == oneButton)
3164
+ if (source == oneButton)
25793165 {
25803166 } else
2581
- if (event.getSource() == twoButton)
3167
+ if (source == twoButton)
25823168 {
25833169 radio.layout = twoButton;
3170
+
3171
+ if (CameraPane.FULLSCREEN)
3172
+ fullscreenLayout = radio.layout;
3173
+
25843174 // bug
25853175 //gridPanel.setDividerLocation(1.0);
25863176 //bigPanel.setDividerLocation(0.0);
2587
- bigThree.remove(jtp);
2588
- bigThree.remove(cameraPanel);
2589
- bigThree.remove(XYZPanel);
2590
- aWindowConstraints.gridx = 0;
2591
- aWindowConstraints.gridy = 0;
2592
- aWindowConstraints.gridwidth = 1;
2593
- // aConstraints.gridheight = 3;
2594
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2595
- aWindowConstraints.weightx = 0;
2596
- aWindowConstraints.weighty = 1;
2597
- //bigThree.add(jtp, aWindowConstraints);
2598
- aWindowConstraints.weightx = 1;
2599
- aWindowConstraints.gridwidth = 3;
2600
- // aConstraints.gridheight = 3;
2601
- aWindowConstraints.gridx = 1;
2602
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2603
- bigThree.add(cameraPanel, aWindowConstraints);
2604
- aWindowConstraints.weightx = 0;
2605
- aWindowConstraints.gridx = 4;
2606
- aWindowConstraints.gridwidth = 1;
2607
- // aConstraints.gridheight = 3;
2608
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2609
- //bigThree.add(XYZPanel, aWindowConstraints);
2610
- bigThree.revalidate();
3177
+// bigThree.remove(scenePanel);
3178
+// bigThree.remove(centralPanel);
3179
+// bigThree.remove(XYZPanel);
3180
+// aWindowConstraints.gridx = 0;
3181
+// aWindowConstraints.gridy = 0;
3182
+// aWindowConstraints.gridwidth = 1;
3183
+// // aConstraints.gridheight = 3;
3184
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3185
+// aWindowConstraints.weightx = 0;
3186
+// aWindowConstraints.weighty = 1;
3187
+// //bigThree.add(jtp, aWindowConstraints);
3188
+// aWindowConstraints.weightx = 1;
3189
+// aWindowConstraints.gridwidth = 3;
3190
+// // aConstraints.gridheight = 3;
3191
+// aWindowConstraints.gridx = 1;
3192
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3193
+// bigThree.add(centralPanel, aWindowConstraints);
3194
+// aWindowConstraints.weightx = 0;
3195
+// aWindowConstraints.gridx = 4;
3196
+// aWindowConstraints.gridwidth = 1;
3197
+// // aConstraints.gridheight = 3;
3198
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3199
+// //bigThree.add(XYZPanel, aWindowConstraints);
3200
+// scenePanel.setVisible(false);
3201
+// centralPanel.setVisible(true);
3202
+// XYZPanel.setVisible(false);
3203
+ bigThree.ClearUI();
3204
+ bigThree.add(centralPanel);
3205
+ bigThree.FlushUI();
3206
+
3207
+ cameraView.requestFocusInWindow();
3208
+
3209
+// refreshContents(true);
3210
+//
3211
+// try
3212
+// {
3213
+// java.awt.Robot bot = new java.awt.Robot();
3214
+// int mask = InputEvent.BUTTON1_MASK;
3215
+// bot.mouseMove(100, 100);
3216
+// bot.mousePress(mask);
3217
+// bot.mouseRelease(mask);
3218
+// }
3219
+// catch (Exception e)
3220
+// {
3221
+//
3222
+// }
3223
+
26113224 } else
2612
- if (event.getSource() == threeButton)
3225
+ if (source == threeButton)
26133226 {
26143227 radio.layout = threeButton;
2615
- bigThree.remove(jtp);
2616
- bigThree.remove(cameraPanel);
2617
- bigThree.remove(XYZPanel);
2618
- aWindowConstraints.gridx = 0;
2619
- aWindowConstraints.gridy = 0;
2620
- aWindowConstraints.gridwidth = 1;
2621
- // aConstraints.gridheight = 3;
2622
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2623
- aWindowConstraints.weightx = 0;
2624
- aWindowConstraints.weighty = 1;
2625
- //bigThree.add(jtp, aWindowConstraints);
2626
- aWindowConstraints.weightx = 1;
2627
- aWindowConstraints.gridwidth = 3;
2628
- // aConstraints.gridheight = 3;
2629
- aWindowConstraints.gridx = 1;
2630
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2631
- bigThree.add(cameraPanel, aWindowConstraints);
2632
- aWindowConstraints.weightx = 0;
2633
- aWindowConstraints.gridx = 4;
2634
- aWindowConstraints.gridwidth = 1;
2635
- // aConstraints.gridheight = 3;
2636
- aConstraints.fill = GridBagConstraints.VERTICAL;
2637
- bigThree.add(XYZPanel, aWindowConstraints);
2638
- bigThree.revalidate();
3228
+
3229
+ if (CameraPane.FULLSCREEN)
3230
+ fullscreenLayout = radio.layout;
3231
+
3232
+// bigThree.remove(scenePanel);
3233
+// bigThree.remove(centralPanel);
3234
+// bigThree.remove(XYZPanel);
3235
+// aWindowConstraints.gridx = 0;
3236
+// aWindowConstraints.gridy = 0;
3237
+// aWindowConstraints.gridwidth = 1;
3238
+// // aConstraints.gridheight = 3;
3239
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3240
+// aWindowConstraints.weightx = 0;
3241
+// aWindowConstraints.weighty = 1;
3242
+// //bigThree.add(jtp, aWindowConstraints);
3243
+// aWindowConstraints.weightx = 1;
3244
+// aWindowConstraints.gridwidth = 3;
3245
+// // aConstraints.gridheight = 3;
3246
+// aWindowConstraints.gridx = 1;
3247
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3248
+// bigThree.add(centralPanel, aWindowConstraints);
3249
+// aWindowConstraints.weightx = 0;
3250
+// aWindowConstraints.gridx = 4;
3251
+// aWindowConstraints.gridwidth = 1;
3252
+// // aConstraints.gridheight = 3;
3253
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3254
+// bigThree.add(XYZPanel, aWindowConstraints);
3255
+// bigThree.validate();
3256
+// scenePanel.setVisible(false);
3257
+// centralPanel.setVisible(true);
3258
+// XYZPanel.setVisible(true);
3259
+ bigThree.ClearUI();
3260
+ bigThree.add(centralPanel);
3261
+ bigThree.add(XYZPanel);
3262
+ bigThree.FlushUI();
3263
+
3264
+ cameraView.requestFocusInWindow();
26393265 } else
2640
- if (event.getSource() == fourButton)
3266
+ if (source == fourButton)
26413267 {
26423268 radio.layout = fourButton;
2643
- bigThree.remove(jtp);
2644
- bigThree.remove(cameraPanel);
2645
- bigThree.remove(XYZPanel);
2646
- aWindowConstraints.gridx = 0;
2647
- aWindowConstraints.gridy = 0;
2648
- aWindowConstraints.gridwidth = 1;
2649
- // aWindowConstraints.gridheight = 3;
2650
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2651
- aWindowConstraints.weightx = 1;
2652
- aWindowConstraints.weighty = 1;
2653
- bigThree.add(jtp, aWindowConstraints);
2654
- aWindowConstraints.weightx = 1;
2655
- aWindowConstraints.gridwidth = 3;
2656
- // aConstraints.gridheight = 3;
2657
- aWindowConstraints.gridx = 1;
2658
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2659
- //bigThree.add(cameraPanel, aWindowConstraints);
2660
- aWindowConstraints.weightx = 0;
2661
- aWindowConstraints.gridx = 4;
2662
- aWindowConstraints.gridwidth = 1;
2663
- // aWindowConstraints.gridheight = 3;
2664
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2665
- //bigThree.add(XYZPanel, aWindowConstraints);
2666
- bigThree.revalidate();
3269
+
3270
+ if (CameraPane.FULLSCREEN)
3271
+ fullscreenLayout = radio.layout;
3272
+
3273
+// bigThree.remove(scenePanel);
3274
+// bigThree.remove(centralPanel);
3275
+// bigThree.remove(XYZPanel);
3276
+// aWindowConstraints.gridx = 0;
3277
+// aWindowConstraints.gridy = 0;
3278
+// aWindowConstraints.gridwidth = 1;
3279
+// // aWindowConstraints.gridheight = 3;
3280
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3281
+// aWindowConstraints.weightx = 1;
3282
+// aWindowConstraints.weighty = 1;
3283
+// bigThree.add(scenePanel, aWindowConstraints);
3284
+// aWindowConstraints.weightx = 1;
3285
+// aWindowConstraints.gridwidth = 3;
3286
+// // aConstraints.gridheight = 3;
3287
+// aWindowConstraints.gridx = 1;
3288
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3289
+// //bigThree.add(cameraPanel, aWindowConstraints);
3290
+// aWindowConstraints.weightx = 0;
3291
+// aWindowConstraints.gridx = 4;
3292
+// aWindowConstraints.gridwidth = 1;
3293
+// // aWindowConstraints.gridheight = 3;
3294
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3295
+// //bigThree.add(XYZPanel, aWindowConstraints);
3296
+// bigThree.validate();
3297
+// scenePanel.setVisible(true);
3298
+// centralPanel.setVisible(false);
3299
+// XYZPanel.setVisible(false);
3300
+ bigThree.ClearUI();
3301
+ bigThree.add(scenePanel);
3302
+ bigThree.FlushUI();
3303
+
3304
+ cameraView.requestFocusInWindow();
26673305 } else
2668
- if (event.getSource() == sixButton)
3306
+ if (source == sixButton)
26693307 {
26703308 radio.layout = sixButton;
2671
- bigThree.remove(jtp);
2672
- bigThree.remove(cameraPanel);
2673
- bigThree.remove(XYZPanel);
2674
- aWindowConstraints.gridx = 0;
2675
- aWindowConstraints.gridy = 0;
2676
- aWindowConstraints.gridwidth = 1;
2677
- // aConstraints.gridheight = 3;
2678
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2679
- aWindowConstraints.weightx = 0;
2680
- aWindowConstraints.weighty = 1;
2681
- bigThree.add(jtp, aWindowConstraints);
2682
- aWindowConstraints.weightx = 1;
2683
- aWindowConstraints.gridwidth = 3;
2684
- // aWindowConstraints.gridheight = 3;
2685
- aWindowConstraints.gridx = 1;
2686
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2687
- bigThree.add(cameraPanel, aWindowConstraints);
2688
- aWindowConstraints.weightx = 0;
2689
- aWindowConstraints.gridx = 4;
2690
- aWindowConstraints.gridwidth = 1;
2691
- // aWindowConstraints.gridheight = 3;
2692
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2693
- //bigThree.add(XYZPanel, aConstraints);
2694
- bigThree.revalidate();
3309
+
3310
+ if (CameraPane.FULLSCREEN)
3311
+ fullscreenLayout = radio.layout;
3312
+
3313
+// bigThree.remove(scenePanel);
3314
+// bigThree.remove(centralPanel);
3315
+// bigThree.remove(XYZPanel);
3316
+// aWindowConstraints.gridx = 0;
3317
+// aWindowConstraints.gridy = 0;
3318
+// aWindowConstraints.gridwidth = 1;
3319
+// // aConstraints.gridheight = 3;
3320
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3321
+// aWindowConstraints.weightx = 0;
3322
+// aWindowConstraints.weighty = 1;
3323
+// bigThree.add(scenePanel, aWindowConstraints);
3324
+// aWindowConstraints.weightx = 1;
3325
+// aWindowConstraints.gridwidth = 3;
3326
+// // aWindowConstraints.gridheight = 3;
3327
+// aWindowConstraints.gridx = 1;
3328
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3329
+// bigThree.add(centralPanel, aWindowConstraints);
3330
+// aWindowConstraints.weightx = 0;
3331
+// aWindowConstraints.gridx = 4;
3332
+// aWindowConstraints.gridwidth = 1;
3333
+// // aWindowConstraints.gridheight = 3;
3334
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3335
+// //bigThree.add(XYZPanel, aConstraints);
3336
+// bigThree.validate();
3337
+// scenePanel.setVisible(true);
3338
+// centralPanel.setVisible(true);
3339
+// XYZPanel.setVisible(false);
3340
+ bigThree.ClearUI();
3341
+ bigThree.add(scenePanel);
3342
+ bigThree.add(centralPanel);
3343
+ bigThree.FlushUI();
3344
+
3345
+ cameraView.requestFocusInWindow();
26953346 } else
2696
- if (event.getSource() == sevenButton)
3347
+ if (source == sevenButton)
26973348 {
26983349 radio.layout = sevenButton;
2699
- bigThree.remove(jtp);
2700
- bigThree.remove(cameraPanel);
2701
- bigThree.remove(XYZPanel);
2702
- aWindowConstraints.gridx = 0;
2703
- aWindowConstraints.gridy = 0;
2704
- aWindowConstraints.gridwidth = 1;
2705
- // aWindowConstraints.gridheight = 3;
2706
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2707
- aWindowConstraints.weightx = 0;
2708
- aWindowConstraints.weighty = 1;
2709
- bigThree.add(jtp, aWindowConstraints);
2710
- aWindowConstraints.weightx = 1;
2711
- aWindowConstraints.gridwidth = 3;
2712
- // aWindowConstraints.gridheight = 3;
2713
- aWindowConstraints.gridx = 1;
2714
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2715
- bigThree.add(cameraPanel, aWindowConstraints);
2716
- aWindowConstraints.weightx = 0;
2717
- aWindowConstraints.gridx = 4;
2718
- aWindowConstraints.gridwidth = 1;
2719
- // aConstraints.gridheight = 3;
2720
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2721
- bigThree.add(XYZPanel, aWindowConstraints);
2722
- bigThree.revalidate();
3350
+
3351
+ if (CameraPane.FULLSCREEN)
3352
+ fullscreenLayout = radio.layout;
3353
+
3354
+// bigThree.remove(scenePanel);
3355
+// bigThree.remove(centralPanel);
3356
+// bigThree.remove(XYZPanel);
3357
+// aWindowConstraints.gridx = 0;
3358
+// aWindowConstraints.gridy = 0;
3359
+// aWindowConstraints.gridwidth = 1;
3360
+// // aWindowConstraints.gridheight = 3;
3361
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3362
+// aWindowConstraints.weightx = 0;
3363
+// aWindowConstraints.weighty = 1;
3364
+// bigThree.add(scenePanel, aWindowConstraints);
3365
+// aWindowConstraints.weightx = 1;
3366
+// aWindowConstraints.gridwidth = 3;
3367
+// // aWindowConstraints.gridheight = 3;
3368
+// aWindowConstraints.gridx = 1;
3369
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3370
+// bigThree.add(centralPanel, aWindowConstraints);
3371
+// aWindowConstraints.weightx = 0;
3372
+// aWindowConstraints.gridx = 4;
3373
+// aWindowConstraints.gridwidth = 1;
3374
+// // aConstraints.gridheight = 3;
3375
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3376
+// bigThree.add(XYZPanel, aWindowConstraints);
3377
+// bigThree.validate();
3378
+// scenePanel.setVisible(true);
3379
+// centralPanel.setVisible(true);
3380
+// XYZPanel.setVisible(true);
3381
+ bigThree.ClearUI();
3382
+ bigThree.add(scenePanel);
3383
+ bigThree.add(centralPanel);
3384
+ bigThree.add(XYZPanel);
3385
+ bigThree.FlushUI();
3386
+
3387
+ cameraView.requestFocusInWindow();
27233388 } else
2724
- if (event.getSource() == rootButton)
3389
+ if (source == rootButton)
27253390 {
27263391 Object3D obj;
27273392 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2731,66 +3396,84 @@
27313396 EditObject(obj);
27323397 }
27333398
3399
+ cameraView.requestFocusInWindow();
27343400 refreshContents(true);
27353401 } else
2736
- if (event.getSource() == closeButton)
3402
+ if (source == closeButton)
27373403 {
27383404 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27393405 cRadio ab;
27403406 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27413407 {
27423408 ab = (cRadio)e.nextElement();
2743
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3409
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27443410 {
3411
+ // Patch to avoid bug with transparency.
3412
+ if (!ab.hadMaterial)
3413
+ {
3414
+ ab.object.material = null;
3415
+ }
3416
+
27453417 buttonGroup.remove(ab);
27463418 radioPanel.remove(ab);
27473419
2748
- ab.GetObject().editWindow = null;
3420
+ //ab.GetObject().editWindow = null;
3421
+ ab.GetObject().manipWindow = null;
27493422 // ab.GetObject().objectUI = null; // ?????????
27503423
27513424 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
27523425 break;
27533426 }
27543427 }
3428
+
3429
+ cameraView.requestFocusInWindow();
27553430 refreshContents(true);
27563431 } else
2757
- if (event.getSource() == editItem || event.getSource() == editButton)
3432
+ if (source == editItem || source == editButton)
27583433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
27593440 EditSelection(false);
27603441 } else
2761
- if (event.getSource() == uneditButton)
3442
+ if (source == uneditButton)
27623443 {
27633444 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27643445 {
27653446 Object3D child = (Object3D)e.nextElement();
27663447 if(child.editWindow != null)
27673448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
27683450 child.CloseUI();
27693451 listUI.remove(child);
27703452
2771
- child.editWindow = null; // ???????????
3453
+ //child.editWindow = null; // ???????????
27723454 }
2773
- objEditor.ctrlPanel.revalidate();
3455
+ objEditor.ctrlPanel.FlushUI();
27743456 //objEditor.jTree.clearSelection();
27753457 //objEditor.ResetSliders();
27763458 refreshContents(true);
27773459 } else
2778
- if (event.getSource() == clearPanelButton)
3460
+ if (source == clearPanelButton)
27793461 {
27803462 assert(copy == group);
27813463 //copy.ClearUI();
27823464 for (Object3D obj : listUI)
27833465 {
3466
+ obj.pinned = false;
27843467 obj.CloseUI();
27853468 }
27863469 listUI.clear();
27873470 refreshContents(true);
27883471 } else
2789
- if (event.getSource() == allParamsButton)
3472
+ if (source == allParamsButton)
27903473 {
27913474 assert(copy == group);
27923475
2793
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27943477
27953478 for (Object3D obj : listUI)
27963479 {
....@@ -2807,19 +3490,19 @@
28073490
28083491 refreshContents(true);
28093492 } else
2810
- if (event.getSource() == unselectButton)
3493
+ if (source == unselectButton)
28113494 {
28123495 objEditor.jTree.clearSelection();
28133496 // ?? oct 2012 GrafreeD.clipboard.clear();
28143497 objEditor.ResetSliders();
28153498 refreshContents(true);
28163499 } else
2817
- if(event.getSource() instanceof cRadio)
3500
+ if(source instanceof cRadio)
28183501 {
28193502 group.parent = keepparent;
28203503 group.attributes = 0;
28213504 //group.editWindow = null;
2822
- /*cRadio*/ radio = (cRadio)event.getSource();
3505
+ /*cRadio*/ radio = (cRadio)source;
28233506 Object3D obj = radio.GetObject();
28243507 System.out.println("Edit " + obj);
28253508 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2839,7 +3522,10 @@
28393522 }
28403523
28413524 copy = group;
2842
- //CameraPane.theRenderer.object = group;
3525
+
3526
+ SetUndoStates();
3527
+
3528
+ //Globals.theRenderer.object = group;
28433529 if(!useclient)
28443530 {
28453531 cameraView.renderCamera = radio.camera;
....@@ -2848,25 +3534,52 @@
28483534 cameraView.cameras[cameraView.cameracount] = radio.camera;
28493535 cameraView.targetLookAt.set(radio.camera.lookAt);
28503536 cameraView.object = group;
2851
- cameraView.lighttouched = true;
3537
+ //cameraView.lighttouched = true;
3538
+ Globals.lighttouched = true;
28523539 topView.object = group;
28533540 frontView.object = group;
28543541 sideView.object = group;
28553542 }
2856
- group.editWindow = this;
3543
+
3544
+// fix "+" issue
3545
+ //group.editWindow = this;
3546
+ group.manipWindow = this;
3547
+
28573548 /*
28583549 currentLayout = radio.layout;
28593550 if (currentLayout == null)
28603551 currentLayout = sevenButton;
28613552 */
28623553 radio.layout.doClick();
3554
+
3555
+ ClearUnpinned();
3556
+ Grafreed.Assert(group != null);
3557
+ Grafreed.Assert(group.selection != null);
3558
+ SetPinStates(group.selection.size() > 0);
3559
+ if (group.selection.size() == 1)
3560
+ EditSelection(false);
28633561 keepparent = group.parent;
28643562 // PARENT = NULL or not???
28653563 //group.parent = null; // ROOT
28663564 //group.attributes = -1;
28673565 ResetModel();
3566
+
3567
+ cameraView.requestFocusInWindow();
28683568 refreshContents(true);
2869
- }
3569
+ } else if (event.getSource() == editCameraItem)
3570
+ {
3571
+ cameraView.ProtectCamera();
3572
+ cameraView.repaint();
3573
+ return;
3574
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3575
+ {
3576
+ cameraView.RevertCamera();
3577
+ cameraView.repaint();
3578
+ return;
3579
+ // } else if (event.getSource() == textureButton)
3580
+ // {
3581
+ // return; // true;
3582
+ }
28703583 else
28713584 {
28723585 //return super.action(event, arg);
....@@ -2875,7 +3588,6 @@
28753588 }
28763589
28773590 boolean useclient = false;
2878
- cRadio radio;
28793591
28803592 void ToggleRoot()
28813593 {
....@@ -2884,7 +3596,7 @@
28843596 if (useclient)
28853597 {
28863598 cameraView.object = client;
2887
- cameraView.lighttouched = true;
3599
+ Globals.lighttouched = true;
28883600 //topView.object = client;
28893601 //frontView.object = client;
28903602 //sideView.object = client;
....@@ -2892,7 +3604,7 @@
28923604 else
28933605 {
28943606 cameraView.object = group;
2895
- cameraView.lighttouched = true;
3607
+ Globals.lighttouched = true;
28963608 //topView.object = group;
28973609 //frontView.object = group;
28983610 //sideView.object = group;
....@@ -2927,6 +3639,28 @@
29273639 refreshContents();
29283640 }
29293641
3642
+ void TransformChildren()
3643
+ {
3644
+ Object3D obj;
3645
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3646
+ {
3647
+ obj = (Object3D)e.nextElement();
3648
+ obj.KeepTextureMatrices();
3649
+ obj.TransformChildren();
3650
+ obj.RestoreTextureMatrices();
3651
+
3652
+// if (obj.parent == null)
3653
+// {
3654
+// System.out.println("NULL PARENT!");
3655
+// new Exception().printStackTrace();
3656
+// }
3657
+// else
3658
+// TouchTransform(obj);
3659
+// //obj.parent.Touch();
3660
+ }
3661
+
3662
+ refreshContents();
3663
+ }
29303664
29313665 void ResetTransform()
29323666 {
....@@ -3039,7 +3773,7 @@
30393773 refreshContents();
30403774 }
30413775
3042
- void ResetCentroid()
3776
+ void ResetCentroid(boolean full)
30433777 {
30443778 Object3D obj;
30453779 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3054,12 +3788,16 @@
30543788 LA.matIdentity(Object3D.mat);
30553789 obj.getBounds(minima, maxima, false);
30563790 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3057
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3791
+ if (full)
3792
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30583793 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30593794 obj.TransformMesh(Object3D.mat);
3795
+
30603796 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3061
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3797
+ if (full)
3798
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30623799 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3800
+
30633801 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30643802 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30653803 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3088,7 +3826,8 @@
30883826
30893827 int size = obj.MemorySize();
30903828
3091
- System.err.println((size/1024) + " KB is the size of " + obj);
3829
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3830
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30923831 }
30933832 }
30943833 catch (Exception e)
....@@ -3125,9 +3864,9 @@
31253864 obj = (Object3D)e.nextElement();
31263865
31273866 System.out.println("Object is: " + obj);
3128
- GrafreeD.AnalyzeObject(obj);
3867
+ Grafreed.AnalyzeObject(obj);
31293868 System.out.println("Boundary rep: " + obj.bRep);
3130
- GrafreeD.AnalyzeObject(obj.bRep);
3869
+ Grafreed.AnalyzeObject(obj.bRep);
31313870
31323871 // System.err.println((size/1024) + " KB is the size of " + obj);
31333872 }
....@@ -3169,6 +3908,20 @@
31693908 void GenNormals(boolean crease)
31703909 {
31713910 group.GenNormalsS(crease);
3911
+
3912
+ refreshContents();
3913
+ }
3914
+
3915
+ void GenNormalsMESH()
3916
+ {
3917
+ group.GenNormalsMeshS();
3918
+
3919
+ refreshContents();
3920
+ }
3921
+
3922
+ void GenNormalsMINE()
3923
+ {
3924
+ group.selection.GenNormalsMINE();
31723925
31733926 refreshContents();
31743927 }
....@@ -3334,8 +4087,8 @@
33344087
33354088 void ParseVertices()
33364089 {
3337
- boolean epsequal = GrafreeD.epsequal;
3338
- GrafreeD.epsequal = true;
4090
+ boolean epsequal = Grafreed.epsequal;
4091
+ Grafreed.epsequal = true;
33394092
33404093 for (int i=0; i<group.selection.size(); i++)
33414094 {
....@@ -3360,7 +4113,7 @@
33604113 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33614114 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33624115
3363
- g.add(GrafreeD.clipboard);
4116
+ g.add(Grafreed.clipboard);
33644117
33654118 buffer.add(g);
33664119 }
....@@ -3375,7 +4128,7 @@
33754128 makeSomething(buffer, i==group.selection.size()-1);
33764129 }
33774130
3378
- GrafreeD.epsequal = epsequal;
4131
+ Grafreed.epsequal = epsequal;
33794132
33804133 refreshContents();
33814134 }
....@@ -3393,7 +4146,16 @@
33934146 String pigment = Object3D.GetPigment(tex);
33944147 //String bump = Object3D.GetBump(tex);
33954148
3396
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4149
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4150
+
4151
+ try
4152
+ {
4153
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4154
+ }
4155
+ catch (Exception e)
4156
+ {
4157
+ System.err.println("FAIL: " + node);
4158
+ }
33974159
33984160 double s = v.s;
33994161
....@@ -3441,12 +4203,26 @@
34414203
34424204 void Align()
34434205 {
4206
+ if (group.selection.size() == 0)
4207
+ return;
4208
+
4209
+ cVector bbmin = new cVector();
4210
+ cVector bbmax = new cVector();
4211
+
4212
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4213
+
4214
+ double dx = bbmax.x - bbmin.x;
4215
+ double dy = bbmax.y - bbmin.y;
4216
+ double dz = bbmax.z - bbmin.z;
4217
+
4218
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4219
+
34444220 for (int i=0; i<group.selection.size(); i++)
34454221 {
34464222 Object3D obj = group.selection.get(i);
34474223
3448
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3449
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4224
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4225
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34504226 }
34514227
34524228 refreshContents();
....@@ -3467,11 +4243,11 @@
34674243
34684244 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34694245
3470
- boolean random = CameraPane.RANDOM;
3471
- CameraPane.RANDOM = false; // parse all random nodes
4246
+ boolean random = CameraPane.SWITCH;
4247
+ CameraPane.SWITCH = false; // parse all random nodes
34724248 lowres.linkVerticesThis(null);
34734249 lowres.linkVerticesThis(sn);
3474
- CameraPane.RANDOM = random;
4250
+ CameraPane.SWITCH = random;
34754251
34764252 System.err.flush();
34774253
....@@ -3511,7 +4287,7 @@
35114287 return;
35124288
35134289 Object3D poses = group.selection.get(0);
3514
- Object3D ref = GrafreeD.clipboard.get(0);
4290
+ Object3D ref = Grafreed.clipboard.get(0);
35154291
35164292 Object3D newgroup = new Object3D("Po:" + poses.name);
35174293
....@@ -3680,7 +4456,7 @@
36804456 group.selection.RelinkToSupport(); // july 2014
36814457 System.out.println("DONE.");
36824458 refreshContents();
3683
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4459
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
36844460 }
36854461
36864462 void ReduceMesh(boolean reduction34)
....@@ -3705,9 +4481,9 @@
37054481
37064482 void ClipMesh()
37074483 {
3708
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4484
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37094485 {
3710
- Object3D content = GrafreeD.clipboard.get(0);
4486
+ Object3D content = Grafreed.clipboard.get(0);
37114487
37124488 if (content instanceof cGroup && ((cGroup)content).transientlink )
37134489 content = ((cGroup)content).get(0);
....@@ -3716,7 +4492,7 @@
37164492 // {
37174493 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37184494 // }
3719
- group.selection.ClipMesh(GrafreeD.clipboard);
4495
+ group.selection.ClipMesh(Grafreed.clipboard);
37204496 }
37214497 // group.selection.ClipMesh(GrafreeD.clipboard);
37224498 System.out.println("DONE.");
....@@ -3763,6 +4539,18 @@
37634539 void MarkLeaves(boolean hide)
37644540 {
37654541 group.selection.MarkLeaves(hide);
4542
+ refreshContents();
4543
+ }
4544
+
4545
+ void RewindLeaves(boolean hide)
4546
+ {
4547
+ group.selection.RewindLeaves(hide);
4548
+ refreshContents();
4549
+ }
4550
+
4551
+ void RandomLeaves(boolean hide)
4552
+ {
4553
+ group.selection.RandomLeaves(hide);
37664554 refreshContents();
37674555 }
37684556
....@@ -3837,10 +4625,6 @@
38374625 // }
38384626 // }
38394627
3840
- static boolean allparams = true;
3841
-
3842
- static Vector<Object3D> listUI = new Vector<Object3D>();
3843
-
38444628 void EditSelection(boolean newWindow)
38454629 {
38464630 // aConstraints.gridy = 0;
....@@ -3848,10 +4632,10 @@
38484632 {
38494633 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
38504634 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3851
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4635
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38524636
38534637 Object3D elem = (Object3D)group.selection.elementAt(i);
3854
- if(elem != group)
4638
+ if(elem != group || !newWindow)
38554639 {
38564640 // if (!(elem instanceof Composite))
38574641 // newWindow = false;
....@@ -3933,7 +4717,8 @@
39334717 //new Exception().printStackTrace();
39344718
39354719 freezemodel = true;
3936
-
4720
+ ClearUnpinned();
4721
+
39374722 /**/
39384723 //switch (event.id)
39394724 {
....@@ -3941,7 +4726,6 @@
39414726 //case 702: // Event.LIST_DESELECT
39424727 group.deselectAll();
39434728 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3944
- objEditor.ClearInfo(); // .GetMaterial());
39454729 if (tps != null)
39464730 {
39474731 for (int i=0; i < tps.length; i++)
....@@ -3950,33 +4734,39 @@
39504734
39514735 //if (child.parent != null)
39524736 //child.parent.addSelectee(child);
4737
+ objEditor.SetMaterial(child);
39534738 group.addSelectee(child);
3954
- objEditor.SetMaterial(child); // .GetMaterial());
3955
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3956
- System.err.println("info : " + child.GetPath());
39574739 }
39584740 }
3959
- else
3960
- {
3961
- objEditor.SetMaterial(group); // .GetMaterial());
3962
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3963
- System.err.println("info : " + group.GetPath());
3964
- }
4741
+// else
4742
+// {
4743
+// objEditor.SetMaterial(group); // .GetMaterial());
4744
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4745
+// System.err.println("info : " + group.GetPath());
4746
+// }
39654747
3966
- objEditor.SetText(); // jan 2014
3967
-
3968
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4748
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
39694749 CameraPane.flash = true;
39704750
3971
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4751
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39724752 // a camera
39734753 {
3974
- CameraPane.camerachangeframe = 0; // don't refuse it
3975
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3976
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3977
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
4754
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4755
+ {
4756
+ CameraPane.camerachangeframe = 0; // don't refuse it
4757
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4758
+ }
4759
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4760
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
39784761 }
39794762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
39804770 refreshContents();
39814771 //return true;
39824772 }
....@@ -3985,6 +4775,35 @@
39854775
39864776 freezemodel = false;
39874777 }
4778
+
4779
+ void SetPinStates(boolean enabled)
4780
+ {
4781
+ editButton.setEnabled(enabled);
4782
+ uneditButton.setEnabled(enabled);
4783
+ unselectButton.setEnabled(enabled);
4784
+ flashSelectionButton.setEnabled(enabled);
4785
+ }
4786
+
4787
+ void refreshContents(boolean cp)
4788
+ {
4789
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4790
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4791
+ {
4792
+ objEditor.ClearInfo(); // .GetMaterial());
4793
+
4794
+ for (int i=0; i < group.selection.Size(); i++)
4795
+ {
4796
+ Object3D child = (Object3D) group.selection.get(i);
4797
+
4798
+ objEditor.AddInfo(child, this, true);
4799
+ System.err.println("info : " + child.GetPath());
4800
+ }
4801
+
4802
+ objEditor.SetText(); // jan 2014
4803
+ }
4804
+
4805
+ super.refreshContents(cp);
4806
+ }
39884807
39894808 void linkSomething(Object3D thing)
39904809 {
....@@ -4056,16 +4875,19 @@
40564875 {
40574876 if (group.selection.isEmpty())
40584877 return;
4059
- GrafreeD.clipboardIsTempGroup = false;
4878
+
4879
+ Grafreed.clipboardIsTempGroup = false;
40604880 Composite tGroup = null;
40614881 if (group.selection.size() > 0) // 1)
40624882 {
40634883 tGroup = new cGroup();
4064
- GrafreeD.clipboardIsTempGroup = true;
4884
+ Grafreed.clipboardIsTempGroup = true;
40654885 }
40664886
40674887 if (cut)
40684888 {
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
40694891 //int indices[] = jList.getSelectedIndices();
40704892 //for (int i = indices.length - 1; i >= 0; i--)
40714893 //jList.remove(indices[i]);
....@@ -4101,16 +4923,16 @@
41014923 //System.out.println("cut " + child);
41024924 //System.out.println("parent = " + child.parent);
41034925 // tmp.addChild(child);
4104
- if (GrafreeD.clipboardIsTempGroup)
4926
+ if (Grafreed.clipboardIsTempGroup)
41054927 tGroup.add/*Child*/(tmp);
41064928 else
4107
- GrafreeD.clipboard = tmp;
4929
+ Grafreed.clipboard = tmp;
41084930 }
41094931 else
4110
- if (GrafreeD.clipboardIsTempGroup)
4932
+ if (Grafreed.clipboardIsTempGroup)
41114933 tGroup.add/*Child*/(child);
41124934 else
4113
- GrafreeD.clipboard = child;
4935
+ Grafreed.clipboard = child;
41144936 }
41154937
41164938 //ResetModel();
....@@ -4142,21 +4964,23 @@
41424964 //System.out.println("cut " + elem);
41434965 //System.out.println("parent = " + elem.parent);
41444966 // tmp.addChild(elem);
4145
- if (GrafreeD.clipboardIsTempGroup)
4967
+ if (Grafreed.clipboardIsTempGroup)
41464968 tGroup.add/*Child*/(tmp);
41474969 else
4148
- GrafreeD.clipboard = tmp;
4970
+ Grafreed.clipboard = tmp;
41494971 }
41504972 else
4151
- if (GrafreeD.clipboardIsTempGroup)
4973
+ if (Grafreed.clipboardIsTempGroup)
41524974 tGroup.add/*Child*/(child);
41534975 else
4154
- GrafreeD.clipboard = child;
4976
+ Grafreed.clipboard = child;
41554977 }
41564978
41574979 }
4158
- if (GrafreeD.clipboardIsTempGroup)
4159
- GrafreeD.clipboard = tGroup;
4980
+
4981
+ if (Grafreed.clipboardIsTempGroup)
4982
+ Grafreed.clipboard = tGroup;
4983
+
41604984 if (cut)
41614985 {
41624986 ResetModel();
....@@ -4166,11 +4990,15 @@
41664990
41674991 void paste(boolean expand)
41684992 {
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
41694997 // if (GrafreeD.clipboard == null)
41704998 // return;
41714999 boolean first = true;
41725000
4173
- if (GrafreeD.clipboardIsTempGroup)
5001
+ if (Grafreed.clipboardIsTempGroup)
41745002 {
41755003 Composite temp;
41765004
....@@ -4181,7 +5009,7 @@
41815009 temp = (Composite)Applet3D.clipboard.deepCopy();
41825010 */
41835011 Object3D elem;
4184
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5012
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41855013 {
41865014 Object3D child = (Object3D)e.nextElement();
41875015
....@@ -4215,21 +5043,22 @@
42155043 //Object3D cb = Applet3D.clipboard;
42165044 //temp.addChild(cb);
42175045 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4218
- assert(GrafreeD.clipboard.parent == null);
4219
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4220
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4221
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4222
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5046
+ assert(Grafreed.clipboard.parent == null);
5047
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5048
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5049
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5050
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42235051 else
4224
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4225
- GrafreeD.clipboard.get(0).parent = keepparent;
5052
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5053
+ Grafreed.clipboard.get(0).parent = keepparent;
42265054 }
42275055
5056
+ Globals.REPLACEONMAKE = keep;
42285057 ResetModel();
42295058 refreshContents();
42305059 }
42315060
4232
- void pasteInto(boolean copyit)
5061
+ void pasteInto(boolean copyit, boolean clone)
42335062 {
42345063 // if (GrafreeD.clipboard == null)
42355064 // return;
....@@ -4258,15 +5087,22 @@
42585087 if (copyit)
42595088 {
42605089 // paste(false);
4261
- CloneClipboard(false); // sept 2014
5090
+ if (clone)
5091
+ {
5092
+ CloneClipboard(false); // sept 2014
5093
+ }
5094
+ else
5095
+ {
5096
+ paste(false);
5097
+ }
42625098 }
42635099 else
42645100 {
42655101 boolean first = true;
42665102
4267
- if (GrafreeD.clipboardIsTempGroup)
5103
+ if (Grafreed.clipboardIsTempGroup)
42685104 {
4269
- Composite temp = (Composite)GrafreeD.clipboard;
5105
+ Composite temp = (Composite)Grafreed.clipboard;
42705106 Object3D copy;
42715107 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42725108 {
....@@ -4276,7 +5112,7 @@
42765112 }
42775113 } else
42785114 {
4279
- linkSomething(GrafreeD.clipboard); //.get(0));
5115
+ linkSomething(Grafreed.clipboard); //.get(0));
42805116 }
42815117 }
42825118 }
....@@ -4353,6 +5189,10 @@
43535189
43545190 void group(Object3D csg, boolean grab)
43555191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
43565196 if (//false) // why??
43575197 !group.selection.isEmpty())
43585198 {
....@@ -4466,8 +5306,34 @@
44665306 //node.add(csg);
44675307 //makeSomething(node);
44685308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
44695310 }
44705311
5312
+ void Ungroup(Object3D g)
5313
+ {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
5318
+ if (g instanceof HiddenObject)
5319
+ {
5320
+ HiddenObject h = (HiddenObject) g;
5321
+
5322
+ for (int i=0; i<h.ActualSize(); i++)
5323
+ {
5324
+ objEditor.makeSomething(h.get(i), false);
5325
+ }
5326
+ }
5327
+ else
5328
+ {
5329
+ for (int i=0; i<g.Size(); i++)
5330
+ {
5331
+ objEditor.makeSomething(g.get(i), false);
5332
+ }
5333
+ }
5334
+ Globals.REPLACEONMAKE = keep;
5335
+ }
5336
+
44715337 void ungroup()
44725338 {
44735339 /*
....@@ -4661,21 +5527,6 @@
46615527 }
46625528 */
46635529
4664
- void ImportGFD()
4665
- {
4666
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4667
- browser.show();
4668
- String filename = browser.getFile();
4669
- if (filename != null && filename.length() > 0)
4670
- {
4671
- String fullname = browser.getDirectory() + filename;
4672
-
4673
- //Object3D readobj =
4674
- objEditor.ReadGFD(fullname, objEditor);
4675
- //makeSomething(readobj);
4676
- }
4677
- }
4678
-
46795530 /*
46805531 public void Callback(Object obj)
46815532 {
....@@ -4699,26 +5550,9 @@
46995550 }
47005551 */
47015552
4702
- void ImportVRMLX3D()
4703
- {
4704
- if (GrafreeD.standAlone)
4705
- {
4706
- /**/
4707
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4708
- browser.show();
4709
- String filename = browser.getFile();
4710
- if (filename != null && filename.length() > 0)
4711
- {
4712
- String fullname = browser.getDirectory() + filename;
4713
- LoadVRMLX3D(fullname);
4714
- }
4715
- /**/
4716
- }
4717
- }
4718
-
47195553 String GetFile(String dialogName)
47205554 {
4721
- if (GrafreeD.standAlone)
5555
+ if (Grafreed.standAlone)
47225556 {
47235557 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47245558 browser.show();
....@@ -4782,10 +5616,33 @@
47825616 cButton flashSelectionButton;
47835617 cButton editButton;
47845618 cButton uneditButton;
5619
+ JCheckBox allParamsButton;
47855620 cButton clearpanelButton;
4786
- cButton allParamsButton;
47875621 cButton unselectButton;
47885622
5623
+ cButton restoreCameraButton;
5624
+
5625
+ cButton saveButton;
5626
+ cButton oneStepButton;
5627
+
5628
+ cButton groupButton;
5629
+ cButton ungroupButton;
5630
+ cButton compositeButton;
5631
+ cButton switchButton;
5632
+ cButton loopButton;
5633
+ cButton textureButton;
5634
+
5635
+ cButton gridButton;
5636
+ cButton boxButton;
5637
+ cButton sphereButton;
5638
+ cButton coneButton;
5639
+ cButton torusButton;
5640
+ cButton superButton;
5641
+ cButton kleinButton;
5642
+ cButton particlesButton;
5643
+ cButton overlayButton;
5644
+ cButton lightButton;
5645
+
47895646 cButton screenfitButton;
47905647 cButton screenfitpointButton;
47915648 cButton snapobjectButton;
....@@ -4797,14 +5654,6 @@
47975654
47985655 cButton setsupportButton;
47995656
4800
- cButton twoButton;
4801
- cButton sixButton;
4802
- cButton threeButton;
4803
- cButton sevenButton;
4804
- cButton fourButton; // full panel
4805
- cButton oneButton; // full XYZ
4806
- //cButton currentLayout;
4807
-
48085657 //
48095658 //Composite
48105659 Object3D // to do !!
....@@ -4814,9 +5663,11 @@
48145663 //JTree jTree;
48155664 private MenuItem lookAtItem;
48165665 private MenuItem lookFromItem;
4817
- private MenuItem switchItem;
5666
+ private MenuItem switchViewItem;
48185667 private MenuItem cutItem;
4819
- private MenuItem duplicateItem;
5668
+ private MenuItem undoItem;
5669
+ private MenuItem redoItem;
5670
+ private JMenuItem duplicateItem;
48205671 private MenuItem cloneItem;
48215672 private MenuItem cloneSupportItem;
48225673 private MenuItem overwriteGeoItem;
....@@ -4827,8 +5678,9 @@
48275678 private MenuItem resetsupportItem;
48285679 private MenuItem resetreferencesItem;
48295680 private MenuItem linkverticesItem;
5681
+ private MenuItem relinkverticesItem;
48305682 private MenuItem setMasterItem;
4831
- private MenuItem resetMeshItem;
5683
+ private MenuItem resetAllItem;
48325684 private MenuItem stepAllItem;
48335685 private MenuItem revertMeshItem;
48345686 private MenuItem poseMeshItem;
....@@ -4839,14 +5691,17 @@
48395691 private MenuItem mergeGeometriesItem;
48405692 private MenuItem copyItem;
48415693 private MenuItem pasteItem;
5694
+ private MenuItem pasteIntoItem;
48425695 private MenuItem pasteLinkItem;
48435696 private MenuItem pasteCloneItem;
48445697 private MenuItem pasteExpandItem;
48455698 private MenuItem clearItem;
48465699 private MenuItem clearAllItem;
48475700 private MenuItem genUVItem;
5701
+ private MenuItem genNormalsMESHItem;
48485702 private MenuItem genNormalsCADItem;
48495703 private MenuItem genNormalsORGANItem;
5704
+ private MenuItem genNormalsMINEItem;
48505705 private MenuItem stripifyItem;
48515706 private MenuItem unstripifyItem;
48525707 private MenuItem trimItem;
....@@ -4875,6 +5730,10 @@
48755730 private MenuItem showleavesItem;
48765731 private MenuItem markleavesItem;
48775732 private MenuItem unmarkleavesItem;
5733
+ private MenuItem rewindleavesItem;
5734
+ private MenuItem unrewindleavesItem;
5735
+ private MenuItem randomleavesItem;
5736
+ private MenuItem unrandomleavesItem;
48785737
48795738 private MenuItem flipVItem;
48805739 private MenuItem unflipVItem;
....@@ -4886,14 +5745,17 @@
48865745 private MenuItem panoTexturesItem;
48875746
48885747 private MenuItem resetCentroidItem;
4889
- private MenuItem transformgeometryItem;
5748
+ private MenuItem resetCentroidXZItem;
48905749 private MenuItem resetTransformItem;
5750
+ private MenuItem transformGeometryItem;
5751
+ private MenuItem transformChildrenItem;
5752
+ private MenuItem hideItem;
48915753 private MenuItem grabItem;
48925754 private MenuItem backItem;
48935755 private MenuItem frontItem;
48945756 private MenuItem cameraItem;
48955757 private MenuItem compositeItem;
4896
- private MenuItem randomItem;
5758
+ private MenuItem switchItem;
48975759 private MenuItem physicsItem;
48985760 private MenuItem frameselectorItem;
48995761 private MenuItem scriptNodeItem;
....@@ -4908,6 +5770,7 @@
49085770
49095771 private MenuItem resetParentItem;
49105772 private MenuItem repairParentItem;
5773
+ private MenuItem repairShadowItem;
49115774 private MenuItem sortbysizeItem;
49125775 private MenuItem sortbynameItem;
49135776
....@@ -4928,10 +5791,11 @@
49285791 private MenuItem coneItem;
49295792 private MenuItem torusItem;
49305793 private MenuItem superItem;
5794
+ private MenuItem kleinItem;
49315795 private MenuItem blobItem;
49325796 private MenuItem latheItem;
49335797 private MenuItem bezierItem;
4934
- private MenuItem checkerItem;
5798
+ private MenuItem overlayItem;
49355799 private MenuItem meshItem;
49365800 // private MenuItem meshGroupItem;
49375801 private MenuItem springItem;
....@@ -4940,6 +5804,7 @@
49405804 private MenuItem csgItem;
49415805 private MenuItem templateItem;
49425806 private MenuItem textureItem;
5807
+ private MenuItem billboardItem;
49435808 private MenuItem shadowXItem;
49445809 private MenuItem shadowYItem;
49455810 private MenuItem shadowZItem;
....@@ -4952,11 +5817,6 @@
49525817 private MenuItem doubleItem;
49535818 private MenuItem tripleItem;
49545819
4955
- private MenuItem importGFDItem;
4956
- private MenuItem importVRMLX3DItem;
4957
- private MenuItem import3DSItem;
4958
- private MenuItem importOBJItem;
4959
-
49605820 private MenuItem computeAOItem;
49615821 private MenuItem recompileItem;
49625822 private MenuItem editScriptItem;
....@@ -4966,4 +5826,8 @@
49665826 private MenuItem analyzeItem;
49675827 private MenuItem dumpItem;
49685828 //boolean freezemodel = false;
5829
+
5830
+ Menu cameraMenu;
5831
+ MenuItem editCameraItem;
5832
+ MenuItem restoreCameraItem;
49695833 }