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,79 +323,104 @@
210323 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211324 overwriteUVItem.addActionListener(this);
212325 menu.add("-");
326
+ if (Globals.ADVANCED)
327
+ {
213328 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214329 generateMeshItem.addActionListener(this);
215330 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216331 poseMeshItem.addActionListener(this);
217332 menu.add("-");
333
+ }
218334 resetsupportItem = menu.add(new MenuItem("Reset support"));
219335 resetsupportItem.addActionListener(this);
220336 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221337 linkverticesItem.addActionListener(this);
222338 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223339 relinkverticesItem.addActionListener(this);
340
+
341
+ if (Globals.ADVANCED)
342
+ {
224343 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225344 setMasterItem.addActionListener(this);
345
+ }
226346
227347 oe.menuBar.add(menu = new Menu("Group"));
228
- grabItem = menu.add(new MenuItem("Grab"));
229
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
230350 backItem = menu.add(new MenuItem("Back"));
231351 backItem.addActionListener(this);
232352 frontItem = menu.add(new MenuItem("Front"));
233353 frontItem.addActionListener(this);
234
- compositeItem = menu.add(new MenuItem("Composite"));
235
- compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
359
+ hideItem = menu.add(new MenuItem("Hidden Group"));
237360 hideItem.addActionListener(this);
361
+ }
238362 ungroupItem = menu.add(new MenuItem("Ungroup"));
239363 ungroupItem.addActionListener(this);
240
- menu.add("-");
241
- randomItem = menu.add(new MenuItem("Random"));
242
- randomItem.addActionListener(this);
243
- physicsItem = menu.add(new MenuItem("Physics"));
244
- physicsItem.addActionListener(this);
245
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
246
- frameselectorItem.addActionListener(this);
364
+
365
+// menu.add("-");
366
+//
367
+// switchItem = menu.add(new MenuItem("Switch node"));
368
+// switchItem.addActionListener(this);
369
+ if (Globals.ADVANCED)
370
+ {
247371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248372 switchGeoItem.addActionListener(this);
249373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250374 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
375
+ morphItem = menu.add(new MenuItem("Morph Group"));
252376 morphItem.addActionListener(this);
377
+
378
+ menu.add("-");
379
+ physicsItem = menu.add(new MenuItem("Physics"));
380
+ physicsItem.addActionListener(this);
381
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
382
+ frameselectorItem.addActionListener(this);
253383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254384 scriptNodeItem.addActionListener(this);
255
- cameraItem = menu.add(new MenuItem("Camera"));
256
- cameraItem.addActionListener(this);
385
+ }
257386
258387 oe.menuBar.add(menu = new Menu("Object"));
259
- textureItem = menu.add(new MenuItem("Texture"));
260
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
261390 billboardItem = menu.add(new MenuItem("Billboard"));
262391 billboardItem.addActionListener(this);
263392 csgItem = menu.add(new MenuItem("CSG"));
264393 csgItem.addActionListener(this);
265
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
266395 shadowXItem.addActionListener(this);
267
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
268397 shadowYItem.addActionListener(this);
269
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
270399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
403
+ if (Globals.ADVANCED)
404
+ {
405
+ menu.add("-");
271406 linkerItem = menu.add(new MenuItem("Linker"));
272407 linkerItem.addActionListener(this);
273408 templateItem = menu.add(new MenuItem("Template"));
274409 templateItem.addActionListener(this);
275
- attributeItem = menu.add(new MenuItem("Attribute"));
276
- attributeItem.addActionListener(this);
277410 pointflowItem = menu.add(new MenuItem("Point Flow"));
278411 pointflowItem.addActionListener(this);
412
+ }
279413 menu.add("-");
280414 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281415 resetTransformItem.addActionListener(this);
282416 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283417 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- transformgeometryItem.addActionListener(this);
418
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
419
+ resetCentroidXZItem.addActionListener(this);
420
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
421
+ transformGeometryItem.addActionListener(this);
422
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
423
+ transformChildrenItem.addActionListener(this);
286424
287425 oe.menuBar.add(menu = new Menu("Geometry"));
288426 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +431,11 @@
293431 genNormalsCADItem.addActionListener(this);
294432 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295433 genNormalsMESHItem.addActionListener(this);
434
+ if (Globals.ADVANCED)
435
+ {
296436 genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
297437 genNormalsMINEItem.addActionListener(this);
438
+ }
298439 stripifyItem = menu.add(new MenuItem("Stripify"));
299440 stripifyItem.addActionListener(this);
300441 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +457,34 @@
316457 reduce34MeshItem.addActionListener(this);
317458 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318459 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321460 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322461 clipMeshItem.addActionListener(this);
462
+
463
+ if (Globals.ADVANCED)
464
+ {
465
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
466
+ smoothMeshItem.addActionListener(this);
467
+ }
323468
324469 oe.menuBar.add(menu = new Menu("Attributes"));
325470 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326471 clearMaterialsItem.addActionListener(this);
472
+ resetAllItem = menu.add(new MenuItem("Reset All"));
473
+ resetAllItem.addActionListener(this);
474
+ stepAllItem = menu.add(new MenuItem("Step All"));
475
+ stepAllItem.addActionListener(this);
327476 menu.add("-");
328477 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329478 liveleavesItem.addActionListener(this);
330479 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331480 unliveleavesItem.addActionListener(this);
481
+ if (Globals.ADVANCED)
482
+ {
332483 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333484 supportleavesItem.addActionListener(this);
334485 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335486 unsupportleavesItem.addActionListener(this);
487
+ }
336488 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337489 hideleavesItem.addActionListener(this);
338490 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -341,6 +493,14 @@
341493 markleavesItem.addActionListener(this);
342494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
343495 unmarkleavesItem.addActionListener(this);
496
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
497
+ rewindleavesItem.addActionListener(this);
498
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
499
+ unrewindleavesItem.addActionListener(this);
500
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
501
+ randomleavesItem.addActionListener(this);
502
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
503
+ unrandomleavesItem.addActionListener(this);
344504 menu.add("-");
345505 flipVItem = menu.add(new MenuItem("Flip V"));
346506 flipVItem.addActionListener(this);
....@@ -376,35 +536,41 @@
376536 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377537 sortbynameItem.addActionListener(this);
378538 menu.add("-");
539
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
540
+ shareGeometriesItem.addActionListener(this);
541
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
542
+ mergeGeometriesItem.addActionListener(this);
543
+ if (Globals.ADVANCED)
544
+ {
545
+ // Pretty much the same as duplicate and clone.
379546 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380547 extractGeometriesItem.addActionListener(this);
381548 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382549 cloneGeometriesItem.addActionListener(this);
383
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
- shareGeometriesItem.addActionListener(this);
385
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
- mergeGeometriesItem.addActionListener(this);
550
+ }
387551
388552 oe.menuBar.add(menu = new Menu("Insert"));
389553 buildCreateMenu(menu);
390554
391
-
392
- oe.menuBar.add(menu = new Menu("Include"));
393
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
- importGFDItem.addActionListener(this);
395
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
- importVRMLX3DItem.addActionListener(this);
397
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
398
- importOBJItem.addActionListener(this);
399
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
- import3DSItem.addActionListener(this);
401
-
402555 oe.menuBar.add(menu = new Menu("Tools"));
403556 buildToolsMenu(menu);
404557 }
405558
559
+
406560 void SetupUI2(ObjEditor oe)
407561 {
562
+ // June 2019
563
+ if (oe == null)
564
+ {
565
+ //super.SetupUI2(this);
566
+ //return;
567
+ }
568
+
569
+ if (copy != group)
570
+ {
571
+ //super.SetupUI2(this);
572
+ }
573
+
408574 //new Exception().printStackTrace();
409575
410576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -433,153 +599,230 @@
433599 oe.radioPanel.add(dummyButton);
434600 oe.buttonGroup.add(dummyButton);
435601 */
436
- aConstraints.gridy += 1;
437
- oe.aConstraints.gridwidth = 1;
438
- oe.aConstraints.gridx = 0;
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
439605
440
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
606
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
607
+
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
611
+
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
618
+
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ fullButton.setToolTipText("Full-screen window");
621
+ fullButton.addActionListener(this);
622
+
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ screenfitButton.setToolTipText("Screen fit");
625
+ screenfitButton.addActionListener(this);
626
+
627
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ restoreCameraButton.setToolTipText("Restore viewpoint");
629
+ restoreCameraButton.addActionListener(this);
630
+
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
633
+ saveButton.addActionListener(this);
634
+
635
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ undoButton.setToolTipText("Previous version");
637
+ undoButton.addActionListener(this);
638
+ undoButton.setEnabled(false);
639
+
640
+ cGridBag updown = new cGridBag().setVertical(true);
641
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ restoreButton.setToolTipText("Restore current");
643
+ restoreButton.addActionListener(this);
644
+ restoreButton.setEnabled(false);
645
+
646
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ replaceButton.setToolTipText("Replace current");
648
+ replaceButton.addActionListener(this);
649
+ replaceButton.setEnabled(false);
650
+
651
+ copyOptionsPanel.add(updown);
652
+
653
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ redoButton.setToolTipText("Next version");
655
+ redoButton.addActionListener(this);
656
+ redoButton.setEnabled(false);
657
+
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
659
+ liveCB.setToolTipText("Enable animation");
441660 liveCB.addItemListener(this);
442661
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
445
- supportCB.addItemListener(this);
446
-
447
- // oe.aConstraints.gridx += 1;
448
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
449
- // localCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
453
- crowdCB.addItemListener(this);
454
-
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
457
- smoothCB.addItemListener(this);
458
-
459
- oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
+ oneStepButton.setToolTipText("Animate one step forward");
664
+ oneStepButton.addActionListener(this);
665
+
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
667
+ fastCB.setToolTipText("Fast mode");
461668 fastCB.addItemListener(this);
462
- oe.aConstraints.gridx += 1;
463
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
464
- slowCB.addItemListener(this);
465
- oe.aConstraints.gridx += 1;
466
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
467
- boxCB.addItemListener(this);
669
+
670
+ //oe.toolboxPanel.Return();
671
+
672
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
673
+// trackCB.setToolTipText("Enable tracking");
674
+// trackCB.addItemListener(this);
468675
469
-// oe.aConstraints.gridx += 1;
470
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
471
-// speakerMocapCB.addItemListener(this);
472
-
473
- if (false)
474
- {
475
- // handled in scripts
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
478
- speakerCameraCB.addItemListener(this);
479
-
480
- oe.aConstraints.gridx += 1;
481
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
482
- speakerFocusCB.addItemListener(this);
483
-
484
- oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
486
- smoothfocusCB.addItemListener(this);
487
- }
488
-
489
-//oe.aConstraints.gridx += 1;
490
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
491
-// debugCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
495
- oeilCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
499
- lookAtCB.addItemListener(this);
500
-
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
503
- trackCB.addItemListener(this);
504
-
505
- oe.aConstraints.gridx += 1;
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
507
- screenfitButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
509676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
510677 // screenfitpointButton.addActionListener(this);
511
-// oe.aConstraints.gridx += 1;
512
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
513
- snapobjectButton.addActionListener(this);
514
- oe.aConstraints.gridx += 1;
515678
516
- //aConstraints.gridx = 0;
517
- //aConstraints.gridy += 1;
518
- oe.aConstraints.weighty = 0;
519
- oe.aConstraints.gridwidth = 1;
520
-
521
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
522
- flashSelectionButton.addActionListener(this);
679
+ if (Globals.ADVANCED)
680
+ {
681
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ snapobjectButton.addActionListener(this);
683
+ snapobjectButton.setToolTipText("Snap Object");
684
+ }
685
+
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
523687
524
- oe.toolbarPanel.add(new cButton(" ", false));
525
-
526
- oe.aConstraints.gridx += 1;
527
- oe.aConstraints.weighty = 0;
528
- oe.aConstraints.gridwidth = 1;
529
-
530
- //
531
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
689
+ twoButton.setToolTipText("Show center view only");
532690 twoButton.addActionListener(this);
533
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
691
+ this.fullscreenLayout = twoButton;
692
+
693
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
534694 fourButton.addActionListener(this);
535
- 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");
536698 sixButton.addActionListener(this);
537
- 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");
538701 threeButton.addActionListener(this);
539
- 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");
540704 sevenButton.addActionListener(this);
541705 //
542706
543
- 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");
544709 rootButton.addActionListener(this);
545
- oe.aConstraints.gridx += 1;
546
- 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");
547713 closeButton.addActionListener(this);
548714 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
549715 //clearButton.addActionListener(this);
550
- oe.aConstraints.gridx += 1;
551
-
552
- oe.aConstraints.gridx = 1; //
553
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
554
- editButton.addActionListener(this);
555
- oe.aConstraints.gridx += 1;
556
- oe.aConstraints.weighty = 0;
557
- oe.aConstraints.gridwidth = 1;
558716
559
- 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");
560802 uneditButton.addActionListener(this);
561803
562
- oe.aConstraints.gridx += 1;
563
- oe.aConstraints.weighty = 0;
564
- oe.aConstraints.gridwidth = 1;
565
-
566
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
567
- clearPanelButton.addActionListener(this);
568
-
569
- oe.aConstraints.gridx += 1;
570
- oe.aConstraints.weighty = 0;
571
- oe.aConstraints.gridwidth = 1;
572
-
573
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
804
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
805
+ allParamsButton.setToolTipText("Show all controle");
574806 allParamsButton.addActionListener(this);
575807
576
- oe.aConstraints.gridx += 1;
577
- oe.aConstraints.weighty = 0;
578
- oe.aConstraints.gridwidth = 1;
579
-
580
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
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");
581814 unselectButton.addActionListener(this);
582815
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
+
583826 // oe.aConstraints.gridx += 1;
584827 // oe.aConstraints.weighty = 0;
585828 // oe.aConstraints.gridwidth = 1;
....@@ -591,40 +834,25 @@
591834 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
592835 // gcButton.addActionListener(this);
593836
594
- oe.aConstraints.gridx = 0;
595
- oe.aConstraints.gridy += 1;
596
-
597
- //ctrlPanel.add(objList = new List(5, true));
598
- oe.aConstraints.gridwidth = 100;
599
- // oe.aConstraints.gridheight = 100;
600
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
601
- oe.aConstraints.gridheight = 1;
602
- oe.aConstraints.weighty = 0.5;
603
- oe.aConstraints.gridx = 0;
604
- JScrollPane jSP;
837
+ cGridBag jSPPanel = new cGridBag();
838
+
839
+ JScrollPane jSP;
605840 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
606
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
841
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
607842 ResetModel();
608
- oe.aConstraints.weighty = 0.5;
609
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
610
- oe.aConstraints.gridy += 1;
611
- oe.aConstraints.gridwidth = 1;
612
-
613
- oe.aConstraints.weighty = 0;
614
- oe.aConstraints.gridwidth = 2;
615
-
616
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
617
- colorCB.addItemListener(this);
618
- oe.aConstraints.gridx += 2;
619
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
620
- materialCB.addItemListener(this);
621
- oe.aConstraints.gridx += 2;
622
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
623
- textureCB.addItemListener(this);
624
-
625
- oe.aConstraints.gridx = 0;
626
- oe.aConstraints.gridy += 1;
627843
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
+
628856 //jList.addListSelectionListener(this);
629857 oe.jTree.addTreeSelectionListener(this);
630858 //jTree.setRootVisible(false);
....@@ -646,10 +874,144 @@
646874 radio.layout = sevenButton;
647875 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
648876 }
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
+ }
6491003
6501004 void EditObject(Object3D obj)
6511005 {
6521006 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
+
6531015 radioButton.SetObject(obj);
6541016 radioButton.layout = sevenButton;
6551017 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -658,8 +1020,11 @@
6581020 buttonGroup.add(radioButton);
6591021 radioButton.doClick();
6601022 }
1023
+
6611024 void SetupViews(ObjEditor oe)
6621025 {
1026
+ theFrame = this;
1027
+
6631028 oe.SetupViews();
6641029
6651030 System.out.println("SetupViews");
....@@ -668,22 +1033,28 @@
6681033 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6691034 }
6701035
671
- JCheckBox liveCB;
672
- JCheckBox supportCB;
673
- JCheckBox localCB;
674
- JCheckBox crowdCB;
675
- JCheckBox smoothCB;
676
- JCheckBox fastCB;
677
- JCheckBox slowCB;
678
- JCheckBox boxCB;
679
- JCheckBox trackCB;
680
- JCheckBox smoothfocusCB;
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;
6811049 // JCheckBox speakerMocapCB;
682
- JCheckBox speakerCameraCB;
683
- JCheckBox speakerFocusCB;
684
- JCheckBox debugCB;
685
- JCheckBox oeilCB;
686
- JCheckBox lookAtCB;
1050
+ cCheckBox speakerCameraCB;
1051
+ cCheckBox speakerFocusCB;
1052
+ cCheckBox debugCB;
1053
+
1054
+ cCheckBox oeilCB;
1055
+ cCheckBox shadowCB;
1056
+ cCheckBox autokeepCB;
1057
+ cCheckBox lookAtCB;
6871058
6881059 // static int COLOR = 1;
6891060 // static int MATERIAL = 2;
....@@ -691,9 +1062,9 @@
6911062
6921063 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6931064
694
- JCheckBox colorCB;
695
- JCheckBox materialCB;
696
- JCheckBox textureCB;
1065
+ cCheckBox colorCB;
1066
+ cCheckBox materialCB;
1067
+ cCheckBox textureCB;
6971068
6981069 public void itemStateChanged(ItemEvent e)
6991070 {
....@@ -721,6 +1092,7 @@
7211092 } else if(e.getSource() == liveCB)
7221093 {
7231094 cameraView.ToggleLive();
1095
+ refreshContents(false);
7241096 }
7251097 else if(e.getSource() == supportCB)
7261098 {
....@@ -756,6 +1128,10 @@
7561128 cameraView.repaint();
7571129 // refreshContents();
7581130 }
1131
+ else if(e.getSource() == zoomBoxCB)
1132
+ {
1133
+ cameraView.ToggleZoomBoxMode();
1134
+ }
7591135 else if(e.getSource() == smoothfocusCB)
7601136 {
7611137 cameraView.ToggleSmoothFocus();
....@@ -781,6 +1157,18 @@
7811157 {
7821158 cameraView.ToggleOeil();
7831159 }
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
+ }
7841172 else if(e.getSource() == lookAtCB)
7851173 {
7861174 cameraView.ToggleLookAt();
....@@ -797,7 +1185,8 @@
7971185
7981186 /**/
7991187 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
800
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1188
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ TreePath path = objEditor.jTree.getSelectionPath();
8011190 if ((path == null) || (path.getPathCount() <= 1)) {
8021191 // We can't move the root node or an empty selection
8031192 return;
....@@ -860,8 +1249,6 @@
8601249 }
8611250 }
8621251
863
- String string = (String) object;
864
-
8651252 System.out.println("Transfer = " + object + "; drop : " + target);
8661253 // if( object instanceof java.io.File[])
8671254 // {
....@@ -869,7 +1256,11 @@
8691256 // objEditor.DropFile((java.io.File[]) object, true);
8701257 // return;
8711258 // }
872
- 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) == ':')
8731264 {
8741265 // file(s)
8751266 String[] names = string.split("\n");
....@@ -896,7 +1287,7 @@
8961287
8971288 flashIt = false;
8981289 CameraPane pane = (CameraPane) target;
899
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1290
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9001291 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9011292
9021293 if (group.selection.size() == 1)
....@@ -912,23 +1303,33 @@
9121303
9131304 assert target == objEditor.jTree;
9141305 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1306
+ Object3D destinationLeaf;
9151307 try {
916
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1308
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9171309 } catch (Exception e) {
9181310 System.out.println("destinationPath : " + destinationPath);
9191311 return;
9201312 }
9211313
922
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1314
+ for (int i=group.selection.size(); --i>=0;)
9231315 {
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
+// {
9241325 loadClipboard(true);
9251326 objEditor.jTree.setSelectionPath(destinationPath);
926
- pasteInto(false);
927
- } else {
928
- loadClipboard(false);
929
- objEditor.jTree.setSelectionPath(destinationPath);
930
- pasteInto(false); // true); // ???
931
- }
1327
+ pasteInto(false, false);
1328
+// } else {
1329
+// loadClipboard(false);
1330
+// objEditor.jTree.setSelectionPath(destinationPath);
1331
+// pasteInto(false, false); // true); // ???
1332
+// }
9321333 }
9331334 public void dropActionChanged(DropTargetDragEvent dtde)
9341335 // Called if the user has modified the current drop gesture
....@@ -1033,85 +1434,107 @@
10331434 {
10341435 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10351436 //heightFieldItem.addActionListener(this);
1036
- gridItem = menu.add(new MenuItem("Grid"));
1037
- gridItem.addActionListener(this);
1038
- rectoidItem = menu.add(new MenuItem("Box"));
1039
- rectoidItem.addActionListener(this);
1040
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1041
- ellipsoidItem.addActionListener(this);
1042
- coneItem = menu.add(new MenuItem("Cone"));
1043
- coneItem.addActionListener(this);
1044
- torusItem = menu.add(new MenuItem("Torus"));
1045
- torusItem.addActionListener(this);
1046
- superItem = menu.add(new MenuItem("Superellipsoid"));
1047
- superItem.addActionListener(this);
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
+ {
10481455 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10491456 kleinItem.addActionListener(this);
1050
- particleItem = menu.add(new MenuItem("Particle system"));
1051
- particleItem.addActionListener(this);
1457
+ }
1458
+
1459
+// particleItem = menu.add(new MenuItem("Particle system"));
1460
+// particleItem.addActionListener(this);
1461
+ if (Globals.ADVANCED)
1462
+ {
10521463 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10531464 ragdollItem.addActionListener(this);
10541465 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10551466 ragdoll2Item.addActionListener(this);
1467
+ }
10561468 menu.add("-");
1057
- meshItem = menu.add(new MenuItem("Mesh"));
1469
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10581470 meshItem.addActionListener(this);
10591471 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10601472 // meshGroupItem.addActionListener(this);
1473
+ if (Globals.ADVANCED)
1474
+ {
10611475 springItem = menu.add(new MenuItem("Spring"));
10621476 springItem.addActionListener(this);
10631477 flagItem = menu.add(new MenuItem("Flag"));
10641478 flagItem.addActionListener(this);
1065
- bezierItem = menu.add(new MenuItem("Patch"));
1066
- bezierItem.addActionListener(this);
1067
- checkerItem = menu.add(new MenuItem("Checker"));
1068
- checkerItem.addActionListener(this);
10691479 blobItem = menu.add(new MenuItem("Blob"));
10701480 blobItem.addActionListener(this);
10711481 latheItem = menu.add(new MenuItem("Lathe"));
10721482 latheItem.addActionListener(this);
1073
- lightItem = menu.add(new MenuItem("Light"));
1074
- 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);
10751490 menu.add("-");
10761491 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10771492 //superLoopItem.addActionListener(this);
1078
- loopItem = menu.add(new MenuItem("Loop"));
1079
- loopItem.addActionListener(this);
1493
+// loopItem = menu.add(new MenuItem("Loop"));
1494
+// loopItem.addActionListener(this);
10801495 doubleItem = menu.add(new MenuItem("Fork"));
10811496 doubleItem.addActionListener(this);
1497
+ if (Globals.ADVANCED)
1498
+ {
10821499 tripleItem = menu.add(new MenuItem("Trident"));
10831500 tripleItem.addActionListener(this);
1501
+ }
10841502 }
10851503
10861504 void buildToolsMenu(Menu menu)
10871505 {
10881506 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10891507 animationItem.addItemListener(this);
1090
- animationItem.setState(CameraPane.ANIMATION);
1508
+ animationItem.setState(Globals.ANIMATION);
1509
+
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
10911512
10921513 menu.add("-");
10931514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10941515 parseverticesItem.addActionListener(this);
10951516 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10961517 textureFieldItem.addActionListener(this);
1097
- alignItem = menu.add(new MenuItem("Align"));
1518
+ alignItem = menu.add(new MenuItem("Align Objects"));
10981519 alignItem.addActionListener(this);
1099
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1100
- mirrorItem.addActionListener(this);
11011520 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11021521 reduceMorphItem.addActionListener(this);
11031522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11041523 reduce34MorphItem.addActionListener(this);
1105
-
1106
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1107
- computeAOItem.addActionListener(this);
11081524 menu.add("-");
1109
-
11101525 menu.add(memoryItem = new MenuItem("Memory Usage"));
11111526 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("-");
11121535 menu.add(analyzeItem = new MenuItem("Analyze"));
11131536 analyzeItem.addActionListener(this);
1114
- menu.add(dumpItem = new MenuItem("Dump"));
1537
+ menu.add(dumpItem = new MenuItem("Print"));
11151538 dumpItem.addActionListener(this);
11161539 // menu.add(pathItem = new MenuItem("From-to path"));
11171540 // pathItem.addActionListener(this);
....@@ -1120,6 +1543,8 @@
11201543 resetParentItem.addActionListener(this);
11211544 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11221545 repairParentItem.addActionListener(this);
1546
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1547
+ repairShadowItem.addActionListener(this);
11231548 menu.add(invariantsItem = new MenuItem("Invariants"));
11241549 invariantsItem.addActionListener(this);
11251550 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1127,6 +1552,7 @@
11271552 menu.add("-");
11281553 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11291554 editScriptItem.addActionListener(this);
1555
+ }
11301556 }
11311557
11321558 void ScreenFit()
....@@ -1249,9 +1675,24 @@
12491675 shadow.material = new cMaterial(obj.material);
12501676 shadow.material.diffuse = 0.0001f;
12511677 shadow.material.specular = 0.0001f;
1678
+ //shadow.projectedVertices[1].x = 300;
12521679
12531680 makeSomething(shadow);
12541681 }
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
+ }
12551696
12561697 /**
12571698 * applyExample
....@@ -1455,9 +1896,9 @@
14551896
14561897 void Overwrite(int mask)
14571898 {
1458
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1899
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14591900 {
1460
- Object3D content = GrafreeD.clipboard.get(0);
1901
+ Object3D content = Grafreed.clipboard.get(0);
14611902
14621903 if (content instanceof cGroup && ((cGroup)content).transientlink )
14631904 content = ((cGroup)content).get(0);
....@@ -1480,6 +1921,7 @@
14801921 //
14811922 public void actionPerformed(ActionEvent event) // , Object arg)
14821923 {
1924
+ Object source = event.getSource();
14831925 /*
14841926 if (event.getSource() == nameField)
14851927 {
....@@ -1491,11 +1933,11 @@
14911933 }
14921934 else
14931935 */
1494
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1936
+ if (source == lookAtItem || source == lookFromItem)
14951937 {
14961938 ScreenFit();
14971939 } else
1498
- if (event.getSource() == switchItem)
1940
+ if (source == switchViewItem)
14991941 {
15001942 cVector v1 = new cVector();
15011943 cVector v2 = new cVector();
....@@ -1504,11 +1946,11 @@
15041946 objEditor.cameraView.renderCamera.setAim(v2, v1);
15051947 objEditor.cameraView.repaint();
15061948 } else
1507
- if (event.getSource() == rectoidItem)
1949
+ if (source == rectoidItem || source == boxButton)
15081950 {
15091951 makeSomething(new Box());
15101952 } else
1511
- if (event.getSource() == particleItem)
1953
+ if (source == particleItem || source == particlesButton)
15121954 {
15131955 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15141956 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1529,9 +1971,9 @@
15291971 applyExample(particleGeom, "SMOKE");
15301972 makeSomething(particleGeom);
15311973 } else
1532
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1974
+ if (source == ragdollItem || source == ragdoll2Item)
15331975 {
1534
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1976
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15351977
15361978 ragdoll.toParent = LA.newMatrix();
15371979 ragdoll.fromParent = LA.newMatrix();
....@@ -1549,7 +1991,7 @@
15491991 } else
15501992 /*
15511993 */
1552
- if (event.getSource() == heightFieldItem)
1994
+ if (source == heightFieldItem)
15531995 {
15541996 Object3D obj = new Object3D();
15551997
....@@ -1587,31 +2029,31 @@
15872029
15882030 makeSomething(obj);
15892031 } else
1590
- if (event.getSource() == gridItem)
2032
+ if (source == gridItem || source == gridButton)
15912033 {
15922034 makeSomething(new Grid());
15932035 } else
1594
- if (event.getSource() == ellipsoidItem)
2036
+ if (source == ellipsoidItem || source == sphereButton)
15952037 {
15962038 makeSomething(new Sphere());
15972039 } else
1598
- if (event.getSource() == coneItem)
2040
+ if (source == coneItem || source == coneButton)
15992041 {
16002042 makeSomething(new Cone());
16012043 } else
1602
- if (event.getSource() == torusItem)
2044
+ if (source == torusItem || source == torusButton)
16032045 {
16042046 makeSomething(new Torus());
16052047 } else
1606
- if (event.getSource() == superItem)
2048
+ if (source == superItem || source == superButton)
16072049 {
16082050 makeSomething(new Superellipsoid());
16092051 } else
1610
- if (event.getSource() == kleinItem)
2052
+ if (source == kleinItem || source == kleinButton)
16112053 {
16122054 makeSomething(new Klein());
16132055 } else
1614
- if (event.getSource() == blobItem)
2056
+ if (source == blobItem)
16152057 {
16162058 Blob blob = new Blob();
16172059 BlobComponent comp = new BlobComponent();
....@@ -1619,15 +2061,15 @@
16192061 //blob.retile();
16202062 makeSomething(blob);
16212063 } else
1622
- if (event.getSource() == latheItem)
2064
+ if (source == latheItem)
16232065 {
16242066 makeSomething(new Lathe());
16252067 } else
1626
- if (event.getSource() == bezierItem)
2068
+ if (source == bezierItem)
16272069 {
16282070 makeSomething(new BezierSurface());
16292071 } else
1630
- if (event.getSource() == checkerItem)
2072
+ if (source == overlayItem || source == overlayButton)
16312073 {
16322074 /*
16332075 Object3D obj = new BezierSurface(5,8);
....@@ -1642,7 +2084,7 @@
16422084 */
16432085 makeSomething(new Checker());
16442086 } else
1645
- if (event.getSource() == meshItem)
2087
+ if (source == meshItem)
16462088 {
16472089 Object3D itemtomake = new Object3D();
16482090 Object3D child;
....@@ -1663,35 +2105,35 @@
16632105 makeSomething(child);
16642106 }
16652107 } else
1666
- if (event.getSource() == springItem)
2108
+ if (source == springItem)
16672109 {
16682110 cSpring s = new cSpring();
16692111 s.setup();
16702112 makeSomething(s);
16712113 } else
1672
- if (event.getSource() == flagItem)
2114
+ if (source == flagItem)
16732115 {
16742116 cSpring s = new cFlag();
16752117 s.setup();
16762118 makeSomething(s);
16772119 } else
1678
- if (event.getSource() == lightItem)
2120
+ if (source == lightItem || source == lightButton)
16792121 {
16802122 makeSomething(new Light());
16812123 } else
1682
- if (event.getSource() == csgItem)
2124
+ if (source == csgItem)
16832125 {
16842126 group(new CSG());
16852127 } else
1686
- if (event.getSource() == templateItem)
2128
+ if (source == templateItem)
16872129 {
16882130 group(new cTemplate());
16892131 } else
1690
- if (event.getSource() == attributeItem)
2132
+ if (source == attributeItem)
16912133 {
16922134 makeSomething(new Attribute());
16932135 } else
1694
- if (event.getSource() == pointflowItem)
2136
+ if (source == pointflowItem)
16952137 {
16962138 makeSomething(new PointFlow());
16972139 } else
....@@ -1703,7 +2145,7 @@
17032145 } else
17042146 */
17052147
1706
- if (event.getSource() == superLoopItem)
2148
+ if (source == superLoopItem)
17072149 {
17082150 Composite g = new cGroup();
17092151 for (int i=0; i<15; i++)
....@@ -1725,30 +2167,30 @@
17252167
17262168 group(g);
17272169 } else
1728
- if (event.getSource() == loopItem)
2170
+ if (source == loopItem || source == loopButton)
17292171 {
17302172 Composite csg = new GroupLeaf();
17312173 csg.count = 5;
17322174 group(csg);
1733
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
17342176 csg.addChild(child);
17352177 child.addChild(csg);
17362178 } else
1737
- if (event.getSource() == doubleItem)
2179
+ if (source == doubleItem)
17382180 {
1739
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
17402182 csg.count = 5;
17412183 group(csg);
1742
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
17432185 csg.addChild(child);
17442186 child.addChild(csg);
1745
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
17462188 csg.addChild(child);
17472189 child.addChild(csg);
17482190 } else
1749
- if (event.getSource() == tripleItem)
2191
+ if (source == tripleItem)
17502192 {
1751
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
17522194 csg.count = 4;
17532195 group(csg);
17542196 Composite child = new cGroup();
....@@ -1761,73 +2203,98 @@
17612203 csg.addChild(child);
17622204 child.addChild(csg);
17632205 } else
1764
-
1765
- if (event.getSource() == importGFDItem)
2206
+ if (source == computeAOItem)
17662207 {
1767
- ImportGFD();
2208
+ Globals.drawMode = CameraPane.OCCLUSION;
2209
+ Globals.theRenderer.repaint();
17682210 } else
1769
- if (event.getSource() == importVRMLX3DItem)
1770
- {
1771
- ImportVRMLX3D();
1772
- } else
1773
- if (event.getSource() == import3DSItem)
1774
- {
1775
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1776
- } else
1777
- if (event.getSource() == importOBJItem)
1778
- {
1779
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1780
- } else
1781
- if (event.getSource() == computeAOItem)
1782
- {
1783
- CameraPane.drawMode = CameraPane.OCCLUSION;
1784
- CameraPane.theRenderer.repaint();
1785
- } else
1786
- if (event.getSource() == recompileItem)
2211
+ if (source == recompileItem)
17872212 {
17882213 Recompile();
17892214 refreshContents();
17902215 } else
1791
- if (event.getSource() == editScriptItem)
2216
+ if (source == editScriptItem)
17922217 {
17932218 OpenDialog();
17942219 refreshContents();
17952220 } else
1796
- if (event.getSource() == invariantsItem)
2221
+ if (source == invariantsItem)
17972222 {
17982223 System.out.println("Invariants:");
1799
- GrafreeD.grafreeD.universe.invariants();
2224
+ Grafreed.grafreeD.universe.invariants();
18002225 } else
1801
- if (event.getSource() == memoryItem)
2226
+ if (source == memoryItem)
18022227 {
18032228 //System.out.println("Invariants:");
18042229 PrintMemory();
18052230 } else
1806
- if (event.getSource() == pathItem)
2231
+ if (source == pathItem)
18072232 {
18082233 PrintPath();
18092234 } else
1810
- if (event.getSource() == analyzeItem)
2235
+ if (source == analyzeItem)
18112236 {
18122237 AnalyzeObject();
18132238 } else
1814
- if (event.getSource() == dumpItem)
2239
+ if (source == dumpItem)
18152240 {
18162241 DumpObject();
18172242 } else
1818
- if (event.getSource() == screenfitButton)
2243
+ if (source == minButton)
18192244 {
1820
- //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
+ {
18212290 ScreenFit();
18222291 } else
1823
- if (event.getSource() == screenfitpointButton)
2292
+ if (source == screenfitpointButton)
18242293 {
1825
- //Reload(lastConverter, lastFilename, true);
18262294 ScreenFitPoint();
18272295 } else
1828
- if (event.getSource() == snapobjectButton)
2296
+ if (source == snapobjectButton)
18292297 {
1830
- //Reload(lastConverter, lastFilename, true);
18312298 SnapObject();
18322299 } else
18332300 // if (event.getSource() == recompileButton)
....@@ -1836,13 +2303,13 @@
18362303 // Recompile();
18372304 // refreshContents();
18382305 // } else
1839
- if (event.getSource() == gcButton)
2306
+ if (source == gcButton)
18402307 {
18412308 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18422309 System.gc();
18432310 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18442311 } else
1845
- if (event.getSource() == editLeafItem)
2312
+ if (source == editLeafItem)
18462313 {
18472314 Object3D obj;
18482315 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1856,62 +2323,74 @@
18562323 }
18572324 refreshContents(true);
18582325 } else
1859
- if (event.getSource() == openWindowItem)
2326
+ if (source == openWindowItem)
18602327 {
18612328 EditSelection(true);
18622329 } else
1863
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2330
+ if (source == cutItem || source == clearButton)
18642331 {
18652332 loadClipboard(true);
18662333 } else
1867
- if (event.getSource() == duplicateItem)
2334
+ if (source == undoItem)
18682335 {
1869
- 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;
18702345 loadClipboard(false);
18712346 paste(false);
1872
- GrafreeD.clipboard = keep;
2347
+ Grafreed.clipboard = keep;
18732348 } else
1874
- if (event.getSource() == cloneItem)
2349
+ if (source == cloneItem)
18752350 {
18762351 CloneSelection(false);
18772352 } else
1878
- if (event.getSource() == cloneSupportItem)
2353
+ if (source == cloneSupportItem)
18792354 {
18802355 CloneSelection(true);
18812356 } else
1882
- if (event.getSource() == copyItem)
2357
+ if (source == copyItem)
18832358 {
18842359 loadClipboard(false);
18852360 } else
1886
- if (event.getSource() == pasteItem)
2361
+ if (source == pasteItem)
18872362 {
18882363 paste(false);
18892364 } else
1890
- if (event.getSource() == pasteLinkItem)
2365
+ if (source == pasteIntoItem)
18912366 {
1892
- pasteInto(false);
2367
+ pasteInto(true, false);
18932368 } else
1894
- if (event.getSource() == pasteCloneItem)
2369
+ if (source == pasteLinkItem)
18952370 {
1896
- pasteInto(true);
2371
+ pasteInto(false, false);
18972372 } else
1898
- if (event.getSource() == pasteExpandItem)
2373
+ if (source == pasteCloneItem)
2374
+ {
2375
+ pasteInto(true, true);
2376
+ } else
2377
+ if (source == pasteExpandItem)
18992378 {
19002379 paste(true);
19012380 } else
1902
- if (event.getSource() == synchronizeItem)
2381
+ if (source == synchronizeItem)
19032382 {
19042383 Overwrite(Object3D.TRANSFORM);
19052384 } else
1906
- if (event.getSource() == overwriteNameItem)
2385
+ if (source == overwriteNameItem)
19072386 {
19082387 Overwrite(Object3D.NAME);
19092388 } else
1910
- if (event.getSource() == overwriteUVItem)
2389
+ if (source == overwriteUVItem)
19112390 {
19122391 Overwrite(Object3D.UV);
19132392 } else
1914
- if (event.getSource() == overwriteMatItem)
2393
+ if (source == overwriteMatItem)
19152394 {
19162395 /* july 2015
19172396 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1931,7 +2410,7 @@
19312410
19322411 Overwrite(dropAttributes);
19332412 }
1934
- if (event.getSource() == overwriteGeoItem)
2413
+ if (source == overwriteGeoItem)
19352414 {
19362415 Overwrite(Object3D.GEOMETRY);
19372416 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1948,7 +2427,7 @@
19482427 // refreshContents();
19492428 // }
19502429 } else
1951
- if (event.getSource() == generateMeshItem)
2430
+ if (source == generateMeshItem)
19522431 {
19532432 //if (group.selection.size() == 1)
19542433 // for (int i=0; i<group.selection.size(); i++)
....@@ -1959,7 +2438,7 @@
19592438 ResetModel();
19602439 refreshContents();
19612440 } else
1962
- if (event.getSource() == extractGeometriesItem)
2441
+ if (source == extractGeometriesItem)
19632442 {
19642443 boolean one = false;
19652444
....@@ -1986,7 +2465,7 @@
19862465 ResetModel();
19872466 refreshContents();
19882467 } else
1989
- if (event.getSource() == cloneGeometriesItem)
2468
+ if (source == cloneGeometriesItem)
19902469 {
19912470 boolean one = false;
19922471
....@@ -2012,7 +2491,7 @@
20122491 ResetModel();
20132492 refreshContents();
20142493 } else
2015
- if (event.getSource() == shareGeometriesItem)
2494
+ if (source == shareGeometriesItem)
20162495 {
20172496 boolean one = false;
20182497
....@@ -2042,7 +2521,7 @@
20422521 refreshContents();
20432522 }
20442523 } else
2045
- if (event.getSource() == mergeGeometriesItem)
2524
+ if (source == mergeGeometriesItem)
20462525 {
20472526 boolean one = false;
20482527
....@@ -2072,7 +2551,7 @@
20722551 ResetModel();
20732552 refreshContents();
20742553 } else
2075
- if (event.getSource() == linkverticesItem)
2554
+ if (source == linkverticesItem)
20762555 {
20772556 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20782557 // {
....@@ -2085,48 +2564,48 @@
20852564 // group.selection.get(0).setMasterThis(content); // should be identity
20862565 // refreshContents();
20872566 // }
2088
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2567
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20892568 {
2090
- Object3D content = GrafreeD.clipboard.get(0);
2569
+ Object3D content = Grafreed.clipboard.get(0);
20912570
20922571 if (content instanceof cGroup && ((cGroup)content).transientlink )
20932572 content = ((cGroup)content).get(0);
20942573
2095
- 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));
20962575 for (int i=0; i<group.selection.size(); i++)
20972576 {
2098
- boolean random = CameraPane.RANDOM;
2099
- CameraPane.RANDOM = false; // parse all random nodes
2577
+ boolean random = CameraPane.SWITCH;
2578
+ CameraPane.SWITCH = false; // parse all random nodes
21002579 group.selection.get(i).linkVerticesThis(content);
21012580 // group.selection.get(i).setMasterThis(content); // should be identity
2102
- CameraPane.RANDOM = random;
2581
+ CameraPane.SWITCH = random;
21032582 }
2104
- 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));
21052584 refreshContents();
21062585 }
21072586 } else
2108
- if (event.getSource() == resetsupportItem)
2587
+ if (source == resetsupportItem)
21092588 {
21102589 for (int i=0; i<group.selection.size(); i++)
21112590 {
2112
- boolean random = CameraPane.RANDOM;
2113
- CameraPane.RANDOM = false; // parse all random nodes
2591
+ boolean random = CameraPane.SWITCH;
2592
+ CameraPane.SWITCH = false; // parse all random nodes
21142593 group.selection.get(i).linkVerticesThis(null);
2115
- CameraPane.RANDOM = random;
2594
+ CameraPane.SWITCH = random;
21162595 }
21172596
21182597 refreshContents();
21192598 } else
2120
- if (event.getSource() == relinkverticesItem)
2599
+ if (source == relinkverticesItem)
21212600 {
2122
- boolean random = CameraPane.RANDOM;
2123
- CameraPane.RANDOM = false; // parse all random nodes
2601
+ boolean random = CameraPane.SWITCH;
2602
+ CameraPane.SWITCH = false; // parse all random nodes
21242603 group.selection.RelinkToSupport();
2125
- CameraPane.RANDOM = random;
2604
+ CameraPane.SWITCH = random;
21262605
21272606 refreshContents();
21282607 } else
2129
- if (event.getSource() == resetreferencesItem)
2608
+ if (source == resetreferencesItem)
21302609 {
21312610 for (int i=0; i<group.selection.size(); i++)
21322611 {
....@@ -2135,11 +2614,11 @@
21352614
21362615 refreshContents();
21372616 } else
2138
- if (event.getSource() == setMasterItem)
2617
+ if (source == setMasterItem)
21392618 {
2140
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2619
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21412620 {
2142
- Object3D content = GrafreeD.clipboard.get(0);
2621
+ Object3D content = Grafreed.clipboard.get(0);
21432622
21442623 if (content instanceof cGroup && ((cGroup)content).transientlink )
21452624 content = ((cGroup)content).get(0);
....@@ -2148,13 +2627,13 @@
21482627 refreshContents();
21492628 }
21502629 } else
2151
- if (event.getSource() == poseMeshItem)
2630
+ if (source == poseMeshItem)
21522631 {
21532632 if (group.selection.size() == 1)
21542633 {
2155
- if (GrafreeD.clipboard.size() == 1)
2634
+ if (Grafreed.clipboard.size() == 1)
21562635 {
2157
- Object3D content = GrafreeD.clipboard.get(0);
2636
+ Object3D content = Grafreed.clipboard.get(0);
21582637
21592638 if (content instanceof cGroup && ((cGroup)content).transientlink )
21602639 content = ((cGroup)content).get(0);
....@@ -2167,19 +2646,19 @@
21672646 }
21682647
21692648 } else
2170
- if (event.getSource() == revertMeshItem)
2649
+ if (source == revertMeshItem)
21712650 {
21722651 RevertMeshes();
21732652 } else
2174
- if (event.getSource() == resetMeshItem)
2653
+ if (source == resetAllItem)
21752654 {
21762655 ResetAll();
21772656 } else
2178
- if (event.getSource() == stepAllItem)
2657
+ if (source == stepAllItem)
21792658 {
21802659 StepAll();
21812660 } else
2182
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2661
+ if (source == clearItem) // || event.getSource() == clearButton)
21832662 {
21842663 //int indices[] = jList.getSelectedIndices();
21852664 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2187,46 +2666,46 @@
21872666
21882667 ClearSelection(false);
21892668 } else
2190
- if (event.getSource() == clearAllItem)
2669
+ if (source == clearAllItem)
21912670 {
21922671 ClearSelection(true);
21932672 } else
2194
- if (event.getSource() == grabItem)
2673
+ if (source == grabItem || source == groupButton)
21952674 {
2196
- group(new cGroup(), true);
2675
+ group(new cGroup(), false); // true);
21972676 } else
2198
- if (event.getSource() == hideItem)
2677
+ if (source == hideItem)
21992678 {
22002679 group(new HiddenObject());
22012680 } else
2202
- if (event.getSource() == frontItem)
2681
+ if (source == frontItem)
22032682 {
22042683 front();
22052684 } else
2206
- if (event.getSource() == backItem)
2685
+ if (source == backItem)
22072686 {
22082687 back();
22092688 } else
2210
- if (event.getSource() == cameraItem)
2689
+ if (source == cameraItem)
22112690 {
22122691 makeSomething(new Camera());
22132692 } else
2214
- if (event.getSource() == compositeItem)
2693
+ if (source == compositeItem || source == compositeButton)
22152694 {
22162695 group(new Composite());
22172696 } else
2218
- if (event.getSource() == randomItem)
2697
+ if (source == switchItem || source == switchButton)
22192698 {
22202699 RandomNode random = new RandomNode();
22212700 group(random);
22222701 if (random.size() > 0)
2223
- random.name = random.get(0).name + "Rnd";
2702
+ random.name = random.get(0).name + "Switch";
22242703 } else
2225
- if (event.getSource() == physicsItem)
2704
+ if (source == physicsItem)
22262705 {
22272706 group(new PhysicsNode());
22282707 } else
2229
- if (event.getSource() == frameselectorItem)
2708
+ if (source == frameselectorItem)
22302709 {
22312710 for (int i=0; i<group.selection.size(); i++)
22322711 {
....@@ -2238,7 +2717,7 @@
22382717 ResetModel();
22392718 refreshContents();
22402719 } else
2241
- if (event.getSource() == switchGeoItem)
2720
+ if (source == switchGeoItem)
22422721 {
22432722 for (int i=0; i<group.selection.size(); i++)
22442723 {
....@@ -2250,7 +2729,7 @@
22502729 ResetModel();
22512730 refreshContents();
22522731 } else
2253
- if (event.getSource() == switchTransfoItem)
2732
+ if (source == switchTransfoItem)
22542733 {
22552734 for (int i=0; i<group.selection.size(); i++)
22562735 {
....@@ -2262,7 +2741,7 @@
22622741 ResetModel();
22632742 refreshContents();
22642743 } else
2265
- if (event.getSource() == morphItem)
2744
+ if (source == morphItem)
22662745 {
22672746 for (int i=0; i<group.selection.size(); i++)
22682747 {
....@@ -2274,7 +2753,7 @@
22742753 ResetModel();
22752754 refreshContents();
22762755 } else
2277
- if (event.getSource() == scriptNodeItem)
2756
+ if (source == scriptNodeItem)
22782757 {
22792758 boolean atleastone = false;
22802759
....@@ -2313,215 +2792,252 @@
23132792 }
23142793 }
23152794 } else
2316
- if (event.getSource() == linkerItem)
2795
+ if (source == linkerItem)
23172796 {
23182797 group(new cLinker());
23192798 } else
2320
- if (event.getSource() == textureItem)
2799
+ if (source == textureItem || source == textureButton)
23212800 {
23222801 group(new TextureNode());
23232802 } else
2324
- if (event.getSource() == billboardItem)
2803
+ if (source == billboardItem)
23252804 {
23262805 group(new BillboardNode());
23272806 } else
2328
- if (event.getSource() == shadowXItem)
2807
+ if (source == shadowXItem)
23292808 {
23302809 CastShadow(0);
23312810 } else
2332
- if (event.getSource() == shadowYItem)
2811
+ if (source == shadowYItem)
23332812 {
23342813 CastShadow(1);
23352814 } else
2336
- if (event.getSource() == shadowZItem)
2815
+ if (source == shadowZItem)
23372816 {
23382817 CastShadow(2);
23392818 } else
2340
- if (event.getSource() == ungroupItem)
2819
+ if (source == ungroupItem || source == ungroupButton)
23412820 {
2342
- //ungroup();
2821
+ boolean hasRoot = false;
2822
+
23432823 for (int i=0; i<group.selection.size(); i++)
23442824 {
2345
- Ungroup(group.selection.get(i));
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
23462830 }
23472831
2348
- ClearSelection(false);
2349
-
2350
- refreshContents();
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
+ }
23512843 } else
2352
- if (event.getSource() == genUVItem)
2844
+ if (source == genUVItem)
23532845 {
23542846 GenUV();
23552847 } else
2356
- if (event.getSource() == genNormalsCADItem)
2848
+ if (source == genNormalsCADItem)
23572849 {
23582850 GenNormals(true);
23592851 } else
2360
- if (event.getSource() == genNormalsMESHItem)
2852
+ if (source == genNormalsMESHItem)
23612853 {
2362
- GenNormals(true); // TODO
2854
+ GenNormalsMESH();
23632855 } else
2364
- if (event.getSource() == genNormalsORGANItem)
2856
+ if (source == genNormalsORGANItem)
23652857 {
23662858 GenNormals(false);
23672859 } else
2368
- if (event.getSource() == genNormalsMINEItem)
2860
+ if (source == genNormalsMINEItem)
23692861 {
23702862 GenNormalsMINE();
23712863 } else
2372
- if (event.getSource() == stripifyItem)
2864
+ if (source == stripifyItem)
23732865 {
23742866 Stripify();
23752867 } else
2376
- if (event.getSource() == unstripifyItem)
2868
+ if (source == unstripifyItem)
23772869 {
23782870 Unstripify();
23792871 } else
2380
- if (event.getSource() == trimItem)
2872
+ if (source == trimItem)
23812873 {
23822874 Trim();
23832875 } else
2384
- if (event.getSource() == untrimItem)
2876
+ if (source == untrimItem)
23852877 {
23862878 Untrim();
23872879 } else
2388
- if (event.getSource() == clearColorsItem)
2880
+ if (source == clearColorsItem)
23892881 {
23902882 ClearColors();
23912883 } else
2392
- if (event.getSource() == clearMaterialsItem)
2884
+ if (source == clearMaterialsItem)
23932885 {
23942886 ClearMaterials();
23952887 } else
2396
- if (event.getSource() == liveleavesItem)
2888
+ if (source == liveleavesItem)
23972889 {
23982890 LiveLeaves(true);
23992891 } else
2400
- if (event.getSource() == unliveleavesItem)
2892
+ if (source == unliveleavesItem)
24012893 {
24022894 LiveLeaves(false);
24032895 } else
2404
- if (event.getSource() == supportleavesItem)
2896
+ if (source == supportleavesItem)
24052897 {
24062898 SupportLeaves(true);
24072899 } else
2408
- if (event.getSource() == unsupportleavesItem)
2900
+ if (source == unsupportleavesItem)
24092901 {
24102902 SupportLeaves(false);
24112903 } else
2412
- if (event.getSource() == hideleavesItem)
2904
+ if (source == hideleavesItem)
24132905 {
24142906 HideLeaves(true);
24152907 } else
2416
- if (event.getSource() == showleavesItem)
2908
+ if (source == showleavesItem)
24172909 {
24182910 HideLeaves(false);
24192911 } else
2420
- if (event.getSource() == markleavesItem)
2912
+ if (source == markleavesItem)
24212913 {
24222914 MarkLeaves(true);
24232915 } else
2424
- if (event.getSource() == unmarkleavesItem)
2916
+ if (source == unmarkleavesItem)
24252917 {
24262918 MarkLeaves(false);
24272919 } else
2428
- 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)
24292937 {
24302938 FlipV(true);
24312939 } else
2432
- if (event.getSource() == unflipVItem)
2940
+ if (source == unflipVItem)
24332941 {
24342942 FlipV(false);
24352943 } else
2436
- if (event.getSource() == lowTexturesItem)
2944
+ if (source == lowTexturesItem)
24372945 {
24382946 SetTexRes(0);
24392947 } else
2440
- if (event.getSource() == normalTexturesItem)
2948
+ if (source == normalTexturesItem)
24412949 {
24422950 SetTexRes(1);
24432951 } else
2444
- if (event.getSource() == highTexturesItem)
2952
+ if (source == highTexturesItem)
24452953 {
24462954 SetTexRes(2);
24472955 } else
2448
- if (event.getSource() == veryhighTexturesItem)
2956
+ if (source == veryhighTexturesItem)
24492957 {
24502958 SetTexRes(3);
24512959 } else
2452
- if (event.getSource() == maxTexturesItem)
2960
+ if (source == maxTexturesItem)
24532961 {
24542962 SetTexRes(4);
24552963 } else
2456
- if (event.getSource() == panoTexturesItem)
2964
+ if (source == panoTexturesItem)
24572965 {
24582966 SetTexRes(5);
24592967 } else
2460
- if (event.getSource() == reverseNormalsItem)
2968
+ if (source == reverseNormalsItem)
24612969 {
24622970 ReverseNormals();
24632971 } else
2464
- if (event.getSource() == parseverticesItem)
2972
+ if (source == parseverticesItem)
24652973 {
24662974 ParseVertices();
24672975 } else
2468
- if (event.getSource() == textureFieldItem)
2976
+ if (source == textureFieldItem)
24692977 {
24702978 TextureVertices();
24712979 } else
2472
- if (event.getSource() == alignItem)
2980
+ if (source == alignItem)
24732981 {
24742982 Align();
24752983 } else
2476
- if (event.getSource() == mirrorItem)
2984
+ if (source == mirrorItem)
24772985 {
24782986 MirrorPoses();
24792987 } else
2480
- if (event.getSource() == reduceMorphItem)
2988
+ if (source == reduceMorphItem)
24812989 {
24822990 MeshReduction(false);
24832991 } else
2484
- if (event.getSource() == reduce34MorphItem)
2992
+ if (source == reduce34MorphItem)
24852993 {
24862994 MeshReduction(true);
24872995 } else
2488
- if (event.getSource() == reverseTrianglesItem)
2996
+ if (source == reverseTrianglesItem)
24892997 {
24902998 ReverseTriangles();
24912999 } else
2492
- if (event.getSource() == reduceMeshItem)
3000
+ if (source == reduceMeshItem)
24933001 {
24943002 ReduceMesh(false);
24953003 } else
2496
- if (event.getSource() == reduce34MeshItem)
3004
+ if (source == reduce34MeshItem)
24973005 {
24983006 ReduceMesh(true);
24993007 } else
2500
- if (event.getSource() == increaseMeshItem)
3008
+ if (source == increaseMeshItem)
25013009 {
25023010 IncreaseMesh();
25033011 } else
2504
- if (event.getSource() == clipMeshItem)
3012
+ if (source == clipMeshItem)
25053013 {
25063014 ClipMesh();
25073015 } else
2508
- if (event.getSource() == smoothMeshItem)
3016
+ if (source == smoothMeshItem)
25093017 {
25103018 SmoothMesh();
25113019 } else
2512
- if (event.getSource() == transformgeometryItem)
3020
+ if (source == transformGeometryItem)
25133021 {
25143022 TransformGeometry();
25153023 } else
2516
- if (event.getSource() == resetTransformItem)
3024
+ if (source == transformChildrenItem)
3025
+ {
3026
+ TransformChildren();
3027
+ } else
3028
+ if (source == resetTransformItem)
25173029 {
25183030 ResetTransform();
25193031 } else
2520
- if (event.getSource() == resetCentroidItem)
3032
+ if (source == resetCentroidItem)
25213033 {
2522
- ResetCentroid();
3034
+ ResetCentroid(true);
25233035 } else
2524
- if (event.getSource() == resetParentItem)
3036
+ if (source == resetCentroidXZItem)
3037
+ {
3038
+ ResetCentroid(false);
3039
+ } else
3040
+ if (source == resetParentItem)
25253041 {
25263042 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25273043 {
....@@ -2531,7 +3047,7 @@
25313047
25323048 refreshContents();
25333049 } else
2534
- if (event.getSource() == repairParentItem)
3050
+ if (source == repairParentItem)
25353051 {
25363052 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25373053 {
....@@ -2545,7 +3061,21 @@
25453061
25463062 refreshContents();
25473063 } else
2548
- 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)
25493079 {
25503080 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25513081 {
....@@ -2557,7 +3087,7 @@
25573087 ResetModel();
25583088 refreshContents();
25593089 } else
2560
- if (event.getSource() == sortbynameItem)
3090
+ if (source == sortbynameItem)
25613091 {
25623092 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25633093 {
....@@ -2569,7 +3099,7 @@
25693099 ResetModel();
25703100 refreshContents();
25713101 } else
2572
- if (event.getSource() == attachPigmentItem)
3102
+ if (source == attachPigmentItem)
25733103 {
25743104 String texture = GetFile("Attach pigment");
25753105 Object3D obj;
....@@ -2581,7 +3111,7 @@
25813111
25823112 refreshContents();
25833113 } else
2584
- if (event.getSource() == detachPigmentItem)
3114
+ if (source == detachPigmentItem)
25853115 {
25863116 Object3D obj;
25873117 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2592,7 +3122,7 @@
25923122
25933123 refreshContents();
25943124 } else
2595
- if (event.getSource() == attachBumpItem)
3125
+ if (source == attachBumpItem)
25963126 {
25973127 String texture = GetFile("Attach bump");
25983128 Object3D obj;
....@@ -2604,7 +3134,7 @@
26043134
26053135 refreshContents();
26063136 } else
2607
- if (event.getSource() == detachBumpItem)
3137
+ if (source == detachBumpItem)
26083138 {
26093139 Object3D obj;
26103140 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2615,7 +3145,7 @@
26153145
26163146 refreshContents();
26173147 } else
2618
- if (event.getSource() == pigmentBumpItem)
3148
+ if (source == pigmentBumpItem)
26193149 {
26203150 Object3D obj;
26213151 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2626,158 +3156,237 @@
26263156
26273157 refreshContents();
26283158 } else
2629
- if (event.getSource() == flashSelectionButton)
3159
+ if (source == flashSelectionButton)
26303160 {
26313161 CameraPane.flash = true;
26323162 refreshContents();
26333163 } else
2634
- if (event.getSource() == oneButton)
3164
+ if (source == oneButton)
26353165 {
26363166 } else
2637
- if (event.getSource() == twoButton)
3167
+ if (source == twoButton)
26383168 {
26393169 radio.layout = twoButton;
3170
+
3171
+ if (CameraPane.FULLSCREEN)
3172
+ fullscreenLayout = radio.layout;
3173
+
26403174 // bug
26413175 //gridPanel.setDividerLocation(1.0);
26423176 //bigPanel.setDividerLocation(0.0);
2643
- bigThree.remove(scenePanel);
2644
- bigThree.remove(centralPanel);
2645
- bigThree.remove(XYZPanel);
2646
- aWindowConstraints.gridx = 0;
2647
- aWindowConstraints.gridy = 0;
2648
- aWindowConstraints.gridwidth = 1;
2649
- // aConstraints.gridheight = 3;
2650
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2651
- aWindowConstraints.weightx = 0;
2652
- aWindowConstraints.weighty = 1;
2653
- //bigThree.add(jtp, aWindowConstraints);
2654
- aWindowConstraints.weightx = 1;
2655
- aWindowConstraints.gridwidth = 3;
2656
- // aConstraints.gridheight = 3;
2657
- aWindowConstraints.gridx = 1;
2658
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2659
- bigThree.add(centralPanel, aWindowConstraints);
2660
- aWindowConstraints.weightx = 0;
2661
- aWindowConstraints.gridx = 4;
2662
- aWindowConstraints.gridwidth = 1;
2663
- // aConstraints.gridheight = 3;
2664
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2665
- //bigThree.add(XYZPanel, aWindowConstraints);
2666
- bigThree.revalidate();
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
+
26673224 } else
2668
- if (event.getSource() == threeButton)
3225
+ if (source == threeButton)
26693226 {
26703227 radio.layout = threeButton;
2671
- bigThree.remove(scenePanel);
2672
- bigThree.remove(centralPanel);
2673
- bigThree.remove(XYZPanel);
2674
- aWindowConstraints.gridx = 0;
2675
- aWindowConstraints.gridy = 0;
2676
- aWindowConstraints.gridwidth = 1;
2677
- // aConstraints.gridheight = 3;
2678
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2679
- aWindowConstraints.weightx = 0;
2680
- aWindowConstraints.weighty = 1;
2681
- //bigThree.add(jtp, aWindowConstraints);
2682
- aWindowConstraints.weightx = 1;
2683
- aWindowConstraints.gridwidth = 3;
2684
- // aConstraints.gridheight = 3;
2685
- aWindowConstraints.gridx = 1;
2686
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2687
- bigThree.add(centralPanel, aWindowConstraints);
2688
- aWindowConstraints.weightx = 0;
2689
- aWindowConstraints.gridx = 4;
2690
- aWindowConstraints.gridwidth = 1;
2691
- // aConstraints.gridheight = 3;
2692
- aConstraints.fill = GridBagConstraints.VERTICAL;
2693
- bigThree.add(XYZPanel, aWindowConstraints);
2694
- bigThree.revalidate();
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();
26953265 } else
2696
- if (event.getSource() == fourButton)
3266
+ if (source == fourButton)
26973267 {
26983268 radio.layout = fourButton;
2699
- bigThree.remove(scenePanel);
2700
- bigThree.remove(centralPanel);
2701
- bigThree.remove(XYZPanel);
2702
- aWindowConstraints.gridx = 0;
2703
- aWindowConstraints.gridy = 0;
2704
- aWindowConstraints.gridwidth = 1;
2705
- // aWindowConstraints.gridheight = 3;
2706
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2707
- aWindowConstraints.weightx = 1;
2708
- aWindowConstraints.weighty = 1;
2709
- bigThree.add(scenePanel, aWindowConstraints);
2710
- aWindowConstraints.weightx = 1;
2711
- aWindowConstraints.gridwidth = 3;
2712
- // aConstraints.gridheight = 3;
2713
- aWindowConstraints.gridx = 1;
2714
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2715
- //bigThree.add(cameraPanel, aWindowConstraints);
2716
- aWindowConstraints.weightx = 0;
2717
- aWindowConstraints.gridx = 4;
2718
- aWindowConstraints.gridwidth = 1;
2719
- // aWindowConstraints.gridheight = 3;
2720
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2721
- //bigThree.add(XYZPanel, aWindowConstraints);
2722
- bigThree.revalidate();
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();
27233305 } else
2724
- if (event.getSource() == sixButton)
3306
+ if (source == sixButton)
27253307 {
27263308 radio.layout = sixButton;
2727
- bigThree.remove(scenePanel);
2728
- bigThree.remove(centralPanel);
2729
- bigThree.remove(XYZPanel);
2730
- aWindowConstraints.gridx = 0;
2731
- aWindowConstraints.gridy = 0;
2732
- aWindowConstraints.gridwidth = 1;
2733
- // aConstraints.gridheight = 3;
2734
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2735
- aWindowConstraints.weightx = 0;
2736
- aWindowConstraints.weighty = 1;
2737
- bigThree.add(scenePanel, aWindowConstraints);
2738
- aWindowConstraints.weightx = 1;
2739
- aWindowConstraints.gridwidth = 3;
2740
- // aWindowConstraints.gridheight = 3;
2741
- aWindowConstraints.gridx = 1;
2742
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2743
- bigThree.add(centralPanel, aWindowConstraints);
2744
- aWindowConstraints.weightx = 0;
2745
- aWindowConstraints.gridx = 4;
2746
- aWindowConstraints.gridwidth = 1;
2747
- // aWindowConstraints.gridheight = 3;
2748
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2749
- //bigThree.add(XYZPanel, aConstraints);
2750
- bigThree.revalidate();
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();
27513346 } else
2752
- if (event.getSource() == sevenButton)
3347
+ if (source == sevenButton)
27533348 {
27543349 radio.layout = sevenButton;
2755
- bigThree.remove(scenePanel);
2756
- bigThree.remove(centralPanel);
2757
- bigThree.remove(XYZPanel);
2758
- aWindowConstraints.gridx = 0;
2759
- aWindowConstraints.gridy = 0;
2760
- aWindowConstraints.gridwidth = 1;
2761
- // aWindowConstraints.gridheight = 3;
2762
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2763
- aWindowConstraints.weightx = 0;
2764
- aWindowConstraints.weighty = 1;
2765
- bigThree.add(scenePanel, aWindowConstraints);
2766
- aWindowConstraints.weightx = 1;
2767
- aWindowConstraints.gridwidth = 3;
2768
- // aWindowConstraints.gridheight = 3;
2769
- aWindowConstraints.gridx = 1;
2770
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2771
- bigThree.add(centralPanel, aWindowConstraints);
2772
- aWindowConstraints.weightx = 0;
2773
- aWindowConstraints.gridx = 4;
2774
- aWindowConstraints.gridwidth = 1;
2775
- // aConstraints.gridheight = 3;
2776
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2777
- bigThree.add(XYZPanel, aWindowConstraints);
2778
- bigThree.revalidate();
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();
27793388 } else
2780
- if (event.getSource() == rootButton)
3389
+ if (source == rootButton)
27813390 {
27823391 Object3D obj;
27833392 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2787,66 +3396,84 @@
27873396 EditObject(obj);
27883397 }
27893398
3399
+ cameraView.requestFocusInWindow();
27903400 refreshContents(true);
27913401 } else
2792
- if (event.getSource() == closeButton)
3402
+ if (source == closeButton)
27933403 {
27943404 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27953405 cRadio ab;
27963406 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27973407 {
27983408 ab = (cRadio)e.nextElement();
2799
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3409
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28003410 {
3411
+ // Patch to avoid bug with transparency.
3412
+ if (!ab.hadMaterial)
3413
+ {
3414
+ ab.object.material = null;
3415
+ }
3416
+
28013417 buttonGroup.remove(ab);
28023418 radioPanel.remove(ab);
28033419
2804
- ab.GetObject().editWindow = null;
3420
+ //ab.GetObject().editWindow = null;
3421
+ ab.GetObject().manipWindow = null;
28053422 // ab.GetObject().objectUI = null; // ?????????
28063423
28073424 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28083425 break;
28093426 }
28103427 }
3428
+
3429
+ cameraView.requestFocusInWindow();
28113430 refreshContents(true);
28123431 } else
2813
- if (event.getSource() == editItem || event.getSource() == editButton)
3432
+ if (source == editItem || source == editButton)
28143433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
28153440 EditSelection(false);
28163441 } else
2817
- if (event.getSource() == uneditButton)
3442
+ if (source == uneditButton)
28183443 {
28193444 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28203445 {
28213446 Object3D child = (Object3D)e.nextElement();
28223447 if(child.editWindow != null)
28233448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
28243450 child.CloseUI();
28253451 listUI.remove(child);
28263452
2827
- child.editWindow = null; // ???????????
3453
+ //child.editWindow = null; // ???????????
28283454 }
2829
- objEditor.ctrlPanel.revalidate();
3455
+ objEditor.ctrlPanel.FlushUI();
28303456 //objEditor.jTree.clearSelection();
28313457 //objEditor.ResetSliders();
28323458 refreshContents(true);
28333459 } else
2834
- if (event.getSource() == clearPanelButton)
3460
+ if (source == clearPanelButton)
28353461 {
28363462 assert(copy == group);
28373463 //copy.ClearUI();
28383464 for (Object3D obj : listUI)
28393465 {
3466
+ obj.pinned = false;
28403467 obj.CloseUI();
28413468 }
28423469 listUI.clear();
28433470 refreshContents(true);
28443471 } else
2845
- if (event.getSource() == allParamsButton)
3472
+ if (source == allParamsButton)
28463473 {
28473474 assert(copy == group);
28483475
2849
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28503477
28513478 for (Object3D obj : listUI)
28523479 {
....@@ -2863,19 +3490,19 @@
28633490
28643491 refreshContents(true);
28653492 } else
2866
- if (event.getSource() == unselectButton)
3493
+ if (source == unselectButton)
28673494 {
28683495 objEditor.jTree.clearSelection();
28693496 // ?? oct 2012 GrafreeD.clipboard.clear();
28703497 objEditor.ResetSliders();
28713498 refreshContents(true);
28723499 } else
2873
- if(event.getSource() instanceof cRadio)
3500
+ if(source instanceof cRadio)
28743501 {
28753502 group.parent = keepparent;
28763503 group.attributes = 0;
28773504 //group.editWindow = null;
2878
- /*cRadio*/ radio = (cRadio)event.getSource();
3505
+ /*cRadio*/ radio = (cRadio)source;
28793506 Object3D obj = radio.GetObject();
28803507 System.out.println("Edit " + obj);
28813508 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2895,7 +3522,10 @@
28953522 }
28963523
28973524 copy = group;
2898
- //CameraPane.theRenderer.object = group;
3525
+
3526
+ SetUndoStates();
3527
+
3528
+ //Globals.theRenderer.object = group;
28993529 if(!useclient)
29003530 {
29013531 cameraView.renderCamera = radio.camera;
....@@ -2904,25 +3534,52 @@
29043534 cameraView.cameras[cameraView.cameracount] = radio.camera;
29053535 cameraView.targetLookAt.set(radio.camera.lookAt);
29063536 cameraView.object = group;
2907
- cameraView.lighttouched = true;
3537
+ //cameraView.lighttouched = true;
3538
+ Globals.lighttouched = true;
29083539 topView.object = group;
29093540 frontView.object = group;
29103541 sideView.object = group;
29113542 }
2912
- group.editWindow = this;
3543
+
3544
+// fix "+" issue
3545
+ //group.editWindow = this;
3546
+ group.manipWindow = this;
3547
+
29133548 /*
29143549 currentLayout = radio.layout;
29153550 if (currentLayout == null)
29163551 currentLayout = sevenButton;
29173552 */
29183553 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);
29193561 keepparent = group.parent;
29203562 // PARENT = NULL or not???
29213563 //group.parent = null; // ROOT
29223564 //group.attributes = -1;
29233565 ResetModel();
3566
+
3567
+ cameraView.requestFocusInWindow();
29243568 refreshContents(true);
2925
- }
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
+ }
29263583 else
29273584 {
29283585 //return super.action(event, arg);
....@@ -2931,7 +3588,6 @@
29313588 }
29323589
29333590 boolean useclient = false;
2934
- cRadio radio;
29353591
29363592 void ToggleRoot()
29373593 {
....@@ -2940,7 +3596,7 @@
29403596 if (useclient)
29413597 {
29423598 cameraView.object = client;
2943
- cameraView.lighttouched = true;
3599
+ Globals.lighttouched = true;
29443600 //topView.object = client;
29453601 //frontView.object = client;
29463602 //sideView.object = client;
....@@ -2948,7 +3604,7 @@
29483604 else
29493605 {
29503606 cameraView.object = group;
2951
- cameraView.lighttouched = true;
3607
+ Globals.lighttouched = true;
29523608 //topView.object = group;
29533609 //frontView.object = group;
29543610 //sideView.object = group;
....@@ -2983,6 +3639,28 @@
29833639 refreshContents();
29843640 }
29853641
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
+ }
29863664
29873665 void ResetTransform()
29883666 {
....@@ -3095,7 +3773,7 @@
30953773 refreshContents();
30963774 }
30973775
3098
- void ResetCentroid()
3776
+ void ResetCentroid(boolean full)
30993777 {
31003778 Object3D obj;
31013779 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3110,12 +3788,16 @@
31103788 LA.matIdentity(Object3D.mat);
31113789 obj.getBounds(minima, maxima, false);
31123790 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3113
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3791
+ if (full)
3792
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31143793 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31153794 obj.TransformMesh(Object3D.mat);
3795
+
31163796 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3117
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3797
+ if (full)
3798
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31183799 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3800
+
31193801 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31203802 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31213803 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3144,7 +3826,8 @@
31443826
31453827 int size = obj.MemorySize();
31463828
3147
- 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)");
31483831 }
31493832 }
31503833 catch (Exception e)
....@@ -3181,9 +3864,9 @@
31813864 obj = (Object3D)e.nextElement();
31823865
31833866 System.out.println("Object is: " + obj);
3184
- GrafreeD.AnalyzeObject(obj);
3867
+ Grafreed.AnalyzeObject(obj);
31853868 System.out.println("Boundary rep: " + obj.bRep);
3186
- GrafreeD.AnalyzeObject(obj.bRep);
3869
+ Grafreed.AnalyzeObject(obj.bRep);
31873870
31883871 // System.err.println((size/1024) + " KB is the size of " + obj);
31893872 }
....@@ -3225,6 +3908,13 @@
32253908 void GenNormals(boolean crease)
32263909 {
32273910 group.GenNormalsS(crease);
3911
+
3912
+ refreshContents();
3913
+ }
3914
+
3915
+ void GenNormalsMESH()
3916
+ {
3917
+ group.GenNormalsMeshS();
32283918
32293919 refreshContents();
32303920 }
....@@ -3397,8 +4087,8 @@
33974087
33984088 void ParseVertices()
33994089 {
3400
- boolean epsequal = GrafreeD.epsequal;
3401
- GrafreeD.epsequal = true;
4090
+ boolean epsequal = Grafreed.epsequal;
4091
+ Grafreed.epsequal = true;
34024092
34034093 for (int i=0; i<group.selection.size(); i++)
34044094 {
....@@ -3423,7 +4113,7 @@
34234113 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34244114 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34254115
3426
- g.add(GrafreeD.clipboard);
4116
+ g.add(Grafreed.clipboard);
34274117
34284118 buffer.add(g);
34294119 }
....@@ -3438,7 +4128,7 @@
34384128 makeSomething(buffer, i==group.selection.size()-1);
34394129 }
34404130
3441
- GrafreeD.epsequal = epsequal;
4131
+ Grafreed.epsequal = epsequal;
34424132
34434133 refreshContents();
34444134 }
....@@ -3456,7 +4146,16 @@
34564146 String pigment = Object3D.GetPigment(tex);
34574147 //String bump = Object3D.GetBump(tex);
34584148
3459
- 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
+ }
34604159
34614160 double s = v.s;
34624161
....@@ -3544,11 +4243,11 @@
35444243
35454244 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35464245
3547
- boolean random = CameraPane.RANDOM;
3548
- CameraPane.RANDOM = false; // parse all random nodes
4246
+ boolean random = CameraPane.SWITCH;
4247
+ CameraPane.SWITCH = false; // parse all random nodes
35494248 lowres.linkVerticesThis(null);
35504249 lowres.linkVerticesThis(sn);
3551
- CameraPane.RANDOM = random;
4250
+ CameraPane.SWITCH = random;
35524251
35534252 System.err.flush();
35544253
....@@ -3588,7 +4287,7 @@
35884287 return;
35894288
35904289 Object3D poses = group.selection.get(0);
3591
- Object3D ref = GrafreeD.clipboard.get(0);
4290
+ Object3D ref = Grafreed.clipboard.get(0);
35924291
35934292 Object3D newgroup = new Object3D("Po:" + poses.name);
35944293
....@@ -3757,7 +4456,7 @@
37574456 group.selection.RelinkToSupport(); // july 2014
37584457 System.out.println("DONE.");
37594458 refreshContents();
3760
- 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));
37614460 }
37624461
37634462 void ReduceMesh(boolean reduction34)
....@@ -3782,9 +4481,9 @@
37824481
37834482 void ClipMesh()
37844483 {
3785
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4484
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37864485 {
3787
- Object3D content = GrafreeD.clipboard.get(0);
4486
+ Object3D content = Grafreed.clipboard.get(0);
37884487
37894488 if (content instanceof cGroup && ((cGroup)content).transientlink )
37904489 content = ((cGroup)content).get(0);
....@@ -3793,7 +4492,7 @@
37934492 // {
37944493 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37954494 // }
3796
- group.selection.ClipMesh(GrafreeD.clipboard);
4495
+ group.selection.ClipMesh(Grafreed.clipboard);
37974496 }
37984497 // group.selection.ClipMesh(GrafreeD.clipboard);
37994498 System.out.println("DONE.");
....@@ -3840,6 +4539,18 @@
38404539 void MarkLeaves(boolean hide)
38414540 {
38424541 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);
38434554 refreshContents();
38444555 }
38454556
....@@ -3914,10 +4625,6 @@
39144625 // }
39154626 // }
39164627
3917
- static boolean allparams = true;
3918
-
3919
- static Vector<Object3D> listUI = new Vector<Object3D>();
3920
-
39214628 void EditSelection(boolean newWindow)
39224629 {
39234630 // aConstraints.gridy = 0;
....@@ -3925,10 +4632,10 @@
39254632 {
39264633 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39274634 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3928
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4635
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39294636
39304637 Object3D elem = (Object3D)group.selection.elementAt(i);
3931
- if(elem != group)
4638
+ if(elem != group || !newWindow)
39324639 {
39334640 // if (!(elem instanceof Composite))
39344641 // newWindow = false;
....@@ -4010,7 +4717,8 @@
40104717 //new Exception().printStackTrace();
40114718
40124719 freezemodel = true;
4013
-
4720
+ ClearUnpinned();
4721
+
40144722 /**/
40154723 //switch (event.id)
40164724 {
....@@ -4018,7 +4726,6 @@
40184726 //case 702: // Event.LIST_DESELECT
40194727 group.deselectAll();
40204728 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4021
- objEditor.ClearInfo(); // .GetMaterial());
40224729 if (tps != null)
40234730 {
40244731 for (int i=0; i < tps.length; i++)
....@@ -4027,33 +4734,39 @@
40274734
40284735 //if (child.parent != null)
40294736 //child.parent.addSelectee(child);
4737
+ objEditor.SetMaterial(child);
40304738 group.addSelectee(child);
4031
- objEditor.SetMaterial(child); // .GetMaterial());
4032
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4033
- System.err.println("info : " + child.GetPath());
40344739 }
40354740 }
4036
- else
4037
- {
4038
- objEditor.SetMaterial(group); // .GetMaterial());
4039
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4040
- System.err.println("info : " + group.GetPath());
4041
- }
4741
+// else
4742
+// {
4743
+// objEditor.SetMaterial(group); // .GetMaterial());
4744
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4745
+// System.err.println("info : " + group.GetPath());
4746
+// }
40424747
4043
- objEditor.SetText(); // jan 2014
4044
-
4045
- 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))
40464749 CameraPane.flash = true;
40474750
4048
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4751
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40494752 // a camera
40504753 {
4051
- CameraPane.camerachangeframe = 0; // don't refuse it
4052
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4053
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
4054
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
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;
40554761 }
40564762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
40574770 refreshContents();
40584771 //return true;
40594772 }
....@@ -4062,6 +4775,35 @@
40624775
40634776 freezemodel = false;
40644777 }
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
+ }
40654807
40664808 void linkSomething(Object3D thing)
40674809 {
....@@ -4133,16 +4875,19 @@
41334875 {
41344876 if (group.selection.isEmpty())
41354877 return;
4136
- GrafreeD.clipboardIsTempGroup = false;
4878
+
4879
+ Grafreed.clipboardIsTempGroup = false;
41374880 Composite tGroup = null;
41384881 if (group.selection.size() > 0) // 1)
41394882 {
41404883 tGroup = new cGroup();
4141
- GrafreeD.clipboardIsTempGroup = true;
4884
+ Grafreed.clipboardIsTempGroup = true;
41424885 }
41434886
41444887 if (cut)
41454888 {
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
41464891 //int indices[] = jList.getSelectedIndices();
41474892 //for (int i = indices.length - 1; i >= 0; i--)
41484893 //jList.remove(indices[i]);
....@@ -4178,16 +4923,16 @@
41784923 //System.out.println("cut " + child);
41794924 //System.out.println("parent = " + child.parent);
41804925 // tmp.addChild(child);
4181
- if (GrafreeD.clipboardIsTempGroup)
4926
+ if (Grafreed.clipboardIsTempGroup)
41824927 tGroup.add/*Child*/(tmp);
41834928 else
4184
- GrafreeD.clipboard = tmp;
4929
+ Grafreed.clipboard = tmp;
41854930 }
41864931 else
4187
- if (GrafreeD.clipboardIsTempGroup)
4932
+ if (Grafreed.clipboardIsTempGroup)
41884933 tGroup.add/*Child*/(child);
41894934 else
4190
- GrafreeD.clipboard = child;
4935
+ Grafreed.clipboard = child;
41914936 }
41924937
41934938 //ResetModel();
....@@ -4219,21 +4964,23 @@
42194964 //System.out.println("cut " + elem);
42204965 //System.out.println("parent = " + elem.parent);
42214966 // tmp.addChild(elem);
4222
- if (GrafreeD.clipboardIsTempGroup)
4967
+ if (Grafreed.clipboardIsTempGroup)
42234968 tGroup.add/*Child*/(tmp);
42244969 else
4225
- GrafreeD.clipboard = tmp;
4970
+ Grafreed.clipboard = tmp;
42264971 }
42274972 else
4228
- if (GrafreeD.clipboardIsTempGroup)
4973
+ if (Grafreed.clipboardIsTempGroup)
42294974 tGroup.add/*Child*/(child);
42304975 else
4231
- GrafreeD.clipboard = child;
4976
+ Grafreed.clipboard = child;
42324977 }
42334978
42344979 }
4235
- if (GrafreeD.clipboardIsTempGroup)
4236
- GrafreeD.clipboard = tGroup;
4980
+
4981
+ if (Grafreed.clipboardIsTempGroup)
4982
+ Grafreed.clipboard = tGroup;
4983
+
42374984 if (cut)
42384985 {
42394986 ResetModel();
....@@ -4243,11 +4990,15 @@
42434990
42444991 void paste(boolean expand)
42454992 {
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
42464997 // if (GrafreeD.clipboard == null)
42474998 // return;
42484999 boolean first = true;
42495000
4250
- if (GrafreeD.clipboardIsTempGroup)
5001
+ if (Grafreed.clipboardIsTempGroup)
42515002 {
42525003 Composite temp;
42535004
....@@ -4258,7 +5009,7 @@
42585009 temp = (Composite)Applet3D.clipboard.deepCopy();
42595010 */
42605011 Object3D elem;
4261
- 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))
42625013 {
42635014 Object3D child = (Object3D)e.nextElement();
42645015
....@@ -4292,21 +5043,22 @@
42925043 //Object3D cb = Applet3D.clipboard;
42935044 //temp.addChild(cb);
42945045 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4295
- assert(GrafreeD.clipboard.parent == null);
4296
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4297
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4298
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4299
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
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());
43005051 else
4301
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4302
- GrafreeD.clipboard.get(0).parent = keepparent;
5052
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5053
+ Grafreed.clipboard.get(0).parent = keepparent;
43035054 }
43045055
5056
+ Globals.REPLACEONMAKE = keep;
43055057 ResetModel();
43065058 refreshContents();
43075059 }
43085060
4309
- void pasteInto(boolean copyit)
5061
+ void pasteInto(boolean copyit, boolean clone)
43105062 {
43115063 // if (GrafreeD.clipboard == null)
43125064 // return;
....@@ -4335,15 +5087,22 @@
43355087 if (copyit)
43365088 {
43375089 // paste(false);
4338
- CloneClipboard(false); // sept 2014
5090
+ if (clone)
5091
+ {
5092
+ CloneClipboard(false); // sept 2014
5093
+ }
5094
+ else
5095
+ {
5096
+ paste(false);
5097
+ }
43395098 }
43405099 else
43415100 {
43425101 boolean first = true;
43435102
4344
- if (GrafreeD.clipboardIsTempGroup)
5103
+ if (Grafreed.clipboardIsTempGroup)
43455104 {
4346
- Composite temp = (Composite)GrafreeD.clipboard;
5105
+ Composite temp = (Composite)Grafreed.clipboard;
43475106 Object3D copy;
43485107 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43495108 {
....@@ -4353,7 +5112,7 @@
43535112 }
43545113 } else
43555114 {
4356
- linkSomething(GrafreeD.clipboard); //.get(0));
5115
+ linkSomething(Grafreed.clipboard); //.get(0));
43575116 }
43585117 }
43595118 }
....@@ -4430,6 +5189,10 @@
44305189
44315190 void group(Object3D csg, boolean grab)
44325191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
44335196 if (//false) // why??
44345197 !group.selection.isEmpty())
44355198 {
....@@ -4543,10 +5306,15 @@
45435306 //node.add(csg);
45445307 //makeSomething(node);
45455308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
45465310 }
45475311
45485312 void Ungroup(Object3D g)
45495313 {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
45505318 if (g instanceof HiddenObject)
45515319 {
45525320 HiddenObject h = (HiddenObject) g;
....@@ -4563,6 +5331,7 @@
45635331 objEditor.makeSomething(g.get(i), false);
45645332 }
45655333 }
5334
+ Globals.REPLACEONMAKE = keep;
45665335 }
45675336
45685337 void ungroup()
....@@ -4758,21 +5527,6 @@
47585527 }
47595528 */
47605529
4761
- void ImportGFD()
4762
- {
4763
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4764
- browser.show();
4765
- String filename = browser.getFile();
4766
- if (filename != null && filename.length() > 0)
4767
- {
4768
- String fullname = browser.getDirectory() + filename;
4769
-
4770
- //Object3D readobj =
4771
- objEditor.ReadGFD(fullname, objEditor);
4772
- //makeSomething(readobj);
4773
- }
4774
- }
4775
-
47765530 /*
47775531 public void Callback(Object obj)
47785532 {
....@@ -4796,26 +5550,9 @@
47965550 }
47975551 */
47985552
4799
- void ImportVRMLX3D()
4800
- {
4801
- if (GrafreeD.standAlone)
4802
- {
4803
- /**/
4804
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4805
- browser.show();
4806
- String filename = browser.getFile();
4807
- if (filename != null && filename.length() > 0)
4808
- {
4809
- String fullname = browser.getDirectory() + filename;
4810
- LoadVRMLX3D(fullname);
4811
- }
4812
- /**/
4813
- }
4814
- }
4815
-
48165553 String GetFile(String dialogName)
48175554 {
4818
- if (GrafreeD.standAlone)
5555
+ if (Grafreed.standAlone)
48195556 {
48205557 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48215558 browser.show();
....@@ -4879,10 +5616,33 @@
48795616 cButton flashSelectionButton;
48805617 cButton editButton;
48815618 cButton uneditButton;
5619
+ JCheckBox allParamsButton;
48825620 cButton clearpanelButton;
4883
- cButton allParamsButton;
48845621 cButton unselectButton;
48855622
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
+
48865646 cButton screenfitButton;
48875647 cButton screenfitpointButton;
48885648 cButton snapobjectButton;
....@@ -4894,14 +5654,6 @@
48945654
48955655 cButton setsupportButton;
48965656
4897
- cButton twoButton;
4898
- cButton sixButton;
4899
- cButton threeButton;
4900
- cButton sevenButton;
4901
- cButton fourButton; // full panel
4902
- cButton oneButton; // full XYZ
4903
- //cButton currentLayout;
4904
-
49055657 //
49065658 //Composite
49075659 Object3D // to do !!
....@@ -4911,9 +5663,11 @@
49115663 //JTree jTree;
49125664 private MenuItem lookAtItem;
49135665 private MenuItem lookFromItem;
4914
- private MenuItem switchItem;
5666
+ private MenuItem switchViewItem;
49155667 private MenuItem cutItem;
4916
- private MenuItem duplicateItem;
5668
+ private MenuItem undoItem;
5669
+ private MenuItem redoItem;
5670
+ private JMenuItem duplicateItem;
49175671 private MenuItem cloneItem;
49185672 private MenuItem cloneSupportItem;
49195673 private MenuItem overwriteGeoItem;
....@@ -4926,7 +5680,7 @@
49265680 private MenuItem linkverticesItem;
49275681 private MenuItem relinkverticesItem;
49285682 private MenuItem setMasterItem;
4929
- private MenuItem resetMeshItem;
5683
+ private MenuItem resetAllItem;
49305684 private MenuItem stepAllItem;
49315685 private MenuItem revertMeshItem;
49325686 private MenuItem poseMeshItem;
....@@ -4937,6 +5691,7 @@
49375691 private MenuItem mergeGeometriesItem;
49385692 private MenuItem copyItem;
49395693 private MenuItem pasteItem;
5694
+ private MenuItem pasteIntoItem;
49405695 private MenuItem pasteLinkItem;
49415696 private MenuItem pasteCloneItem;
49425697 private MenuItem pasteExpandItem;
....@@ -4975,6 +5730,10 @@
49755730 private MenuItem showleavesItem;
49765731 private MenuItem markleavesItem;
49775732 private MenuItem unmarkleavesItem;
5733
+ private MenuItem rewindleavesItem;
5734
+ private MenuItem unrewindleavesItem;
5735
+ private MenuItem randomleavesItem;
5736
+ private MenuItem unrandomleavesItem;
49785737
49795738 private MenuItem flipVItem;
49805739 private MenuItem unflipVItem;
....@@ -4986,15 +5745,17 @@
49865745 private MenuItem panoTexturesItem;
49875746
49885747 private MenuItem resetCentroidItem;
4989
- private MenuItem transformgeometryItem;
5748
+ private MenuItem resetCentroidXZItem;
49905749 private MenuItem resetTransformItem;
5750
+ private MenuItem transformGeometryItem;
5751
+ private MenuItem transformChildrenItem;
49915752 private MenuItem hideItem;
49925753 private MenuItem grabItem;
49935754 private MenuItem backItem;
49945755 private MenuItem frontItem;
49955756 private MenuItem cameraItem;
49965757 private MenuItem compositeItem;
4997
- private MenuItem randomItem;
5758
+ private MenuItem switchItem;
49985759 private MenuItem physicsItem;
49995760 private MenuItem frameselectorItem;
50005761 private MenuItem scriptNodeItem;
....@@ -5009,6 +5770,7 @@
50095770
50105771 private MenuItem resetParentItem;
50115772 private MenuItem repairParentItem;
5773
+ private MenuItem repairShadowItem;
50125774 private MenuItem sortbysizeItem;
50135775 private MenuItem sortbynameItem;
50145776
....@@ -5033,7 +5795,7 @@
50335795 private MenuItem blobItem;
50345796 private MenuItem latheItem;
50355797 private MenuItem bezierItem;
5036
- private MenuItem checkerItem;
5798
+ private MenuItem overlayItem;
50375799 private MenuItem meshItem;
50385800 // private MenuItem meshGroupItem;
50395801 private MenuItem springItem;
....@@ -5055,11 +5817,6 @@
50555817 private MenuItem doubleItem;
50565818 private MenuItem tripleItem;
50575819
5058
- private MenuItem importGFDItem;
5059
- private MenuItem importVRMLX3DItem;
5060
- private MenuItem import3DSItem;
5061
- private MenuItem importOBJItem;
5062
-
50635820 private MenuItem computeAOItem;
50645821 private MenuItem recompileItem;
50655822 private MenuItem editScriptItem;
....@@ -5069,4 +5826,8 @@
50695826 private MenuItem analyzeItem;
50705827 private MenuItem dumpItem;
50715828 //boolean freezemodel = false;
5829
+
5830
+ Menu cameraMenu;
5831
+ MenuItem editCameraItem;
5832
+ MenuItem restoreCameraItem;
50725833 }