Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
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,
....@@ -73,7 +74,7 @@
7374 this.copy = this.group = copy;
7475 //selectees = this.group.selectees;
7576
76
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7778 SetupUI2(objEditor);
7879 objEditor.SetupUI(true);
7980 SetupViews(objEditor);
....@@ -83,6 +84,10 @@
8384
8485 void CloneSelection(boolean supports)
8586 {
87
+ if (Globals.SAVEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.SAVEONMAKE;
90
+ Globals.SAVEONMAKE = false;
8691 // Object3D keep = GrafreeD.clipboard;
8792 //Object3D obj;
8893 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +98,19 @@
9398
9499 makeSomething(clone, i==group.selection.size()-1);
95100 }
101
+ Globals.SAVEONMAKE = keep;
96102 }
97103
98104 void CloneClipboard(boolean supports)
99105 {
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));
106
+ assert(Grafreed.clipboard.parent == null);
107
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
108
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
109
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
110
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105111 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
112
+ makeSomething(CloneObject(Grafreed.clipboard, false));
113
+ Grafreed.clipboard.get(0).parent = keepparent;
108114 }
109115
110116 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +124,7 @@
118124 // obj.support = null;
119125 if (!supports)
120126 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
127
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122128 obj.parent = parent;
123129 // obj.support = support;
124130 // clone.support = support; // aout 2013
....@@ -147,30 +153,29 @@
147153
148154 //JTextField nameField;
149155
150
- void SetupMenu2(ObjEditor oe)
156
+ void SetupMenu2(GroupEditor oe)
151157 {
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);
158
+ oe.jTree = new cTree();
159
+
163160 Menu menu;
164161 oe.menuBar.add(menu = new Menu("Edit"));
165162 //editItem = menu.add(new MenuItem("Edit"));
166163 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
164
+
165
+// undoItem = menu.add(new MenuItem("Undo"));
166
+// undoItem.addActionListener(this);
167
+// redoItem = menu.add(new MenuItem("Redo"));
168
+// redoItem.addActionListener(this);
169
+// menu.add("-");
170
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168171 duplicateItem.addActionListener(this);
169
- menu.add("-");
170172 cloneItem = menu.add(new MenuItem("Clone"));
171173 cloneItem.addActionListener(this);
174
+ if (Globals.ADVANCED)
175
+ {
172176 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173177 cloneSupportItem.addActionListener(this);
178
+ }
174179 menu.add("-");
175180 cutItem = menu.add(new MenuItem("Cut"));
176181 cutItem.addActionListener(this);
....@@ -178,27 +183,123 @@
178183 copyItem.addActionListener(this);
179184 pasteItem = menu.add(new MenuItem("Paste"));
180185 pasteItem.addActionListener(this);
186
+
187
+ menu.add("-");
188
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
189
+ pasteIntoItem.addActionListener(this);
181190 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182191 pasteLinkItem.addActionListener(this);
183192 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184193 pasteCloneItem.addActionListener(this);
185194 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186195 // pasteExpandItem.addActionListener(this);
196
+ menu.add("-");
187197 clearItem = menu.add(new MenuItem("Clear"));
188198 clearItem.addActionListener(this);
199
+
200
+ if (Globals.ADVANCED)
201
+ {
202
+ // Deletes the cameras...
189203 clearAllItem = menu.add(new MenuItem("Clear All"));
190204 clearAllItem.addActionListener(this);
205
+ }
206
+
207
+ menuBar.add(cameraMenu = new Menu("View"));
208
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
209
+ //zBufferItem.addActionListener(this);
210
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
211
+ //normalLensItem.addActionListener(this);
212
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
213
+ restoreCameraItem.addActionListener(this);
214
+
215
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
216
+// toggleFullScreenItem.addItemListener(this);
217
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
218
+// cameraMenu.add("-");
219
+//
220
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
221
+// toggleTextureItem.addItemListener(this);
222
+// toggleTextureItem.setState(CameraPane.textureon);
223
+//
224
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
225
+// toggleSwitchItem.addItemListener(this);
226
+// toggleSwitchItem.setState(CameraPane.SWITCH);
227
+
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
229
+ toggleHandleItem.addItemListener(this);
230
+ toggleHandleItem.setState(CameraPane.HANDLES);
231
+
232
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
233
+ togglePaintItem.addItemListener(this);
234
+ togglePaintItem.setState(CameraPane.PAINTMODE);
235
+
236
+ if (Globals.ADVANCED)
237
+ {
238
+ cameraMenu.add("-");
239
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
240
+ toggleLiveItem.addItemListener(this);
241
+ toggleLiveItem.setState(Globals.isLIVE());
191242
243
+ cameraMenu.add(stepItem = new MenuItem("Step"));
244
+ stepItem.addActionListener(this);
245
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
246
+ // toggleDLItem.addItemListener(this);
247
+ // toggleDLItem.setState(false);
248
+
249
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
250
+ toggleRenderItem.addItemListener(this);
251
+ toggleRenderItem.setState(!CameraPane.frozen);
252
+
253
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
254
+ toggleDebugItem.addItemListener(this);
255
+ toggleDebugItem.setState(Globals.DEBUG);
256
+
257
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
258
+ toggleFrustumItem.addItemListener(this);
259
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
260
+
261
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
262
+ toggleFootContactItem.addItemListener(this);
263
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
264
+
265
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
266
+ toggleTimelineItem.addItemListener(this);
267
+ }
268
+
269
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
270
+// toggleRootItem.addItemListener(this);
271
+// toggleRootItem.setState(false);
272
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
273
+// animationItem.addItemListener(this);
274
+// animationItem.setState(CameraPane.ANIMATION);
275
+ cameraMenu.add("-");
276
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
277
+ editCameraItem.addActionListener(this);
278
+
279
+ if (Globals.ADVANCED)
280
+ {
281
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
282
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
283
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
284
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
285
+ oe.cameraMenu.add("-");
286
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
287
+ openWindowItem.addActionListener(this);
288
+ editLeafItem.addActionListener(this);
289
+ lookAtItem.addActionListener(this);
290
+ //lookFromItem.addActinoListener(this);
291
+ //switchViewItem.addActionListener(this);
292
+ }
293
+
192294 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);
295
+ if (Globals.ADVANCED)
296
+ {
197297 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198298 revertMeshItem.addActionListener(this);
199299 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200300 resetreferencesItem.addActionListener(this);
201301 menu.add("-");
302
+ }
202303 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203304 overwriteGeoItem.addActionListener(this);
204305 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,79 +311,104 @@
210311 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211312 overwriteUVItem.addActionListener(this);
212313 menu.add("-");
314
+ if (Globals.ADVANCED)
315
+ {
213316 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214317 generateMeshItem.addActionListener(this);
215318 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216319 poseMeshItem.addActionListener(this);
217320 menu.add("-");
321
+ }
218322 resetsupportItem = menu.add(new MenuItem("Reset support"));
219323 resetsupportItem.addActionListener(this);
220324 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221325 linkverticesItem.addActionListener(this);
222326 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223327 relinkverticesItem.addActionListener(this);
328
+
329
+ if (Globals.ADVANCED)
330
+ {
224331 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225332 setMasterItem.addActionListener(this);
333
+ }
226334
227335 oe.menuBar.add(menu = new Menu("Group"));
228
- grabItem = menu.add(new MenuItem("Grab"));
229
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
230338 backItem = menu.add(new MenuItem("Back"));
231339 backItem.addActionListener(this);
232340 frontItem = menu.add(new MenuItem("Front"));
233341 frontItem.addActionListener(this);
234
- compositeItem = menu.add(new MenuItem("Composite"));
235
- compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
344
+
345
+ if (Globals.ADVANCED)
346
+ {
347
+ hideItem = menu.add(new MenuItem("Hidden Group"));
237348 hideItem.addActionListener(this);
349
+ }
238350 ungroupItem = menu.add(new MenuItem("Ungroup"));
239351 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);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
247359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248360 switchGeoItem.addActionListener(this);
249361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250362 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
363
+ morphItem = menu.add(new MenuItem("Morph Group"));
252364 morphItem.addActionListener(this);
365
+
366
+ menu.add("-");
367
+ physicsItem = menu.add(new MenuItem("Physics"));
368
+ physicsItem.addActionListener(this);
369
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
370
+ frameselectorItem.addActionListener(this);
253371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254372 scriptNodeItem.addActionListener(this);
255
- cameraItem = menu.add(new MenuItem("Camera"));
256
- cameraItem.addActionListener(this);
373
+ }
257374
258375 oe.menuBar.add(menu = new Menu("Object"));
259
- textureItem = menu.add(new MenuItem("Texture"));
260
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
261378 billboardItem = menu.add(new MenuItem("Billboard"));
262379 billboardItem.addActionListener(this);
263380 csgItem = menu.add(new MenuItem("CSG"));
264381 csgItem.addActionListener(this);
265
- shadowXItem = menu.add(new MenuItem("Shadow X"));
382
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
266383 shadowXItem.addActionListener(this);
267
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
384
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
268385 shadowYItem.addActionListener(this);
269
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
386
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
270387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
391
+ if (Globals.ADVANCED)
392
+ {
393
+ menu.add("-");
271394 linkerItem = menu.add(new MenuItem("Linker"));
272395 linkerItem.addActionListener(this);
273396 templateItem = menu.add(new MenuItem("Template"));
274397 templateItem.addActionListener(this);
275
- attributeItem = menu.add(new MenuItem("Attribute"));
276
- attributeItem.addActionListener(this);
277398 pointflowItem = menu.add(new MenuItem("Point Flow"));
278399 pointflowItem.addActionListener(this);
400
+ }
279401 menu.add("-");
280402 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281403 resetTransformItem.addActionListener(this);
282404 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283405 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- transformgeometryItem.addActionListener(this);
406
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
407
+ resetCentroidXZItem.addActionListener(this);
408
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
409
+ transformGeometryItem.addActionListener(this);
410
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
411
+ transformChildrenItem.addActionListener(this);
286412
287413 oe.menuBar.add(menu = new Menu("Geometry"));
288414 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +419,11 @@
293419 genNormalsCADItem.addActionListener(this);
294420 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295421 genNormalsMESHItem.addActionListener(this);
422
+ if (Globals.ADVANCED)
423
+ {
296424 genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
297425 genNormalsMINEItem.addActionListener(this);
426
+ }
298427 stripifyItem = menu.add(new MenuItem("Stripify"));
299428 stripifyItem.addActionListener(this);
300429 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +445,34 @@
316445 reduce34MeshItem.addActionListener(this);
317446 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318447 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321448 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322449 clipMeshItem.addActionListener(this);
450
+
451
+ if (Globals.ADVANCED)
452
+ {
453
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
454
+ smoothMeshItem.addActionListener(this);
455
+ }
323456
324457 oe.menuBar.add(menu = new Menu("Attributes"));
325458 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326459 clearMaterialsItem.addActionListener(this);
460
+ resetAllItem = menu.add(new MenuItem("Reset All"));
461
+ resetAllItem.addActionListener(this);
462
+ stepAllItem = menu.add(new MenuItem("Step All"));
463
+ stepAllItem.addActionListener(this);
327464 menu.add("-");
328465 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329466 liveleavesItem.addActionListener(this);
330467 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331468 unliveleavesItem.addActionListener(this);
469
+ if (Globals.ADVANCED)
470
+ {
332471 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333472 supportleavesItem.addActionListener(this);
334473 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335474 unsupportleavesItem.addActionListener(this);
475
+ }
336476 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337477 hideleavesItem.addActionListener(this);
338478 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -341,6 +481,14 @@
341481 markleavesItem.addActionListener(this);
342482 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
343483 unmarkleavesItem.addActionListener(this);
484
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
485
+ rewindleavesItem.addActionListener(this);
486
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
487
+ unrewindleavesItem.addActionListener(this);
488
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
489
+ randomleavesItem.addActionListener(this);
490
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
491
+ unrandomleavesItem.addActionListener(this);
344492 menu.add("-");
345493 flipVItem = menu.add(new MenuItem("Flip V"));
346494 flipVItem.addActionListener(this);
....@@ -376,35 +524,40 @@
376524 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377525 sortbynameItem.addActionListener(this);
378526 menu.add("-");
527
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
528
+ shareGeometriesItem.addActionListener(this);
529
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
530
+ mergeGeometriesItem.addActionListener(this);
531
+ if (Globals.ADVANCED)
532
+ {
533
+ // Pretty much the same as duplicate and clone.
379534 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380535 extractGeometriesItem.addActionListener(this);
381536 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382537 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);
538
+ }
387539
388540 oe.menuBar.add(menu = new Menu("Insert"));
389541 buildCreateMenu(menu);
390542
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
-
402543 oe.menuBar.add(menu = new Menu("Tools"));
403544 buildToolsMenu(menu);
404545 }
405546
406547 void SetupUI2(ObjEditor oe)
407548 {
549
+ // June 2019
550
+ if (oe == null)
551
+ {
552
+ //super.SetupUI2(this);
553
+ //return;
554
+ }
555
+
556
+ if (copy != group)
557
+ {
558
+ //super.SetupUI2(this);
559
+ }
560
+
408561 //new Exception().printStackTrace();
409562
410563 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -433,150 +586,217 @@
433586 oe.radioPanel.add(dummyButton);
434587 oe.buttonGroup.add(dummyButton);
435588 */
436
- aConstraints.gridy += 1;
437
- oe.aConstraints.gridwidth = 1;
438
- oe.aConstraints.gridx = 0;
589
+ cGridBag copyOptionsPanel = new cGridBag();
590
+
591
+ copyOptionsPanel.preferredHeight = 1;
439592
440
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
593
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
594
+
595
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ //minButton.setToolTipText("Minimize window");
597
+ //minButton.addActionListener(this);
598
+
599
+ if (Globals.ADVANCED)
600
+ {
601
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ maxButton.setToolTipText("Maximize window");
603
+ maxButton.addActionListener(this);
604
+ }
605
+
606
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
607
+ fullButton.setToolTipText("Full-screen window");
608
+ fullButton.addActionListener(this);
609
+
610
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ screenfitButton.setToolTipText("Screen fit");
612
+ screenfitButton.addActionListener(this);
613
+
614
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ restoreCameraButton.setToolTipText("Restore viewpoint");
616
+ restoreCameraButton.addActionListener(this);
617
+
618
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ undoButton.setToolTipText("Undo changes");
620
+ undoButton.addActionListener(this);
621
+ undoButton.setEnabled(false);
622
+
623
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ redoButton.setToolTipText("Redo changes");
625
+ redoButton.addActionListener(this);
626
+ redoButton.setEnabled(false);
627
+
628
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ saveButton.setToolTipText("Save changes");
630
+ saveButton.addActionListener(this);
631
+
632
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
633
+ liveCB.setToolTipText("Enable animation");
441634 liveCB.addItemListener(this);
442635
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);
636
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637
+ oneStepButton.setToolTipText("Animate one step forward");
638
+ oneStepButton.addActionListener(this);
639
+
640
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
641
+ fastCB.setToolTipText("Fast mode");
461642 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);
643
+
644
+ //oe.toolboxPanel.Return();
645
+
646
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
647
+// trackCB.setToolTipText("Enable tracking");
648
+// trackCB.addItemListener(this);
468649
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;
509650 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
510651 // 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;
515652
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);
523
- oe.aConstraints.gridx += 1;
524
- oe.aConstraints.weighty = 0;
525
- oe.aConstraints.gridwidth = 1;
653
+ if (Globals.ADVANCED)
654
+ {
655
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ snapobjectButton.addActionListener(this);
657
+ snapobjectButton.setToolTipText("Snap Object");
658
+ }
659
+
660
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
526661
527
- //
528
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
+ twoButton.setToolTipText("Show center view only");
529664 twoButton.addActionListener(this);
530
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
665
+ this.fullscreenLayout = twoButton;
666
+
667
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
531668 fourButton.addActionListener(this);
532
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
669
+ fourButton.setToolTipText("Show left panel only");
670
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
+ sixButton.setToolTipText("2-column layout left");
533672 sixButton.addActionListener(this);
534
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
673
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
+ threeButton.setToolTipText("2-column layout right");
535675 threeButton.addActionListener(this);
536
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
677
+ sevenButton.setToolTipText("3-column layout");
537678 sevenButton.addActionListener(this);
538679 //
539680
540
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
681
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ rootButton.setToolTipText("Edit selection in new tab");
541683 rootButton.addActionListener(this);
542
- oe.aConstraints.gridx += 1;
543
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
684
+
685
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686
+ closeButton.setToolTipText("Close tab");
544687 closeButton.addActionListener(this);
545688 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
546689 //clearButton.addActionListener(this);
547
- oe.aConstraints.gridx += 1;
548
-
549
- oe.aConstraints.gridx = 1; //
550
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
551
- editButton.addActionListener(this);
552
- oe.aConstraints.gridx += 1;
553
- oe.aConstraints.weighty = 0;
554
- oe.aConstraints.gridwidth = 1;
555690
556
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
691
+ // INSERT
692
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ gridButton.setToolTipText("Create grid");
694
+ gridButton.addActionListener(this);
695
+
696
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697
+ boxButton.setToolTipText("Create box");
698
+ boxButton.addActionListener(this);
699
+
700
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+ sphereButton.setToolTipText("Create sphere");
702
+ sphereButton.addActionListener(this);
703
+
704
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705
+ coneButton.setToolTipText("Create cone");
706
+ coneButton.addActionListener(this);
707
+
708
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ torusButton.setToolTipText("Create torus");
710
+ torusButton.addActionListener(this);
711
+
712
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ superButton.setToolTipText("Create superellipsoid");
714
+ superButton.addActionListener(this);
715
+
716
+ if (Globals.ADVANCED)
717
+ {
718
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ kleinButton.setToolTipText("Create Klein bottle");
720
+ kleinButton.addActionListener(this);
721
+ }
722
+
723
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ particlesButton.setToolTipText("Create particle system");
725
+ particlesButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.Return();
728
+
729
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ groupButton.setToolTipText("Create group");
731
+ groupButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ compositeButton.setToolTipText("Create composite");
735
+ compositeButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ switchButton.setToolTipText("Create item switcher");
739
+ switchButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ loopButton.setToolTipText("Create loop");
743
+ loopButton.addActionListener(this);
744
+
745
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ textureButton.setToolTipText("Create texture");
747
+ textureButton.addActionListener(this);
748
+
749
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ overlayButton.setToolTipText("Create overlay");
751
+ overlayButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
+ lightButton.setToolTipText("Create light");
755
+ lightButton.addActionListener(this);
756
+
757
+ for (int i=6; --i>=0;)
758
+ {
759
+ oe.toolboxPanel.Return();
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ oe.toolboxPanel.add(new cGridBag());
762
+ oe.toolboxPanel.add(new cGridBag());
763
+ oe.toolboxPanel.add(new cGridBag());
764
+ oe.toolboxPanel.add(new cGridBag());
765
+ oe.toolboxPanel.add(new cGridBag());
766
+ oe.toolboxPanel.add(new cGridBag());
767
+ }
768
+
769
+ // EDIT panel
770
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ editButton.setToolTipText("Pin selection controls");
772
+ editButton.addActionListener(this);
773
+
774
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ uneditButton.setToolTipText("Remove selection controls");
557776 uneditButton.addActionListener(this);
558777
559
- oe.aConstraints.gridx += 1;
560
- oe.aConstraints.weighty = 0;
561
- oe.aConstraints.gridwidth = 1;
562
-
563
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
564
- clearPanelButton.addActionListener(this);
565
-
566
- oe.aConstraints.gridx += 1;
567
- oe.aConstraints.weighty = 0;
568
- oe.aConstraints.gridwidth = 1;
569
-
570
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
778
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
779
+ allParamsButton.setToolTipText("Show all controle");
571780 allParamsButton.addActionListener(this);
572781
573
- oe.aConstraints.gridx += 1;
574
- oe.aConstraints.weighty = 0;
575
- oe.aConstraints.gridwidth = 1;
576
-
577
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
782
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
783
+ clearPanelButton.setToolTipText("Clear edit panel");
784
+ clearPanelButton.addActionListener(this);
785
+
786
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
787
+ unselectButton.setToolTipText("Unselect");
578788 unselectButton.addActionListener(this);
579789
790
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
791
+ flashSelectionButton.setToolTipText("Highlight selection");
792
+ flashSelectionButton.addActionListener(this);
793
+
794
+ editCommandsPanel.preferredHeight = 1;
795
+
796
+ SetPinStates(false);
797
+// oe.treePanel.add(commandsPanel);
798
+// oe.treePanel.Return();
799
+
580800 // oe.aConstraints.gridx += 1;
581801 // oe.aConstraints.weighty = 0;
582802 // oe.aConstraints.gridwidth = 1;
....@@ -588,40 +808,22 @@
588808 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
589809 // gcButton.addActionListener(this);
590810
591
- oe.aConstraints.gridx = 0;
592
- oe.aConstraints.gridy += 1;
593
-
594
- //ctrlPanel.add(objList = new List(5, true));
595
- oe.aConstraints.gridwidth = 100;
596
- // oe.aConstraints.gridheight = 100;
597
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
598
- oe.aConstraints.gridheight = 1;
599
- oe.aConstraints.weighty = 0.5;
600
- oe.aConstraints.gridx = 0;
601
- JScrollPane jSP;
811
+ cGridBag jSPPanel = new cGridBag();
812
+
813
+ JScrollPane jSP;
602814 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
603
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
815
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
604816 ResetModel();
605
- oe.aConstraints.weighty = 0.5;
606
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
607
- oe.aConstraints.gridy += 1;
608
- oe.aConstraints.gridwidth = 1;
609
-
610
- oe.aConstraints.weighty = 0;
611
- oe.aConstraints.gridwidth = 2;
612
-
613
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
614
- colorCB.addItemListener(this);
615
- oe.aConstraints.gridx += 2;
616
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
617
- materialCB.addItemListener(this);
618
- oe.aConstraints.gridx += 2;
619
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
620
- textureCB.addItemListener(this);
621
-
622
- oe.aConstraints.gridx = 0;
623
- oe.aConstraints.gridy += 1;
624817
818
+ oe.treePanel.add(jSPPanel);
819
+ oe.treePanel.Return();
820
+
821
+ oe.treePanel.add(copyOptionsPanel);
822
+ oe.treePanel.Return();
823
+
824
+// mainPanel.setDividerLocation(0.5); //1.0);
825
+// mainPanel.setResizeWeight(0.5);
826
+
625827 //jList.addListSelectionListener(this);
626828 oe.jTree.addTreeSelectionListener(this);
627829 //jTree.setRootVisible(false);
....@@ -643,20 +845,157 @@
643845 radio.layout = sevenButton;
644846 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
645847 }
848
+
849
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
850
+ {
851
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
852
+ colorCB.setToolTipText("Copy color when dropped");
853
+ colorCB.addItemListener(this);
854
+
855
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
856
+ materialCB.setToolTipText("Copy material when dropped");
857
+ materialCB.addItemListener(this);
858
+
859
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
860
+ textureCB.setToolTipText("Copy texture when dropped");
861
+ textureCB.addItemListener(this);
862
+
863
+ panel.Return();
864
+
865
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
866
+ boxCB.setToolTipText("Display bounding boxes");
867
+ boxCB.addItemListener(this);
868
+
869
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
870
+ zoomBoxCB.setToolTipText("Display only for wheel");
871
+ zoomBoxCB.addItemListener(this);
872
+
873
+ if (true) // Globals.ADVANCED)
874
+ {
875
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
876
+// supportCB.setToolTipText("Enable rigging");
877
+// supportCB.addItemListener(this);
878
+
879
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
880
+ freezeCB.setToolTipText("Fast moving camera");
881
+ freezeCB.addItemListener(this);
882
+
883
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
884
+ // localCB.addItemListener(this);
885
+
886
+ panel.Return();
887
+
888
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
889
+ crowdCB.setToolTipText("Used for crowds");
890
+ crowdCB.addItemListener(this);
891
+
892
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
893
+ smoothCB.setToolTipText("Snapping delay");
894
+ smoothCB.addItemListener(this);
895
+
896
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
897
+ slowCB.setToolTipText("Smooth interpolation");
898
+ slowCB.addItemListener(this);
899
+
900
+// constraints.gridy += 1;
901
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
902
+// speakerMocapCB.addItemListener(this);
903
+
904
+ panel.Return();
905
+
906
+ if (false)
907
+ {
908
+ // handled in scripts
909
+ //constraints.gridy += 1;
910
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
911
+ speakerCameraCB.addItemListener(this);
912
+
913
+ //constraints.gridy += 1;
914
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
915
+ speakerFocusCB.addItemListener(this);
916
+
917
+ //constraints.gridy += 1;
918
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
919
+ smoothfocusCB.addItemListener(this);
920
+ panel.Return();
921
+ }
922
+
923
+//constraints.gridx += 1;
924
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
925
+// debugCB.addItemListener(this);
926
+
927
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
928
+ trackCB.setToolTipText("Enable tracking target");
929
+ trackCB.addItemListener(this);
930
+
931
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
932
+ oeilCB.setToolTipText("Move camera when tracking");
933
+ oeilCB.addItemListener(this);
934
+
935
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
936
+ shadowCB.setToolTipText("When live compute shadows");
937
+ shadowCB.addItemListener(this);
938
+
939
+ panel.Return();
940
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
941
+ toggleTextureCB.setToolTipText("Load textures");
942
+ toggleTextureCB.addItemListener(this);
943
+
944
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
945
+ toggleSwitchCB.setToolTipText("Choose a single item");
946
+ toggleSwitchCB.addItemListener(this);
947
+
948
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
949
+ autosaveCB.setToolTipText("On structure change");
950
+ autosaveCB.addItemListener(this);
951
+
952
+ panel.Return();
953
+ if (Globals.ADVANCED)
954
+ {
955
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
956
+ lookAtCB.setToolTipText("Look-at target");
957
+ lookAtCB.addItemListener(this);
958
+ }
959
+
960
+ }
961
+
962
+ cGridBag fill = new cGridBag();
963
+ fill.preferredHeight = 200;
964
+ cGridBag fill2 = new cGridBag();
965
+ fill2.preferredHeight = 200;
966
+ cGridBag fill3 = new cGridBag();
967
+ fill3.preferredHeight = 200;
968
+
969
+ panel.add(fill);
970
+ panel.add(fill2);
971
+ panel.add(fill3);
972
+
973
+ }
646974
647975 void EditObject(Object3D obj)
648976 {
649
- cRadio dummyButton = new cRadio(obj.name);
650
- dummyButton.SetObject(obj);
651
- dummyButton.layout = sevenButton;
652
- dummyButton.SetCamera(cameraView.renderCamera, false);
653
- dummyButton.addActionListener(this);
654
- radioPanel.add(dummyButton);
655
- buttonGroup.add(dummyButton);
656
- dummyButton.doClick();
977
+ cRadio radioButton = new cRadio(obj.name);
978
+
979
+ // June 2019. Patch to avoid bug with transparency.
980
+ radioButton.hadMaterial = obj.material != null;
981
+ if (!radioButton.hadMaterial)
982
+ {
983
+ obj.material = new cMaterial();
984
+ }
985
+
986
+ radioButton.SetObject(obj);
987
+ radioButton.layout = sevenButton;
988
+ radioButton.SetCamera(cameraView.renderCamera, false);
989
+ radioButton.addActionListener(this);
990
+ radioPanel.add(radioButton);
991
+ buttonGroup.add(radioButton);
992
+ radioButton.doClick();
657993 }
994
+
658995 void SetupViews(ObjEditor oe)
659996 {
997
+ theFrame = this;
998
+
660999 oe.SetupViews();
6611000
6621001 System.out.println("SetupViews");
....@@ -665,22 +1004,28 @@
6651004 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6661005 }
6671006
668
- JCheckBox liveCB;
669
- JCheckBox supportCB;
670
- JCheckBox localCB;
671
- JCheckBox crowdCB;
672
- JCheckBox smoothCB;
673
- JCheckBox fastCB;
674
- JCheckBox slowCB;
675
- JCheckBox boxCB;
676
- JCheckBox trackCB;
677
- JCheckBox smoothfocusCB;
1007
+ cToggleButton liveCB;
1008
+ cCheckBox supportCB;
1009
+ cCheckBox localCB;
1010
+ cCheckBox crowdCB;
1011
+ cCheckBox smoothCB;
1012
+ cToggleButton fastCB;
1013
+ cCheckBox slowCB;
1014
+ cCheckBox boxCB;
1015
+ cCheckBox zoomBoxCB;
1016
+ cCheckBox freezeCB;
1017
+ //cToggleButton trackCB;
1018
+ cCheckBox trackCB;
1019
+ cCheckBox smoothfocusCB;
6781020 // JCheckBox speakerMocapCB;
679
- JCheckBox speakerCameraCB;
680
- JCheckBox speakerFocusCB;
681
- JCheckBox debugCB;
682
- JCheckBox oeilCB;
683
- JCheckBox lookAtCB;
1021
+ cCheckBox speakerCameraCB;
1022
+ cCheckBox speakerFocusCB;
1023
+ cCheckBox debugCB;
1024
+
1025
+ cCheckBox oeilCB;
1026
+ cCheckBox shadowCB;
1027
+ cCheckBox autosaveCB;
1028
+ cCheckBox lookAtCB;
6841029
6851030 // static int COLOR = 1;
6861031 // static int MATERIAL = 2;
....@@ -688,9 +1033,9 @@
6881033
6891034 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6901035
691
- JCheckBox colorCB;
692
- JCheckBox materialCB;
693
- JCheckBox textureCB;
1036
+ cCheckBox colorCB;
1037
+ cCheckBox materialCB;
1038
+ cCheckBox textureCB;
6941039
6951040 public void itemStateChanged(ItemEvent e)
6961041 {
....@@ -715,10 +1060,10 @@
7151060 dropAttributes |= Object3D.TEXTURE;
7161061 else
7171062 dropAttributes &= ~Object3D.TEXTURE;
718
- }
719
- else if(e.getSource() == liveCB)
1063
+ } else if(e.getSource() == liveCB)
7201064 {
7211065 cameraView.ToggleLive();
1066
+ refreshContents(false);
7221067 }
7231068 else if(e.getSource() == supportCB)
7241069 {
....@@ -754,6 +1099,10 @@
7541099 cameraView.repaint();
7551100 // refreshContents();
7561101 }
1102
+ else if(e.getSource() == zoomBoxCB)
1103
+ {
1104
+ cameraView.ToggleZoomBoxMode();
1105
+ }
7571106 else if(e.getSource() == smoothfocusCB)
7581107 {
7591108 cameraView.ToggleSmoothFocus();
....@@ -779,6 +1128,18 @@
7791128 {
7801129 cameraView.ToggleOeil();
7811130 }
1131
+ else if(e.getSource() == shadowCB)
1132
+ {
1133
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1134
+ }
1135
+ else if(e.getSource() == freezeCB)
1136
+ {
1137
+ Globals.FREEZEONMOVE ^= true;
1138
+ }
1139
+ else if(e.getSource() == autosaveCB)
1140
+ {
1141
+ Globals.SAVEONMAKE ^= true;
1142
+ }
7821143 else if(e.getSource() == lookAtCB)
7831144 {
7841145 cameraView.ToggleLookAt();
....@@ -795,7 +1156,8 @@
7951156
7961157 /**/
7971158 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
798
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1159
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1160
+ TreePath path = objEditor.jTree.getSelectionPath();
7991161 if ((path == null) || (path.getPathCount() <= 1)) {
8001162 // We can't move the root node or an empty selection
8011163 return;
....@@ -858,8 +1220,6 @@
8581220 }
8591221 }
8601222
861
- String string = (String) object;
862
-
8631223 System.out.println("Transfer = " + object + "; drop : " + target);
8641224 // if( object instanceof java.io.File[])
8651225 // {
....@@ -867,7 +1227,11 @@
8671227 // objEditor.DropFile((java.io.File[]) object, true);
8681228 // return;
8691229 // }
870
- if (string.charAt(0) == '/')
1230
+
1231
+ String string = object.toString();
1232
+
1233
+ // File path for Mac and Windows
1234
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8711235 {
8721236 // file(s)
8731237 String[] names = string.split("\n");
....@@ -894,7 +1258,7 @@
8941258
8951259 flashIt = false;
8961260 CameraPane pane = (CameraPane) target;
897
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1261
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8981262 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8991263
9001264 if (group.selection.size() == 1)
....@@ -910,23 +1274,33 @@
9101274
9111275 assert target == objEditor.jTree;
9121276 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1277
+ Object3D destinationLeaf;
9131278 try {
914
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1279
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9151280 } catch (Exception e) {
9161281 System.out.println("destinationPath : " + destinationPath);
9171282 return;
9181283 }
9191284
920
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1285
+ for (int i=group.selection.size(); --i>=0;)
9211286 {
1287
+ Object3D child = (Object3D)group.selection.elementAt(i);
1288
+
1289
+ // Cannot move into itself
1290
+ if (child == destinationLeaf)
1291
+ return;
1292
+ }
1293
+
1294
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1295
+// {
9221296 loadClipboard(true);
9231297 objEditor.jTree.setSelectionPath(destinationPath);
924
- pasteInto(false);
925
- } else {
926
- loadClipboard(false);
927
- objEditor.jTree.setSelectionPath(destinationPath);
928
- pasteInto(false); // true); // ???
929
- }
1298
+ pasteInto(false, false);
1299
+// } else {
1300
+// loadClipboard(false);
1301
+// objEditor.jTree.setSelectionPath(destinationPath);
1302
+// pasteInto(false, false); // true); // ???
1303
+// }
9301304 }
9311305 public void dropActionChanged(DropTargetDragEvent dtde)
9321306 // Called if the user has modified the current drop gesture
....@@ -1031,85 +1405,107 @@
10311405 {
10321406 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10331407 //heightFieldItem.addActionListener(this);
1034
- gridItem = menu.add(new MenuItem("Grid"));
1035
- gridItem.addActionListener(this);
1036
- rectoidItem = menu.add(new MenuItem("Box"));
1037
- rectoidItem.addActionListener(this);
1038
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1039
- ellipsoidItem.addActionListener(this);
1040
- coneItem = menu.add(new MenuItem("Cone"));
1041
- coneItem.addActionListener(this);
1042
- torusItem = menu.add(new MenuItem("Torus"));
1043
- torusItem.addActionListener(this);
1044
- superItem = menu.add(new MenuItem("Superellipsoid"));
1045
- superItem.addActionListener(this);
1408
+// gridItem = menu.add(new MenuItem("Grid"));
1409
+// gridItem.addActionListener(this);
1410
+// rectoidItem = menu.add(new MenuItem("Box"));
1411
+// rectoidItem.addActionListener(this);
1412
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1413
+// ellipsoidItem.addActionListener(this);
1414
+// coneItem = menu.add(new MenuItem("Cone"));
1415
+// coneItem.addActionListener(this);
1416
+// torusItem = menu.add(new MenuItem("Torus"));
1417
+// torusItem.addActionListener(this);
1418
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1419
+// superItem.addActionListener(this);
1420
+
1421
+ cameraItem = menu.add(new MenuItem("Camera"));
1422
+ cameraItem.addActionListener(this);
1423
+
1424
+ if (!Globals.ADVANCED)
1425
+ {
10461426 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10471427 kleinItem.addActionListener(this);
1048
- particleItem = menu.add(new MenuItem("Particle system"));
1049
- particleItem.addActionListener(this);
1428
+ }
1429
+
1430
+// particleItem = menu.add(new MenuItem("Particle system"));
1431
+// particleItem.addActionListener(this);
1432
+ if (Globals.ADVANCED)
1433
+ {
10501434 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10511435 ragdollItem.addActionListener(this);
10521436 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10531437 ragdoll2Item.addActionListener(this);
1438
+ }
10541439 menu.add("-");
1055
- meshItem = menu.add(new MenuItem("Mesh"));
1440
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10561441 meshItem.addActionListener(this);
10571442 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10581443 // meshGroupItem.addActionListener(this);
1444
+ if (Globals.ADVANCED)
1445
+ {
10591446 springItem = menu.add(new MenuItem("Spring"));
10601447 springItem.addActionListener(this);
10611448 flagItem = menu.add(new MenuItem("Flag"));
10621449 flagItem.addActionListener(this);
1063
- bezierItem = menu.add(new MenuItem("Patch"));
1064
- bezierItem.addActionListener(this);
1065
- checkerItem = menu.add(new MenuItem("Checker"));
1066
- checkerItem.addActionListener(this);
10671450 blobItem = menu.add(new MenuItem("Blob"));
10681451 blobItem.addActionListener(this);
10691452 latheItem = menu.add(new MenuItem("Lathe"));
10701453 latheItem.addActionListener(this);
1071
- lightItem = menu.add(new MenuItem("Light"));
1072
- lightItem.addActionListener(this);
1454
+ }
1455
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1456
+ bezierItem.addActionListener(this);
1457
+// overlayItem = menu.add(new MenuItem("Overlay"));
1458
+// overlayItem.addActionListener(this);
1459
+// lightItem = menu.add(new MenuItem("Light"));
1460
+// lightItem.addActionListener(this);
10731461 menu.add("-");
10741462 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10751463 //superLoopItem.addActionListener(this);
1076
- loopItem = menu.add(new MenuItem("Loop"));
1077
- loopItem.addActionListener(this);
1464
+// loopItem = menu.add(new MenuItem("Loop"));
1465
+// loopItem.addActionListener(this);
10781466 doubleItem = menu.add(new MenuItem("Fork"));
10791467 doubleItem.addActionListener(this);
1468
+ if (Globals.ADVANCED)
1469
+ {
10801470 tripleItem = menu.add(new MenuItem("Trident"));
10811471 tripleItem.addActionListener(this);
1472
+ }
10821473 }
10831474
10841475 void buildToolsMenu(Menu menu)
10851476 {
10861477 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10871478 animationItem.addItemListener(this);
1088
- animationItem.setState(CameraPane.ANIMATION);
1479
+ animationItem.setState(Globals.ANIMATION);
1480
+
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
10891483
10901484 menu.add("-");
10911485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10921486 parseverticesItem.addActionListener(this);
10931487 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10941488 textureFieldItem.addActionListener(this);
1095
- alignItem = menu.add(new MenuItem("Align"));
1489
+ alignItem = menu.add(new MenuItem("Align Objects"));
10961490 alignItem.addActionListener(this);
1097
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1098
- mirrorItem.addActionListener(this);
10991491 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11001492 reduceMorphItem.addActionListener(this);
11011493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11021494 reduce34MorphItem.addActionListener(this);
1103
-
1104
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1105
- computeAOItem.addActionListener(this);
11061495 menu.add("-");
1107
-
11081496 menu.add(memoryItem = new MenuItem("Memory Usage"));
11091497 memoryItem.addActionListener(this);
1498
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1499
+ computeAOItem.addActionListener(this);
1500
+
1501
+ if (Globals.ADVANCED)
1502
+ {
1503
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1504
+ mirrorItem.addActionListener(this);
1505
+ menu.add("-");
11101506 menu.add(analyzeItem = new MenuItem("Analyze"));
11111507 analyzeItem.addActionListener(this);
1112
- menu.add(dumpItem = new MenuItem("Dump"));
1508
+ menu.add(dumpItem = new MenuItem("Print"));
11131509 dumpItem.addActionListener(this);
11141510 // menu.add(pathItem = new MenuItem("From-to path"));
11151511 // pathItem.addActionListener(this);
....@@ -1118,6 +1514,8 @@
11181514 resetParentItem.addActionListener(this);
11191515 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11201516 repairParentItem.addActionListener(this);
1517
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1518
+ repairShadowItem.addActionListener(this);
11211519 menu.add(invariantsItem = new MenuItem("Invariants"));
11221520 invariantsItem.addActionListener(this);
11231521 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1125,6 +1523,7 @@
11251523 menu.add("-");
11261524 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11271525 editScriptItem.addActionListener(this);
1526
+ }
11281527 }
11291528
11301529 void ScreenFit()
....@@ -1247,9 +1646,24 @@
12471646 shadow.material = new cMaterial(obj.material);
12481647 shadow.material.diffuse = 0.0001f;
12491648 shadow.material.specular = 0.0001f;
1649
+ //shadow.projectedVertices[1].x = 300;
12501650
12511651 makeSomething(shadow);
12521652 }
1653
+
1654
+ private void ClearUnpinned()
1655
+ {
1656
+ //for (Object3D obj : listUI)
1657
+ for (int i=listUI.size(); --i>=0;)
1658
+ {
1659
+ Object3D obj = listUI.elementAt(i);
1660
+ if (!obj.pinned)
1661
+ {
1662
+ obj.CloseUI();
1663
+ listUI.remove(i);
1664
+ }
1665
+ }
1666
+ }
12531667
12541668 /**
12551669 * applyExample
....@@ -1453,9 +1867,9 @@
14531867
14541868 void Overwrite(int mask)
14551869 {
1456
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1870
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14571871 {
1458
- Object3D content = GrafreeD.clipboard.get(0);
1872
+ Object3D content = Grafreed.clipboard.get(0);
14591873
14601874 if (content instanceof cGroup && ((cGroup)content).transientlink )
14611875 content = ((cGroup)content).get(0);
....@@ -1478,6 +1892,7 @@
14781892 //
14791893 public void actionPerformed(ActionEvent event) // , Object arg)
14801894 {
1895
+ Object source = event.getSource();
14811896 /*
14821897 if (event.getSource() == nameField)
14831898 {
....@@ -1489,11 +1904,11 @@
14891904 }
14901905 else
14911906 */
1492
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1907
+ if (source == lookAtItem || source == lookFromItem)
14931908 {
14941909 ScreenFit();
14951910 } else
1496
- if (event.getSource() == switchItem)
1911
+ if (source == switchViewItem)
14971912 {
14981913 cVector v1 = new cVector();
14991914 cVector v2 = new cVector();
....@@ -1502,11 +1917,11 @@
15021917 objEditor.cameraView.renderCamera.setAim(v2, v1);
15031918 objEditor.cameraView.repaint();
15041919 } else
1505
- if (event.getSource() == rectoidItem)
1920
+ if (source == rectoidItem || source == boxButton)
15061921 {
15071922 makeSomething(new Box());
15081923 } else
1509
- if (event.getSource() == particleItem)
1924
+ if (source == particleItem || source == particlesButton)
15101925 {
15111926 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15121927 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1527,9 +1942,9 @@
15271942 applyExample(particleGeom, "SMOKE");
15281943 makeSomething(particleGeom);
15291944 } else
1530
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1945
+ if (source == ragdollItem || source == ragdoll2Item)
15311946 {
1532
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1947
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15331948
15341949 ragdoll.toParent = LA.newMatrix();
15351950 ragdoll.fromParent = LA.newMatrix();
....@@ -1547,7 +1962,7 @@
15471962 } else
15481963 /*
15491964 */
1550
- if (event.getSource() == heightFieldItem)
1965
+ if (source == heightFieldItem)
15511966 {
15521967 Object3D obj = new Object3D();
15531968
....@@ -1585,31 +2000,31 @@
15852000
15862001 makeSomething(obj);
15872002 } else
1588
- if (event.getSource() == gridItem)
2003
+ if (source == gridItem || source == gridButton)
15892004 {
15902005 makeSomething(new Grid());
15912006 } else
1592
- if (event.getSource() == ellipsoidItem)
2007
+ if (source == ellipsoidItem || source == sphereButton)
15932008 {
15942009 makeSomething(new Sphere());
15952010 } else
1596
- if (event.getSource() == coneItem)
2011
+ if (source == coneItem || source == coneButton)
15972012 {
15982013 makeSomething(new Cone());
15992014 } else
1600
- if (event.getSource() == torusItem)
2015
+ if (source == torusItem || source == torusButton)
16012016 {
16022017 makeSomething(new Torus());
16032018 } else
1604
- if (event.getSource() == superItem)
2019
+ if (source == superItem || source == superButton)
16052020 {
16062021 makeSomething(new Superellipsoid());
16072022 } else
1608
- if (event.getSource() == kleinItem)
2023
+ if (source == kleinItem || source == kleinButton)
16092024 {
16102025 makeSomething(new Klein());
16112026 } else
1612
- if (event.getSource() == blobItem)
2027
+ if (source == blobItem)
16132028 {
16142029 Blob blob = new Blob();
16152030 BlobComponent comp = new BlobComponent();
....@@ -1617,15 +2032,15 @@
16172032 //blob.retile();
16182033 makeSomething(blob);
16192034 } else
1620
- if (event.getSource() == latheItem)
2035
+ if (source == latheItem)
16212036 {
16222037 makeSomething(new Lathe());
16232038 } else
1624
- if (event.getSource() == bezierItem)
2039
+ if (source == bezierItem)
16252040 {
16262041 makeSomething(new BezierSurface());
16272042 } else
1628
- if (event.getSource() == checkerItem)
2043
+ if (source == overlayItem || source == overlayButton)
16292044 {
16302045 /*
16312046 Object3D obj = new BezierSurface(5,8);
....@@ -1640,7 +2055,7 @@
16402055 */
16412056 makeSomething(new Checker());
16422057 } else
1643
- if (event.getSource() == meshItem)
2058
+ if (source == meshItem)
16442059 {
16452060 Object3D itemtomake = new Object3D();
16462061 Object3D child;
....@@ -1661,35 +2076,35 @@
16612076 makeSomething(child);
16622077 }
16632078 } else
1664
- if (event.getSource() == springItem)
2079
+ if (source == springItem)
16652080 {
16662081 cSpring s = new cSpring();
16672082 s.setup();
16682083 makeSomething(s);
16692084 } else
1670
- if (event.getSource() == flagItem)
2085
+ if (source == flagItem)
16712086 {
16722087 cSpring s = new cFlag();
16732088 s.setup();
16742089 makeSomething(s);
16752090 } else
1676
- if (event.getSource() == lightItem)
2091
+ if (source == lightItem || source == lightButton)
16772092 {
16782093 makeSomething(new Light());
16792094 } else
1680
- if (event.getSource() == csgItem)
2095
+ if (source == csgItem)
16812096 {
16822097 group(new CSG());
16832098 } else
1684
- if (event.getSource() == templateItem)
2099
+ if (source == templateItem)
16852100 {
16862101 group(new cTemplate());
16872102 } else
1688
- if (event.getSource() == attributeItem)
2103
+ if (source == attributeItem)
16892104 {
16902105 makeSomething(new Attribute());
16912106 } else
1692
- if (event.getSource() == pointflowItem)
2107
+ if (source == pointflowItem)
16932108 {
16942109 makeSomething(new PointFlow());
16952110 } else
....@@ -1701,7 +2116,7 @@
17012116 } else
17022117 */
17032118
1704
- if (event.getSource() == superLoopItem)
2119
+ if (source == superLoopItem)
17052120 {
17062121 Composite g = new cGroup();
17072122 for (int i=0; i<15; i++)
....@@ -1723,30 +2138,30 @@
17232138
17242139 group(g);
17252140 } else
1726
- if (event.getSource() == loopItem)
2141
+ if (source == loopItem || source == loopButton)
17272142 {
17282143 Composite csg = new GroupLeaf();
17292144 csg.count = 5;
17302145 group(csg);
1731
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
17322147 csg.addChild(child);
17332148 child.addChild(csg);
17342149 } else
1735
- if (event.getSource() == doubleItem)
2150
+ if (source == doubleItem)
17362151 {
1737
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
17382153 csg.count = 5;
17392154 group(csg);
1740
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
17412156 csg.addChild(child);
17422157 child.addChild(csg);
1743
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
17442159 csg.addChild(child);
17452160 child.addChild(csg);
17462161 } else
1747
- if (event.getSource() == tripleItem)
2162
+ if (source == tripleItem)
17482163 {
1749
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
17502165 csg.count = 4;
17512166 group(csg);
17522167 Composite child = new cGroup();
....@@ -1759,73 +2174,84 @@
17592174 csg.addChild(child);
17602175 child.addChild(csg);
17612176 } else
1762
-
1763
- if (event.getSource() == importGFDItem)
2177
+ if (source == computeAOItem)
17642178 {
1765
- ImportGFD();
2179
+ Globals.drawMode = CameraPane.OCCLUSION;
2180
+ Globals.theRenderer.repaint();
17662181 } else
1767
- if (event.getSource() == importVRMLX3DItem)
1768
- {
1769
- ImportVRMLX3D();
1770
- } else
1771
- if (event.getSource() == import3DSItem)
1772
- {
1773
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1774
- } else
1775
- if (event.getSource() == importOBJItem)
1776
- {
1777
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1778
- } else
1779
- if (event.getSource() == computeAOItem)
1780
- {
1781
- CameraPane.drawMode = CameraPane.OCCLUSION;
1782
- CameraPane.theRenderer.repaint();
1783
- } else
1784
- if (event.getSource() == recompileItem)
2182
+ if (source == recompileItem)
17852183 {
17862184 Recompile();
17872185 refreshContents();
17882186 } else
1789
- if (event.getSource() == editScriptItem)
2187
+ if (source == editScriptItem)
17902188 {
17912189 OpenDialog();
17922190 refreshContents();
17932191 } else
1794
- if (event.getSource() == invariantsItem)
2192
+ if (source == invariantsItem)
17952193 {
17962194 System.out.println("Invariants:");
1797
- GrafreeD.grafreeD.universe.invariants();
2195
+ Grafreed.grafreeD.universe.invariants();
17982196 } else
1799
- if (event.getSource() == memoryItem)
2197
+ if (source == memoryItem)
18002198 {
18012199 //System.out.println("Invariants:");
18022200 PrintMemory();
18032201 } else
1804
- if (event.getSource() == pathItem)
2202
+ if (source == pathItem)
18052203 {
18062204 PrintPath();
18072205 } else
1808
- if (event.getSource() == analyzeItem)
2206
+ if (source == analyzeItem)
18092207 {
18102208 AnalyzeObject();
18112209 } else
1812
- if (event.getSource() == dumpItem)
2210
+ if (source == dumpItem)
18132211 {
18142212 DumpObject();
18152213 } else
1816
- if (event.getSource() == screenfitButton)
2214
+ if (source == minButton)
18172215 {
1818
- //Reload(lastConverter, lastFilename, true);
2216
+ Minimize();
2217
+ } else
2218
+ if (source == maxButton)
2219
+ {
2220
+ Maximize();
2221
+ } else
2222
+ if (source == fullButton)
2223
+ {
2224
+ ToggleFullScreen();
2225
+ } else
2226
+ if (source == undoButton)
2227
+ {
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
2230
+ } else
2231
+ if (source == redoButton)
2232
+ {
2233
+ Redo();
2234
+ } else
2235
+ if (source == saveButton)
2236
+ {
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
2239
+ } else
2240
+ if (source == oneStepButton)
2241
+ {
2242
+ Globals.ONESTEP = true;
2243
+ cameraView.repaint();
2244
+ } else
2245
+ if (source == screenfitButton)
2246
+ {
18192247 ScreenFit();
18202248 } else
1821
- if (event.getSource() == screenfitpointButton)
2249
+ if (source == screenfitpointButton)
18222250 {
1823
- //Reload(lastConverter, lastFilename, true);
18242251 ScreenFitPoint();
18252252 } else
1826
- if (event.getSource() == snapobjectButton)
2253
+ if (source == snapobjectButton)
18272254 {
1828
- //Reload(lastConverter, lastFilename, true);
18292255 SnapObject();
18302256 } else
18312257 // if (event.getSource() == recompileButton)
....@@ -1834,13 +2260,13 @@
18342260 // Recompile();
18352261 // refreshContents();
18362262 // } else
1837
- if (event.getSource() == gcButton)
2263
+ if (source == gcButton)
18382264 {
18392265 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18402266 System.gc();
18412267 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18422268 } else
1843
- if (event.getSource() == editLeafItem)
2269
+ if (source == editLeafItem)
18442270 {
18452271 Object3D obj;
18462272 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1854,62 +2280,74 @@
18542280 }
18552281 refreshContents(true);
18562282 } else
1857
- if (event.getSource() == openWindowItem)
2283
+ if (source == openWindowItem)
18582284 {
18592285 EditSelection(true);
18602286 } else
1861
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2287
+ if (source == cutItem || source == clearButton)
18622288 {
18632289 loadClipboard(true);
18642290 } else
1865
- if (event.getSource() == duplicateItem)
2291
+ if (source == undoItem)
18662292 {
1867
- Object3D keep = GrafreeD.clipboard;
2293
+ Undo();
2294
+ } else
2295
+ if (source == redoItem)
2296
+ {
2297
+ Redo();
2298
+ } else
2299
+ if (source == duplicateItem)
2300
+ {
2301
+ Object3D keep = Grafreed.clipboard;
18682302 loadClipboard(false);
18692303 paste(false);
1870
- GrafreeD.clipboard = keep;
2304
+ Grafreed.clipboard = keep;
18712305 } else
1872
- if (event.getSource() == cloneItem)
2306
+ if (source == cloneItem)
18732307 {
18742308 CloneSelection(false);
18752309 } else
1876
- if (event.getSource() == cloneSupportItem)
2310
+ if (source == cloneSupportItem)
18772311 {
18782312 CloneSelection(true);
18792313 } else
1880
- if (event.getSource() == copyItem)
2314
+ if (source == copyItem)
18812315 {
18822316 loadClipboard(false);
18832317 } else
1884
- if (event.getSource() == pasteItem)
2318
+ if (source == pasteItem)
18852319 {
18862320 paste(false);
18872321 } else
1888
- if (event.getSource() == pasteLinkItem)
2322
+ if (source == pasteIntoItem)
18892323 {
1890
- pasteInto(false);
2324
+ pasteInto(true, false);
18912325 } else
1892
- if (event.getSource() == pasteCloneItem)
2326
+ if (source == pasteLinkItem)
18932327 {
1894
- pasteInto(true);
2328
+ pasteInto(false, false);
18952329 } else
1896
- if (event.getSource() == pasteExpandItem)
2330
+ if (source == pasteCloneItem)
2331
+ {
2332
+ pasteInto(true, true);
2333
+ } else
2334
+ if (source == pasteExpandItem)
18972335 {
18982336 paste(true);
18992337 } else
1900
- if (event.getSource() == synchronizeItem)
2338
+ if (source == synchronizeItem)
19012339 {
19022340 Overwrite(Object3D.TRANSFORM);
19032341 } else
1904
- if (event.getSource() == overwriteNameItem)
2342
+ if (source == overwriteNameItem)
19052343 {
19062344 Overwrite(Object3D.NAME);
19072345 } else
1908
- if (event.getSource() == overwriteUVItem)
2346
+ if (source == overwriteUVItem)
19092347 {
19102348 Overwrite(Object3D.UV);
19112349 } else
1912
- if (event.getSource() == overwriteMatItem)
2350
+ if (source == overwriteMatItem)
19132351 {
19142352 /* july 2015
19152353 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1929,7 +2367,7 @@
19292367
19302368 Overwrite(dropAttributes);
19312369 }
1932
- if (event.getSource() == overwriteGeoItem)
2370
+ if (source == overwriteGeoItem)
19332371 {
19342372 Overwrite(Object3D.GEOMETRY);
19352373 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1946,7 +2384,7 @@
19462384 // refreshContents();
19472385 // }
19482386 } else
1949
- if (event.getSource() == generateMeshItem)
2387
+ if (source == generateMeshItem)
19502388 {
19512389 //if (group.selection.size() == 1)
19522390 // for (int i=0; i<group.selection.size(); i++)
....@@ -1957,7 +2395,7 @@
19572395 ResetModel();
19582396 refreshContents();
19592397 } else
1960
- if (event.getSource() == extractGeometriesItem)
2398
+ if (source == extractGeometriesItem)
19612399 {
19622400 boolean one = false;
19632401
....@@ -1984,7 +2422,7 @@
19842422 ResetModel();
19852423 refreshContents();
19862424 } else
1987
- if (event.getSource() == cloneGeometriesItem)
2425
+ if (source == cloneGeometriesItem)
19882426 {
19892427 boolean one = false;
19902428
....@@ -2010,7 +2448,7 @@
20102448 ResetModel();
20112449 refreshContents();
20122450 } else
2013
- if (event.getSource() == shareGeometriesItem)
2451
+ if (source == shareGeometriesItem)
20142452 {
20152453 boolean one = false;
20162454
....@@ -2040,7 +2478,7 @@
20402478 refreshContents();
20412479 }
20422480 } else
2043
- if (event.getSource() == mergeGeometriesItem)
2481
+ if (source == mergeGeometriesItem)
20442482 {
20452483 boolean one = false;
20462484
....@@ -2070,7 +2508,7 @@
20702508 ResetModel();
20712509 refreshContents();
20722510 } else
2073
- if (event.getSource() == linkverticesItem)
2511
+ if (source == linkverticesItem)
20742512 {
20752513 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20762514 // {
....@@ -2083,48 +2521,48 @@
20832521 // group.selection.get(0).setMasterThis(content); // should be identity
20842522 // refreshContents();
20852523 // }
2086
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2524
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20872525 {
2088
- Object3D content = GrafreeD.clipboard.get(0);
2526
+ Object3D content = Grafreed.clipboard.get(0);
20892527
20902528 if (content instanceof cGroup && ((cGroup)content).transientlink )
20912529 content = ((cGroup)content).get(0);
20922530
2093
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2531
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20942532 for (int i=0; i<group.selection.size(); i++)
20952533 {
2096
- boolean random = CameraPane.RANDOM;
2097
- CameraPane.RANDOM = false; // parse all random nodes
2534
+ boolean random = CameraPane.SWITCH;
2535
+ CameraPane.SWITCH = false; // parse all random nodes
20982536 group.selection.get(i).linkVerticesThis(content);
20992537 // group.selection.get(i).setMasterThis(content); // should be identity
2100
- CameraPane.RANDOM = random;
2538
+ CameraPane.SWITCH = random;
21012539 }
2102
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2540
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21032541 refreshContents();
21042542 }
21052543 } else
2106
- if (event.getSource() == resetsupportItem)
2544
+ if (source == resetsupportItem)
21072545 {
21082546 for (int i=0; i<group.selection.size(); i++)
21092547 {
2110
- boolean random = CameraPane.RANDOM;
2111
- CameraPane.RANDOM = false; // parse all random nodes
2548
+ boolean random = CameraPane.SWITCH;
2549
+ CameraPane.SWITCH = false; // parse all random nodes
21122550 group.selection.get(i).linkVerticesThis(null);
2113
- CameraPane.RANDOM = random;
2551
+ CameraPane.SWITCH = random;
21142552 }
21152553
21162554 refreshContents();
21172555 } else
2118
- if (event.getSource() == relinkverticesItem)
2556
+ if (source == relinkverticesItem)
21192557 {
2120
- boolean random = CameraPane.RANDOM;
2121
- CameraPane.RANDOM = false; // parse all random nodes
2558
+ boolean random = CameraPane.SWITCH;
2559
+ CameraPane.SWITCH = false; // parse all random nodes
21222560 group.selection.RelinkToSupport();
2123
- CameraPane.RANDOM = random;
2561
+ CameraPane.SWITCH = random;
21242562
21252563 refreshContents();
21262564 } else
2127
- if (event.getSource() == resetreferencesItem)
2565
+ if (source == resetreferencesItem)
21282566 {
21292567 for (int i=0; i<group.selection.size(); i++)
21302568 {
....@@ -2133,11 +2571,11 @@
21332571
21342572 refreshContents();
21352573 } else
2136
- if (event.getSource() == setMasterItem)
2574
+ if (source == setMasterItem)
21372575 {
2138
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2576
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21392577 {
2140
- Object3D content = GrafreeD.clipboard.get(0);
2578
+ Object3D content = Grafreed.clipboard.get(0);
21412579
21422580 if (content instanceof cGroup && ((cGroup)content).transientlink )
21432581 content = ((cGroup)content).get(0);
....@@ -2146,13 +2584,13 @@
21462584 refreshContents();
21472585 }
21482586 } else
2149
- if (event.getSource() == poseMeshItem)
2587
+ if (source == poseMeshItem)
21502588 {
21512589 if (group.selection.size() == 1)
21522590 {
2153
- if (GrafreeD.clipboard.size() == 1)
2591
+ if (Grafreed.clipboard.size() == 1)
21542592 {
2155
- Object3D content = GrafreeD.clipboard.get(0);
2593
+ Object3D content = Grafreed.clipboard.get(0);
21562594
21572595 if (content instanceof cGroup && ((cGroup)content).transientlink )
21582596 content = ((cGroup)content).get(0);
....@@ -2165,19 +2603,19 @@
21652603 }
21662604
21672605 } else
2168
- if (event.getSource() == revertMeshItem)
2606
+ if (source == revertMeshItem)
21692607 {
21702608 RevertMeshes();
21712609 } else
2172
- if (event.getSource() == resetMeshItem)
2610
+ if (source == resetAllItem)
21732611 {
21742612 ResetAll();
21752613 } else
2176
- if (event.getSource() == stepAllItem)
2614
+ if (source == stepAllItem)
21772615 {
21782616 StepAll();
21792617 } else
2180
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2618
+ if (source == clearItem) // || event.getSource() == clearButton)
21812619 {
21822620 //int indices[] = jList.getSelectedIndices();
21832621 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2185,46 +2623,46 @@
21852623
21862624 ClearSelection(false);
21872625 } else
2188
- if (event.getSource() == clearAllItem)
2626
+ if (source == clearAllItem)
21892627 {
21902628 ClearSelection(true);
21912629 } else
2192
- if (event.getSource() == grabItem)
2630
+ if (source == grabItem || source == groupButton)
21932631 {
2194
- group(new cGroup(), true);
2632
+ group(new cGroup(), false); // true);
21952633 } else
2196
- if (event.getSource() == hideItem)
2634
+ if (source == hideItem)
21972635 {
21982636 group(new HiddenObject());
21992637 } else
2200
- if (event.getSource() == frontItem)
2638
+ if (source == frontItem)
22012639 {
22022640 front();
22032641 } else
2204
- if (event.getSource() == backItem)
2642
+ if (source == backItem)
22052643 {
22062644 back();
22072645 } else
2208
- if (event.getSource() == cameraItem)
2646
+ if (source == cameraItem)
22092647 {
22102648 makeSomething(new Camera());
22112649 } else
2212
- if (event.getSource() == compositeItem)
2650
+ if (source == compositeItem || source == compositeButton)
22132651 {
22142652 group(new Composite());
22152653 } else
2216
- if (event.getSource() == randomItem)
2654
+ if (source == switchItem || source == switchButton)
22172655 {
22182656 RandomNode random = new RandomNode();
22192657 group(random);
22202658 if (random.size() > 0)
2221
- random.name = random.get(0).name + "Rnd";
2659
+ random.name = random.get(0).name + "Switch";
22222660 } else
2223
- if (event.getSource() == physicsItem)
2661
+ if (source == physicsItem)
22242662 {
22252663 group(new PhysicsNode());
22262664 } else
2227
- if (event.getSource() == frameselectorItem)
2665
+ if (source == frameselectorItem)
22282666 {
22292667 for (int i=0; i<group.selection.size(); i++)
22302668 {
....@@ -2236,7 +2674,7 @@
22362674 ResetModel();
22372675 refreshContents();
22382676 } else
2239
- if (event.getSource() == switchGeoItem)
2677
+ if (source == switchGeoItem)
22402678 {
22412679 for (int i=0; i<group.selection.size(); i++)
22422680 {
....@@ -2248,7 +2686,7 @@
22482686 ResetModel();
22492687 refreshContents();
22502688 } else
2251
- if (event.getSource() == switchTransfoItem)
2689
+ if (source == switchTransfoItem)
22522690 {
22532691 for (int i=0; i<group.selection.size(); i++)
22542692 {
....@@ -2260,7 +2698,7 @@
22602698 ResetModel();
22612699 refreshContents();
22622700 } else
2263
- if (event.getSource() == morphItem)
2701
+ if (source == morphItem)
22642702 {
22652703 for (int i=0; i<group.selection.size(); i++)
22662704 {
....@@ -2272,7 +2710,7 @@
22722710 ResetModel();
22732711 refreshContents();
22742712 } else
2275
- if (event.getSource() == scriptNodeItem)
2713
+ if (source == scriptNodeItem)
22762714 {
22772715 boolean atleastone = false;
22782716
....@@ -2311,215 +2749,252 @@
23112749 }
23122750 }
23132751 } else
2314
- if (event.getSource() == linkerItem)
2752
+ if (source == linkerItem)
23152753 {
23162754 group(new cLinker());
23172755 } else
2318
- if (event.getSource() == textureItem)
2756
+ if (source == textureItem || source == textureButton)
23192757 {
23202758 group(new TextureNode());
23212759 } else
2322
- if (event.getSource() == billboardItem)
2760
+ if (source == billboardItem)
23232761 {
23242762 group(new BillboardNode());
23252763 } else
2326
- if (event.getSource() == shadowXItem)
2764
+ if (source == shadowXItem)
23272765 {
23282766 CastShadow(0);
23292767 } else
2330
- if (event.getSource() == shadowYItem)
2768
+ if (source == shadowYItem)
23312769 {
23322770 CastShadow(1);
23332771 } else
2334
- if (event.getSource() == shadowZItem)
2772
+ if (source == shadowZItem)
23352773 {
23362774 CastShadow(2);
23372775 } else
2338
- if (event.getSource() == ungroupItem)
2776
+ if (source == ungroupItem || source == ungroupButton)
23392777 {
2340
- //ungroup();
2778
+ boolean hasRoot = false;
2779
+
23412780 for (int i=0; i<group.selection.size(); i++)
23422781 {
2343
- Ungroup(group.selection.get(i));
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
23442787 }
23452788
2346
- ClearSelection(false);
2347
-
2348
- refreshContents();
2789
+ if (!hasRoot)
2790
+ {
2791
+ for (int i=0; i<group.selection.size(); i++)
2792
+ {
2793
+ Ungroup(group.selection.get(i));
2794
+ }
2795
+
2796
+ ClearSelection(false);
2797
+
2798
+ refreshContents();
2799
+ }
23492800 } else
2350
- if (event.getSource() == genUVItem)
2801
+ if (source == genUVItem)
23512802 {
23522803 GenUV();
23532804 } else
2354
- if (event.getSource() == genNormalsCADItem)
2805
+ if (source == genNormalsCADItem)
23552806 {
23562807 GenNormals(true);
23572808 } else
2358
- if (event.getSource() == genNormalsMESHItem)
2809
+ if (source == genNormalsMESHItem)
23592810 {
2360
- GenNormals(true); // TODO
2811
+ GenNormalsMESH();
23612812 } else
2362
- if (event.getSource() == genNormalsORGANItem)
2813
+ if (source == genNormalsORGANItem)
23632814 {
23642815 GenNormals(false);
23652816 } else
2366
- if (event.getSource() == genNormalsMINEItem)
2817
+ if (source == genNormalsMINEItem)
23672818 {
23682819 GenNormalsMINE();
23692820 } else
2370
- if (event.getSource() == stripifyItem)
2821
+ if (source == stripifyItem)
23712822 {
23722823 Stripify();
23732824 } else
2374
- if (event.getSource() == unstripifyItem)
2825
+ if (source == unstripifyItem)
23752826 {
23762827 Unstripify();
23772828 } else
2378
- if (event.getSource() == trimItem)
2829
+ if (source == trimItem)
23792830 {
23802831 Trim();
23812832 } else
2382
- if (event.getSource() == untrimItem)
2833
+ if (source == untrimItem)
23832834 {
23842835 Untrim();
23852836 } else
2386
- if (event.getSource() == clearColorsItem)
2837
+ if (source == clearColorsItem)
23872838 {
23882839 ClearColors();
23892840 } else
2390
- if (event.getSource() == clearMaterialsItem)
2841
+ if (source == clearMaterialsItem)
23912842 {
23922843 ClearMaterials();
23932844 } else
2394
- if (event.getSource() == liveleavesItem)
2845
+ if (source == liveleavesItem)
23952846 {
23962847 LiveLeaves(true);
23972848 } else
2398
- if (event.getSource() == unliveleavesItem)
2849
+ if (source == unliveleavesItem)
23992850 {
24002851 LiveLeaves(false);
24012852 } else
2402
- if (event.getSource() == supportleavesItem)
2853
+ if (source == supportleavesItem)
24032854 {
24042855 SupportLeaves(true);
24052856 } else
2406
- if (event.getSource() == unsupportleavesItem)
2857
+ if (source == unsupportleavesItem)
24072858 {
24082859 SupportLeaves(false);
24092860 } else
2410
- if (event.getSource() == hideleavesItem)
2861
+ if (source == hideleavesItem)
24112862 {
24122863 HideLeaves(true);
24132864 } else
2414
- if (event.getSource() == showleavesItem)
2865
+ if (source == showleavesItem)
24152866 {
24162867 HideLeaves(false);
24172868 } else
2418
- if (event.getSource() == markleavesItem)
2869
+ if (source == markleavesItem)
24192870 {
24202871 MarkLeaves(true);
24212872 } else
2422
- if (event.getSource() == unmarkleavesItem)
2873
+ if (source == unmarkleavesItem)
24232874 {
24242875 MarkLeaves(false);
24252876 } else
2426
- if (event.getSource() == flipVItem)
2877
+ if (source == rewindleavesItem)
2878
+ {
2879
+ RewindLeaves(true);
2880
+ } else
2881
+ if (source == unrewindleavesItem)
2882
+ {
2883
+ RewindLeaves(false);
2884
+ } else
2885
+ if (source == randomleavesItem)
2886
+ {
2887
+ RandomLeaves(true);
2888
+ } else
2889
+ if (source == unrandomleavesItem)
2890
+ {
2891
+ RandomLeaves(false);
2892
+ } else
2893
+ if (source == flipVItem)
24272894 {
24282895 FlipV(true);
24292896 } else
2430
- if (event.getSource() == unflipVItem)
2897
+ if (source == unflipVItem)
24312898 {
24322899 FlipV(false);
24332900 } else
2434
- if (event.getSource() == lowTexturesItem)
2901
+ if (source == lowTexturesItem)
24352902 {
24362903 SetTexRes(0);
24372904 } else
2438
- if (event.getSource() == normalTexturesItem)
2905
+ if (source == normalTexturesItem)
24392906 {
24402907 SetTexRes(1);
24412908 } else
2442
- if (event.getSource() == highTexturesItem)
2909
+ if (source == highTexturesItem)
24432910 {
24442911 SetTexRes(2);
24452912 } else
2446
- if (event.getSource() == veryhighTexturesItem)
2913
+ if (source == veryhighTexturesItem)
24472914 {
24482915 SetTexRes(3);
24492916 } else
2450
- if (event.getSource() == maxTexturesItem)
2917
+ if (source == maxTexturesItem)
24512918 {
24522919 SetTexRes(4);
24532920 } else
2454
- if (event.getSource() == panoTexturesItem)
2921
+ if (source == panoTexturesItem)
24552922 {
24562923 SetTexRes(5);
24572924 } else
2458
- if (event.getSource() == reverseNormalsItem)
2925
+ if (source == reverseNormalsItem)
24592926 {
24602927 ReverseNormals();
24612928 } else
2462
- if (event.getSource() == parseverticesItem)
2929
+ if (source == parseverticesItem)
24632930 {
24642931 ParseVertices();
24652932 } else
2466
- if (event.getSource() == textureFieldItem)
2933
+ if (source == textureFieldItem)
24672934 {
24682935 TextureVertices();
24692936 } else
2470
- if (event.getSource() == alignItem)
2937
+ if (source == alignItem)
24712938 {
24722939 Align();
24732940 } else
2474
- if (event.getSource() == mirrorItem)
2941
+ if (source == mirrorItem)
24752942 {
24762943 MirrorPoses();
24772944 } else
2478
- if (event.getSource() == reduceMorphItem)
2945
+ if (source == reduceMorphItem)
24792946 {
24802947 MeshReduction(false);
24812948 } else
2482
- if (event.getSource() == reduce34MorphItem)
2949
+ if (source == reduce34MorphItem)
24832950 {
24842951 MeshReduction(true);
24852952 } else
2486
- if (event.getSource() == reverseTrianglesItem)
2953
+ if (source == reverseTrianglesItem)
24872954 {
24882955 ReverseTriangles();
24892956 } else
2490
- if (event.getSource() == reduceMeshItem)
2957
+ if (source == reduceMeshItem)
24912958 {
24922959 ReduceMesh(false);
24932960 } else
2494
- if (event.getSource() == reduce34MeshItem)
2961
+ if (source == reduce34MeshItem)
24952962 {
24962963 ReduceMesh(true);
24972964 } else
2498
- if (event.getSource() == increaseMeshItem)
2965
+ if (source == increaseMeshItem)
24992966 {
25002967 IncreaseMesh();
25012968 } else
2502
- if (event.getSource() == clipMeshItem)
2969
+ if (source == clipMeshItem)
25032970 {
25042971 ClipMesh();
25052972 } else
2506
- if (event.getSource() == smoothMeshItem)
2973
+ if (source == smoothMeshItem)
25072974 {
25082975 SmoothMesh();
25092976 } else
2510
- if (event.getSource() == transformgeometryItem)
2977
+ if (source == transformGeometryItem)
25112978 {
25122979 TransformGeometry();
25132980 } else
2514
- if (event.getSource() == resetTransformItem)
2981
+ if (source == transformChildrenItem)
2982
+ {
2983
+ TransformChildren();
2984
+ } else
2985
+ if (source == resetTransformItem)
25152986 {
25162987 ResetTransform();
25172988 } else
2518
- if (event.getSource() == resetCentroidItem)
2989
+ if (source == resetCentroidItem)
25192990 {
2520
- ResetCentroid();
2991
+ ResetCentroid(true);
25212992 } else
2522
- if (event.getSource() == resetParentItem)
2993
+ if (source == resetCentroidXZItem)
2994
+ {
2995
+ ResetCentroid(false);
2996
+ } else
2997
+ if (source == resetParentItem)
25232998 {
25242999 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25253000 {
....@@ -2529,7 +3004,7 @@
25293004
25303005 refreshContents();
25313006 } else
2532
- if (event.getSource() == repairParentItem)
3007
+ if (source == repairParentItem)
25333008 {
25343009 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25353010 {
....@@ -2543,7 +3018,21 @@
25433018
25443019 refreshContents();
25453020 } else
2546
- if (event.getSource() == sortbysizeItem)
3021
+ if (source == repairShadowItem)
3022
+ {
3023
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3024
+ {
3025
+ Object3D obj = (Object3D)e.nextElement();
3026
+ obj.RepairShadow();
3027
+// for (int i=0; i<obj.size(); i++)
3028
+// {
3029
+// obj.get(i).parent = obj;
3030
+// }
3031
+ }
3032
+
3033
+ refreshContents();
3034
+ } else
3035
+ if (source == sortbysizeItem)
25473036 {
25483037 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25493038 {
....@@ -2555,7 +3044,7 @@
25553044 ResetModel();
25563045 refreshContents();
25573046 } else
2558
- if (event.getSource() == sortbynameItem)
3047
+ if (source == sortbynameItem)
25593048 {
25603049 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25613050 {
....@@ -2567,7 +3056,7 @@
25673056 ResetModel();
25683057 refreshContents();
25693058 } else
2570
- if (event.getSource() == attachPigmentItem)
3059
+ if (source == attachPigmentItem)
25713060 {
25723061 String texture = GetFile("Attach pigment");
25733062 Object3D obj;
....@@ -2579,7 +3068,7 @@
25793068
25803069 refreshContents();
25813070 } else
2582
- if (event.getSource() == detachPigmentItem)
3071
+ if (source == detachPigmentItem)
25833072 {
25843073 Object3D obj;
25853074 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2590,7 +3079,7 @@
25903079
25913080 refreshContents();
25923081 } else
2593
- if (event.getSource() == attachBumpItem)
3082
+ if (source == attachBumpItem)
25943083 {
25953084 String texture = GetFile("Attach bump");
25963085 Object3D obj;
....@@ -2602,7 +3091,7 @@
26023091
26033092 refreshContents();
26043093 } else
2605
- if (event.getSource() == detachBumpItem)
3094
+ if (source == detachBumpItem)
26063095 {
26073096 Object3D obj;
26083097 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2613,7 +3102,7 @@
26133102
26143103 refreshContents();
26153104 } else
2616
- if (event.getSource() == pigmentBumpItem)
3105
+ if (source == pigmentBumpItem)
26173106 {
26183107 Object3D obj;
26193108 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2624,158 +3113,237 @@
26243113
26253114 refreshContents();
26263115 } else
2627
- if (event.getSource() == flashSelectionButton)
3116
+ if (source == flashSelectionButton)
26283117 {
26293118 CameraPane.flash = true;
26303119 refreshContents();
26313120 } else
2632
- if (event.getSource() == oneButton)
3121
+ if (source == oneButton)
26333122 {
26343123 } else
2635
- if (event.getSource() == twoButton)
3124
+ if (source == twoButton)
26363125 {
26373126 radio.layout = twoButton;
3127
+
3128
+ if (CameraPane.FULLSCREEN)
3129
+ fullscreenLayout = radio.layout;
3130
+
26383131 // bug
26393132 //gridPanel.setDividerLocation(1.0);
26403133 //bigPanel.setDividerLocation(0.0);
2641
- bigThree.remove(scenePanel);
2642
- bigThree.remove(cameraPanel);
2643
- bigThree.remove(XYZPanel);
2644
- aWindowConstraints.gridx = 0;
2645
- aWindowConstraints.gridy = 0;
2646
- aWindowConstraints.gridwidth = 1;
2647
- // aConstraints.gridheight = 3;
2648
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2649
- aWindowConstraints.weightx = 0;
2650
- aWindowConstraints.weighty = 1;
2651
- //bigThree.add(jtp, aWindowConstraints);
2652
- aWindowConstraints.weightx = 1;
2653
- aWindowConstraints.gridwidth = 3;
2654
- // aConstraints.gridheight = 3;
2655
- aWindowConstraints.gridx = 1;
2656
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2657
- bigThree.add(cameraPanel, aWindowConstraints);
2658
- aWindowConstraints.weightx = 0;
2659
- aWindowConstraints.gridx = 4;
2660
- aWindowConstraints.gridwidth = 1;
2661
- // aConstraints.gridheight = 3;
2662
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2663
- //bigThree.add(XYZPanel, aWindowConstraints);
2664
- bigThree.revalidate();
3134
+// bigThree.remove(scenePanel);
3135
+// bigThree.remove(centralPanel);
3136
+// bigThree.remove(XYZPanel);
3137
+// aWindowConstraints.gridx = 0;
3138
+// aWindowConstraints.gridy = 0;
3139
+// aWindowConstraints.gridwidth = 1;
3140
+// // aConstraints.gridheight = 3;
3141
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3142
+// aWindowConstraints.weightx = 0;
3143
+// aWindowConstraints.weighty = 1;
3144
+// //bigThree.add(jtp, aWindowConstraints);
3145
+// aWindowConstraints.weightx = 1;
3146
+// aWindowConstraints.gridwidth = 3;
3147
+// // aConstraints.gridheight = 3;
3148
+// aWindowConstraints.gridx = 1;
3149
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3150
+// bigThree.add(centralPanel, aWindowConstraints);
3151
+// aWindowConstraints.weightx = 0;
3152
+// aWindowConstraints.gridx = 4;
3153
+// aWindowConstraints.gridwidth = 1;
3154
+// // aConstraints.gridheight = 3;
3155
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3156
+// //bigThree.add(XYZPanel, aWindowConstraints);
3157
+// scenePanel.setVisible(false);
3158
+// centralPanel.setVisible(true);
3159
+// XYZPanel.setVisible(false);
3160
+ bigThree.ClearUI();
3161
+ bigThree.add(centralPanel);
3162
+ bigThree.FlushUI();
3163
+
3164
+ cameraView.requestFocusInWindow();
3165
+
3166
+// refreshContents(true);
3167
+//
3168
+// try
3169
+// {
3170
+// java.awt.Robot bot = new java.awt.Robot();
3171
+// int mask = InputEvent.BUTTON1_MASK;
3172
+// bot.mouseMove(100, 100);
3173
+// bot.mousePress(mask);
3174
+// bot.mouseRelease(mask);
3175
+// }
3176
+// catch (Exception e)
3177
+// {
3178
+//
3179
+// }
3180
+
26653181 } else
2666
- if (event.getSource() == threeButton)
3182
+ if (source == threeButton)
26673183 {
26683184 radio.layout = threeButton;
2669
- bigThree.remove(scenePanel);
2670
- bigThree.remove(cameraPanel);
2671
- bigThree.remove(XYZPanel);
2672
- aWindowConstraints.gridx = 0;
2673
- aWindowConstraints.gridy = 0;
2674
- aWindowConstraints.gridwidth = 1;
2675
- // aConstraints.gridheight = 3;
2676
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2677
- aWindowConstraints.weightx = 0;
2678
- aWindowConstraints.weighty = 1;
2679
- //bigThree.add(jtp, aWindowConstraints);
2680
- aWindowConstraints.weightx = 1;
2681
- aWindowConstraints.gridwidth = 3;
2682
- // aConstraints.gridheight = 3;
2683
- aWindowConstraints.gridx = 1;
2684
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2685
- bigThree.add(cameraPanel, aWindowConstraints);
2686
- aWindowConstraints.weightx = 0;
2687
- aWindowConstraints.gridx = 4;
2688
- aWindowConstraints.gridwidth = 1;
2689
- // aConstraints.gridheight = 3;
2690
- aConstraints.fill = GridBagConstraints.VERTICAL;
2691
- bigThree.add(XYZPanel, aWindowConstraints);
2692
- bigThree.revalidate();
3185
+
3186
+ if (CameraPane.FULLSCREEN)
3187
+ fullscreenLayout = radio.layout;
3188
+
3189
+// bigThree.remove(scenePanel);
3190
+// bigThree.remove(centralPanel);
3191
+// bigThree.remove(XYZPanel);
3192
+// aWindowConstraints.gridx = 0;
3193
+// aWindowConstraints.gridy = 0;
3194
+// aWindowConstraints.gridwidth = 1;
3195
+// // aConstraints.gridheight = 3;
3196
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3197
+// aWindowConstraints.weightx = 0;
3198
+// aWindowConstraints.weighty = 1;
3199
+// //bigThree.add(jtp, aWindowConstraints);
3200
+// aWindowConstraints.weightx = 1;
3201
+// aWindowConstraints.gridwidth = 3;
3202
+// // aConstraints.gridheight = 3;
3203
+// aWindowConstraints.gridx = 1;
3204
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3205
+// bigThree.add(centralPanel, aWindowConstraints);
3206
+// aWindowConstraints.weightx = 0;
3207
+// aWindowConstraints.gridx = 4;
3208
+// aWindowConstraints.gridwidth = 1;
3209
+// // aConstraints.gridheight = 3;
3210
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3211
+// bigThree.add(XYZPanel, aWindowConstraints);
3212
+// bigThree.validate();
3213
+// scenePanel.setVisible(false);
3214
+// centralPanel.setVisible(true);
3215
+// XYZPanel.setVisible(true);
3216
+ bigThree.ClearUI();
3217
+ bigThree.add(centralPanel);
3218
+ bigThree.add(XYZPanel);
3219
+ bigThree.FlushUI();
3220
+
3221
+ cameraView.requestFocusInWindow();
26933222 } else
2694
- if (event.getSource() == fourButton)
3223
+ if (source == fourButton)
26953224 {
26963225 radio.layout = fourButton;
2697
- bigThree.remove(scenePanel);
2698
- bigThree.remove(cameraPanel);
2699
- bigThree.remove(XYZPanel);
2700
- aWindowConstraints.gridx = 0;
2701
- aWindowConstraints.gridy = 0;
2702
- aWindowConstraints.gridwidth = 1;
2703
- // aWindowConstraints.gridheight = 3;
2704
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2705
- aWindowConstraints.weightx = 1;
2706
- aWindowConstraints.weighty = 1;
2707
- bigThree.add(scenePanel, aWindowConstraints);
2708
- aWindowConstraints.weightx = 1;
2709
- aWindowConstraints.gridwidth = 3;
2710
- // aConstraints.gridheight = 3;
2711
- aWindowConstraints.gridx = 1;
2712
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2713
- //bigThree.add(cameraPanel, aWindowConstraints);
2714
- aWindowConstraints.weightx = 0;
2715
- aWindowConstraints.gridx = 4;
2716
- aWindowConstraints.gridwidth = 1;
2717
- // aWindowConstraints.gridheight = 3;
2718
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2719
- //bigThree.add(XYZPanel, aWindowConstraints);
2720
- bigThree.revalidate();
3226
+
3227
+ if (CameraPane.FULLSCREEN)
3228
+ fullscreenLayout = radio.layout;
3229
+
3230
+// bigThree.remove(scenePanel);
3231
+// bigThree.remove(centralPanel);
3232
+// bigThree.remove(XYZPanel);
3233
+// aWindowConstraints.gridx = 0;
3234
+// aWindowConstraints.gridy = 0;
3235
+// aWindowConstraints.gridwidth = 1;
3236
+// // aWindowConstraints.gridheight = 3;
3237
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3238
+// aWindowConstraints.weightx = 1;
3239
+// aWindowConstraints.weighty = 1;
3240
+// bigThree.add(scenePanel, aWindowConstraints);
3241
+// aWindowConstraints.weightx = 1;
3242
+// aWindowConstraints.gridwidth = 3;
3243
+// // aConstraints.gridheight = 3;
3244
+// aWindowConstraints.gridx = 1;
3245
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3246
+// //bigThree.add(cameraPanel, aWindowConstraints);
3247
+// aWindowConstraints.weightx = 0;
3248
+// aWindowConstraints.gridx = 4;
3249
+// aWindowConstraints.gridwidth = 1;
3250
+// // aWindowConstraints.gridheight = 3;
3251
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3252
+// //bigThree.add(XYZPanel, aWindowConstraints);
3253
+// bigThree.validate();
3254
+// scenePanel.setVisible(true);
3255
+// centralPanel.setVisible(false);
3256
+// XYZPanel.setVisible(false);
3257
+ bigThree.ClearUI();
3258
+ bigThree.add(scenePanel);
3259
+ bigThree.FlushUI();
3260
+
3261
+ cameraView.requestFocusInWindow();
27213262 } else
2722
- if (event.getSource() == sixButton)
3263
+ if (source == sixButton)
27233264 {
27243265 radio.layout = sixButton;
2725
- bigThree.remove(scenePanel);
2726
- bigThree.remove(cameraPanel);
2727
- bigThree.remove(XYZPanel);
2728
- aWindowConstraints.gridx = 0;
2729
- aWindowConstraints.gridy = 0;
2730
- aWindowConstraints.gridwidth = 1;
2731
- // aConstraints.gridheight = 3;
2732
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2733
- aWindowConstraints.weightx = 0;
2734
- aWindowConstraints.weighty = 1;
2735
- bigThree.add(scenePanel, aWindowConstraints);
2736
- aWindowConstraints.weightx = 1;
2737
- aWindowConstraints.gridwidth = 3;
2738
- // aWindowConstraints.gridheight = 3;
2739
- aWindowConstraints.gridx = 1;
2740
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2741
- bigThree.add(cameraPanel, aWindowConstraints);
2742
- aWindowConstraints.weightx = 0;
2743
- aWindowConstraints.gridx = 4;
2744
- aWindowConstraints.gridwidth = 1;
2745
- // aWindowConstraints.gridheight = 3;
2746
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2747
- //bigThree.add(XYZPanel, aConstraints);
2748
- bigThree.revalidate();
3266
+
3267
+ if (CameraPane.FULLSCREEN)
3268
+ fullscreenLayout = radio.layout;
3269
+
3270
+// bigThree.remove(scenePanel);
3271
+// bigThree.remove(centralPanel);
3272
+// bigThree.remove(XYZPanel);
3273
+// aWindowConstraints.gridx = 0;
3274
+// aWindowConstraints.gridy = 0;
3275
+// aWindowConstraints.gridwidth = 1;
3276
+// // aConstraints.gridheight = 3;
3277
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3278
+// aWindowConstraints.weightx = 0;
3279
+// aWindowConstraints.weighty = 1;
3280
+// bigThree.add(scenePanel, aWindowConstraints);
3281
+// aWindowConstraints.weightx = 1;
3282
+// aWindowConstraints.gridwidth = 3;
3283
+// // aWindowConstraints.gridheight = 3;
3284
+// aWindowConstraints.gridx = 1;
3285
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3286
+// bigThree.add(centralPanel, aWindowConstraints);
3287
+// aWindowConstraints.weightx = 0;
3288
+// aWindowConstraints.gridx = 4;
3289
+// aWindowConstraints.gridwidth = 1;
3290
+// // aWindowConstraints.gridheight = 3;
3291
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3292
+// //bigThree.add(XYZPanel, aConstraints);
3293
+// bigThree.validate();
3294
+// scenePanel.setVisible(true);
3295
+// centralPanel.setVisible(true);
3296
+// XYZPanel.setVisible(false);
3297
+ bigThree.ClearUI();
3298
+ bigThree.add(scenePanel);
3299
+ bigThree.add(centralPanel);
3300
+ bigThree.FlushUI();
3301
+
3302
+ cameraView.requestFocusInWindow();
27493303 } else
2750
- if (event.getSource() == sevenButton)
3304
+ if (source == sevenButton)
27513305 {
27523306 radio.layout = sevenButton;
2753
- bigThree.remove(scenePanel);
2754
- bigThree.remove(cameraPanel);
2755
- bigThree.remove(XYZPanel);
2756
- aWindowConstraints.gridx = 0;
2757
- aWindowConstraints.gridy = 0;
2758
- aWindowConstraints.gridwidth = 1;
2759
- // aWindowConstraints.gridheight = 3;
2760
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2761
- aWindowConstraints.weightx = 0;
2762
- aWindowConstraints.weighty = 1;
2763
- bigThree.add(scenePanel, aWindowConstraints);
2764
- aWindowConstraints.weightx = 1;
2765
- aWindowConstraints.gridwidth = 3;
2766
- // aWindowConstraints.gridheight = 3;
2767
- aWindowConstraints.gridx = 1;
2768
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2769
- bigThree.add(cameraPanel, aWindowConstraints);
2770
- aWindowConstraints.weightx = 0;
2771
- aWindowConstraints.gridx = 4;
2772
- aWindowConstraints.gridwidth = 1;
2773
- // aConstraints.gridheight = 3;
2774
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2775
- bigThree.add(XYZPanel, aWindowConstraints);
2776
- bigThree.revalidate();
3307
+
3308
+ if (CameraPane.FULLSCREEN)
3309
+ fullscreenLayout = radio.layout;
3310
+
3311
+// bigThree.remove(scenePanel);
3312
+// bigThree.remove(centralPanel);
3313
+// bigThree.remove(XYZPanel);
3314
+// aWindowConstraints.gridx = 0;
3315
+// aWindowConstraints.gridy = 0;
3316
+// aWindowConstraints.gridwidth = 1;
3317
+// // aWindowConstraints.gridheight = 3;
3318
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3319
+// aWindowConstraints.weightx = 0;
3320
+// aWindowConstraints.weighty = 1;
3321
+// bigThree.add(scenePanel, aWindowConstraints);
3322
+// aWindowConstraints.weightx = 1;
3323
+// aWindowConstraints.gridwidth = 3;
3324
+// // aWindowConstraints.gridheight = 3;
3325
+// aWindowConstraints.gridx = 1;
3326
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3327
+// bigThree.add(centralPanel, aWindowConstraints);
3328
+// aWindowConstraints.weightx = 0;
3329
+// aWindowConstraints.gridx = 4;
3330
+// aWindowConstraints.gridwidth = 1;
3331
+// // aConstraints.gridheight = 3;
3332
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3333
+// bigThree.add(XYZPanel, aWindowConstraints);
3334
+// bigThree.validate();
3335
+// scenePanel.setVisible(true);
3336
+// centralPanel.setVisible(true);
3337
+// XYZPanel.setVisible(true);
3338
+ bigThree.ClearUI();
3339
+ bigThree.add(scenePanel);
3340
+ bigThree.add(centralPanel);
3341
+ bigThree.add(XYZPanel);
3342
+ bigThree.FlushUI();
3343
+
3344
+ cameraView.requestFocusInWindow();
27773345 } else
2778
- if (event.getSource() == rootButton)
3346
+ if (source == rootButton)
27793347 {
27803348 Object3D obj;
27813349 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2785,66 +3353,84 @@
27853353 EditObject(obj);
27863354 }
27873355
3356
+ cameraView.requestFocusInWindow();
27883357 refreshContents(true);
27893358 } else
2790
- if (event.getSource() == closeButton)
3359
+ if (source == closeButton)
27913360 {
27923361 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27933362 cRadio ab;
27943363 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27953364 {
27963365 ab = (cRadio)e.nextElement();
2797
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3366
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27983367 {
3368
+ // Patch to avoid bug with transparency.
3369
+ if (!ab.hadMaterial)
3370
+ {
3371
+ ab.object.material = null;
3372
+ }
3373
+
27993374 buttonGroup.remove(ab);
28003375 radioPanel.remove(ab);
28013376
2802
- ab.GetObject().editWindow = null;
3377
+ //ab.GetObject().editWindow = null;
3378
+ ab.GetObject().manipWindow = null;
28033379 // ab.GetObject().objectUI = null; // ?????????
28043380
28053381 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28063382 break;
28073383 }
28083384 }
3385
+
3386
+ cameraView.requestFocusInWindow();
28093387 refreshContents(true);
28103388 } else
2811
- if (event.getSource() == editItem || event.getSource() == editButton)
3389
+ if (source == editItem || source == editButton)
28123390 {
3391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3392
+ {
3393
+ Object3D child = (Object3D)e.nextElement();
3394
+ child.pinned = true;
3395
+ }
3396
+
28133397 EditSelection(false);
28143398 } else
2815
- if (event.getSource() == uneditButton)
3399
+ if (source == uneditButton)
28163400 {
28173401 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28183402 {
28193403 Object3D child = (Object3D)e.nextElement();
28203404 if(child.editWindow != null)
28213405 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3406
+ child.pinned = false;
28223407 child.CloseUI();
28233408 listUI.remove(child);
28243409
2825
- child.editWindow = null; // ???????????
3410
+ //child.editWindow = null; // ???????????
28263411 }
2827
- objEditor.ctrlPanel.revalidate();
3412
+ objEditor.ctrlPanel.FlushUI();
28283413 //objEditor.jTree.clearSelection();
28293414 //objEditor.ResetSliders();
28303415 refreshContents(true);
28313416 } else
2832
- if (event.getSource() == clearPanelButton)
3417
+ if (source == clearPanelButton)
28333418 {
28343419 assert(copy == group);
28353420 //copy.ClearUI();
28363421 for (Object3D obj : listUI)
28373422 {
3423
+ obj.pinned = false;
28383424 obj.CloseUI();
28393425 }
28403426 listUI.clear();
28413427 refreshContents(true);
28423428 } else
2843
- if (event.getSource() == allParamsButton)
3429
+ if (source == allParamsButton)
28443430 {
28453431 assert(copy == group);
28463432
2847
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3433
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28483434
28493435 for (Object3D obj : listUI)
28503436 {
....@@ -2861,19 +3447,19 @@
28613447
28623448 refreshContents(true);
28633449 } else
2864
- if (event.getSource() == unselectButton)
3450
+ if (source == unselectButton)
28653451 {
28663452 objEditor.jTree.clearSelection();
28673453 // ?? oct 2012 GrafreeD.clipboard.clear();
28683454 objEditor.ResetSliders();
28693455 refreshContents(true);
28703456 } else
2871
- if(event.getSource() instanceof cRadio)
3457
+ if(source instanceof cRadio)
28723458 {
28733459 group.parent = keepparent;
28743460 group.attributes = 0;
28753461 //group.editWindow = null;
2876
- /*cRadio*/ radio = (cRadio)event.getSource();
3462
+ /*cRadio*/ radio = (cRadio)source;
28773463 Object3D obj = radio.GetObject();
28783464 System.out.println("Edit " + obj);
28793465 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2893,7 +3479,7 @@
28933479 }
28943480
28953481 copy = group;
2896
- //CameraPane.theRenderer.object = group;
3482
+ //Globals.theRenderer.object = group;
28973483 if(!useclient)
28983484 {
28993485 cameraView.renderCamera = radio.camera;
....@@ -2902,25 +3488,50 @@
29023488 cameraView.cameras[cameraView.cameracount] = radio.camera;
29033489 cameraView.targetLookAt.set(radio.camera.lookAt);
29043490 cameraView.object = group;
2905
- cameraView.lighttouched = true;
3491
+ //cameraView.lighttouched = true;
3492
+ Globals.lighttouched = true;
29063493 topView.object = group;
29073494 frontView.object = group;
29083495 sideView.object = group;
29093496 }
2910
- group.editWindow = this;
3497
+
3498
+// fix "+" issue
3499
+ //group.editWindow = this;
3500
+ group.manipWindow = this;
3501
+
29113502 /*
29123503 currentLayout = radio.layout;
29133504 if (currentLayout == null)
29143505 currentLayout = sevenButton;
29153506 */
29163507 radio.layout.doClick();
3508
+
3509
+ ClearUnpinned();
3510
+ SetPinStates(group.selection.size() > 0);
3511
+ if (group.selection.size() == 1)
3512
+ EditSelection(false);
29173513 keepparent = group.parent;
29183514 // PARENT = NULL or not???
29193515 //group.parent = null; // ROOT
29203516 //group.attributes = -1;
29213517 ResetModel();
3518
+
3519
+ cameraView.requestFocusInWindow();
29223520 refreshContents(true);
2923
- }
3521
+ } else if (event.getSource() == editCameraItem)
3522
+ {
3523
+ cameraView.ProtectCamera();
3524
+ cameraView.repaint();
3525
+ return;
3526
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3527
+ {
3528
+ cameraView.RevertCamera();
3529
+ cameraView.repaint();
3530
+ return;
3531
+ // } else if (event.getSource() == textureButton)
3532
+ // {
3533
+ // return; // true;
3534
+ }
29243535 else
29253536 {
29263537 //return super.action(event, arg);
....@@ -2929,7 +3540,6 @@
29293540 }
29303541
29313542 boolean useclient = false;
2932
- cRadio radio;
29333543
29343544 void ToggleRoot()
29353545 {
....@@ -2938,7 +3548,7 @@
29383548 if (useclient)
29393549 {
29403550 cameraView.object = client;
2941
- cameraView.lighttouched = true;
3551
+ Globals.lighttouched = true;
29423552 //topView.object = client;
29433553 //frontView.object = client;
29443554 //sideView.object = client;
....@@ -2946,7 +3556,7 @@
29463556 else
29473557 {
29483558 cameraView.object = group;
2949
- cameraView.lighttouched = true;
3559
+ Globals.lighttouched = true;
29503560 //topView.object = group;
29513561 //frontView.object = group;
29523562 //sideView.object = group;
....@@ -2981,6 +3591,28 @@
29813591 refreshContents();
29823592 }
29833593
3594
+ void TransformChildren()
3595
+ {
3596
+ Object3D obj;
3597
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3598
+ {
3599
+ obj = (Object3D)e.nextElement();
3600
+ obj.KeepTextureMatrices();
3601
+ obj.TransformChildren();
3602
+ obj.RestoreTextureMatrices();
3603
+
3604
+// if (obj.parent == null)
3605
+// {
3606
+// System.out.println("NULL PARENT!");
3607
+// new Exception().printStackTrace();
3608
+// }
3609
+// else
3610
+// TouchTransform(obj);
3611
+// //obj.parent.Touch();
3612
+ }
3613
+
3614
+ refreshContents();
3615
+ }
29843616
29853617 void ResetTransform()
29863618 {
....@@ -3093,7 +3725,7 @@
30933725 refreshContents();
30943726 }
30953727
3096
- void ResetCentroid()
3728
+ void ResetCentroid(boolean full)
30973729 {
30983730 Object3D obj;
30993731 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3108,12 +3740,16 @@
31083740 LA.matIdentity(Object3D.mat);
31093741 obj.getBounds(minima, maxima, false);
31103742 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3111
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3743
+ if (full)
3744
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31123745 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31133746 obj.TransformMesh(Object3D.mat);
3747
+
31143748 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3115
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3749
+ if (full)
3750
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31163751 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3752
+
31173753 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31183754 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31193755 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3142,7 +3778,8 @@
31423778
31433779 int size = obj.MemorySize();
31443780
3145
- System.err.println((size/1024) + " KB is the size of " + obj);
3781
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3782
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
31463783 }
31473784 }
31483785 catch (Exception e)
....@@ -3179,9 +3816,9 @@
31793816 obj = (Object3D)e.nextElement();
31803817
31813818 System.out.println("Object is: " + obj);
3182
- GrafreeD.AnalyzeObject(obj);
3819
+ Grafreed.AnalyzeObject(obj);
31833820 System.out.println("Boundary rep: " + obj.bRep);
3184
- GrafreeD.AnalyzeObject(obj.bRep);
3821
+ Grafreed.AnalyzeObject(obj.bRep);
31853822
31863823 // System.err.println((size/1024) + " KB is the size of " + obj);
31873824 }
....@@ -3223,6 +3860,13 @@
32233860 void GenNormals(boolean crease)
32243861 {
32253862 group.GenNormalsS(crease);
3863
+
3864
+ refreshContents();
3865
+ }
3866
+
3867
+ void GenNormalsMESH()
3868
+ {
3869
+ group.GenNormalsMeshS();
32263870
32273871 refreshContents();
32283872 }
....@@ -3395,8 +4039,8 @@
33954039
33964040 void ParseVertices()
33974041 {
3398
- boolean epsequal = GrafreeD.epsequal;
3399
- GrafreeD.epsequal = true;
4042
+ boolean epsequal = Grafreed.epsequal;
4043
+ Grafreed.epsequal = true;
34004044
34014045 for (int i=0; i<group.selection.size(); i++)
34024046 {
....@@ -3421,7 +4065,7 @@
34214065 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34224066 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34234067
3424
- g.add(GrafreeD.clipboard);
4068
+ g.add(Grafreed.clipboard);
34254069
34264070 buffer.add(g);
34274071 }
....@@ -3436,7 +4080,7 @@
34364080 makeSomething(buffer, i==group.selection.size()-1);
34374081 }
34384082
3439
- GrafreeD.epsequal = epsequal;
4083
+ Grafreed.epsequal = epsequal;
34404084
34414085 refreshContents();
34424086 }
....@@ -3454,7 +4098,16 @@
34544098 String pigment = Object3D.GetPigment(tex);
34554099 //String bump = Object3D.GetBump(tex);
34564100
3457
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4101
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4102
+
4103
+ try
4104
+ {
4105
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4106
+ }
4107
+ catch (Exception e)
4108
+ {
4109
+ System.err.println("FAIL: " + node);
4110
+ }
34584111
34594112 double s = v.s;
34604113
....@@ -3542,11 +4195,11 @@
35424195
35434196 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35444197
3545
- boolean random = CameraPane.RANDOM;
3546
- CameraPane.RANDOM = false; // parse all random nodes
4198
+ boolean random = CameraPane.SWITCH;
4199
+ CameraPane.SWITCH = false; // parse all random nodes
35474200 lowres.linkVerticesThis(null);
35484201 lowres.linkVerticesThis(sn);
3549
- CameraPane.RANDOM = random;
4202
+ CameraPane.SWITCH = random;
35504203
35514204 System.err.flush();
35524205
....@@ -3586,7 +4239,7 @@
35864239 return;
35874240
35884241 Object3D poses = group.selection.get(0);
3589
- Object3D ref = GrafreeD.clipboard.get(0);
4242
+ Object3D ref = Grafreed.clipboard.get(0);
35904243
35914244 Object3D newgroup = new Object3D("Po:" + poses.name);
35924245
....@@ -3755,7 +4408,7 @@
37554408 group.selection.RelinkToSupport(); // july 2014
37564409 System.out.println("DONE.");
37574410 refreshContents();
3758
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4411
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
37594412 }
37604413
37614414 void ReduceMesh(boolean reduction34)
....@@ -3780,9 +4433,9 @@
37804433
37814434 void ClipMesh()
37824435 {
3783
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4436
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37844437 {
3785
- Object3D content = GrafreeD.clipboard.get(0);
4438
+ Object3D content = Grafreed.clipboard.get(0);
37864439
37874440 if (content instanceof cGroup && ((cGroup)content).transientlink )
37884441 content = ((cGroup)content).get(0);
....@@ -3791,7 +4444,7 @@
37914444 // {
37924445 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37934446 // }
3794
- group.selection.ClipMesh(GrafreeD.clipboard);
4447
+ group.selection.ClipMesh(Grafreed.clipboard);
37954448 }
37964449 // group.selection.ClipMesh(GrafreeD.clipboard);
37974450 System.out.println("DONE.");
....@@ -3838,6 +4491,18 @@
38384491 void MarkLeaves(boolean hide)
38394492 {
38404493 group.selection.MarkLeaves(hide);
4494
+ refreshContents();
4495
+ }
4496
+
4497
+ void RewindLeaves(boolean hide)
4498
+ {
4499
+ group.selection.RewindLeaves(hide);
4500
+ refreshContents();
4501
+ }
4502
+
4503
+ void RandomLeaves(boolean hide)
4504
+ {
4505
+ group.selection.RandomLeaves(hide);
38414506 refreshContents();
38424507 }
38434508
....@@ -3912,10 +4577,6 @@
39124577 // }
39134578 // }
39144579
3915
- static boolean allparams = true;
3916
-
3917
- static Vector<Object3D> listUI = new Vector<Object3D>();
3918
-
39194580 void EditSelection(boolean newWindow)
39204581 {
39214582 // aConstraints.gridy = 0;
....@@ -3923,10 +4584,10 @@
39234584 {
39244585 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39254586 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3926
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4587
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39274588
39284589 Object3D elem = (Object3D)group.selection.elementAt(i);
3929
- if(elem != group)
4590
+ if(elem != group || !newWindow)
39304591 {
39314592 // if (!(elem instanceof Composite))
39324593 // newWindow = false;
....@@ -4008,7 +4669,8 @@
40084669 //new Exception().printStackTrace();
40094670
40104671 freezemodel = true;
4011
-
4672
+ ClearUnpinned();
4673
+
40124674 /**/
40134675 //switch (event.id)
40144676 {
....@@ -4016,7 +4678,6 @@
40164678 //case 702: // Event.LIST_DESELECT
40174679 group.deselectAll();
40184680 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4019
- objEditor.ClearInfo(); // .GetMaterial());
40204681 if (tps != null)
40214682 {
40224683 for (int i=0; i < tps.length; i++)
....@@ -4025,33 +4686,39 @@
40254686
40264687 //if (child.parent != null)
40274688 //child.parent.addSelectee(child);
4689
+ objEditor.SetMaterial(child);
40284690 group.addSelectee(child);
4029
- objEditor.SetMaterial(child); // .GetMaterial());
4030
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4031
- System.err.println("info : " + child.GetPath());
40324691 }
40334692 }
4034
- else
4035
- {
4036
- objEditor.SetMaterial(group); // .GetMaterial());
4037
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4038
- System.err.println("info : " + group.GetPath());
4039
- }
4693
+// else
4694
+// {
4695
+// objEditor.SetMaterial(group); // .GetMaterial());
4696
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4697
+// System.err.println("info : " + group.GetPath());
4698
+// }
40404699
4041
- objEditor.SetText(); // jan 2014
4042
-
4043
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4700
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
40444701 CameraPane.flash = true;
40454702
4046
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4703
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40474704 // a camera
40484705 {
4049
- CameraPane.camerachangeframe = 0; // don't refuse it
4050
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4051
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
4052
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
4706
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4707
+ {
4708
+ CameraPane.camerachangeframe = 0; // don't refuse it
4709
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4710
+ }
4711
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4712
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
40534713 }
40544714
4715
+ if (tps != null && tps.length == 1)
4716
+ {
4717
+ EditSelection(false);
4718
+ }
4719
+
4720
+ SetPinStates(tps != null && tps.length > 0);
4721
+
40554722 refreshContents();
40564723 //return true;
40574724 }
....@@ -4060,6 +4727,35 @@
40604727
40614728 freezemodel = false;
40624729 }
4730
+
4731
+ void SetPinStates(boolean enabled)
4732
+ {
4733
+ editButton.setEnabled(enabled);
4734
+ uneditButton.setEnabled(enabled);
4735
+ unselectButton.setEnabled(enabled);
4736
+ flashSelectionButton.setEnabled(enabled);
4737
+ }
4738
+
4739
+ void refreshContents(boolean cp)
4740
+ {
4741
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4743
+ {
4744
+ objEditor.ClearInfo(); // .GetMaterial());
4745
+
4746
+ for (int i=0; i < group.selection.Size(); i++)
4747
+ {
4748
+ Object3D child = (Object3D) group.selection.get(i);
4749
+
4750
+ objEditor.AddInfo(child, this, true);
4751
+ System.err.println("info : " + child.GetPath());
4752
+ }
4753
+
4754
+ objEditor.SetText(); // jan 2014
4755
+ }
4756
+
4757
+ super.refreshContents(cp);
4758
+ }
40634759
40644760 void linkSomething(Object3D thing)
40654761 {
....@@ -4131,16 +4827,19 @@
41314827 {
41324828 if (group.selection.isEmpty())
41334829 return;
4134
- GrafreeD.clipboardIsTempGroup = false;
4830
+
4831
+ Grafreed.clipboardIsTempGroup = false;
41354832 Composite tGroup = null;
41364833 if (group.selection.size() > 0) // 1)
41374834 {
41384835 tGroup = new cGroup();
4139
- GrafreeD.clipboardIsTempGroup = true;
4836
+ Grafreed.clipboardIsTempGroup = true;
41404837 }
41414838
41424839 if (cut)
41434840 {
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
41444843 //int indices[] = jList.getSelectedIndices();
41454844 //for (int i = indices.length - 1; i >= 0; i--)
41464845 //jList.remove(indices[i]);
....@@ -4176,16 +4875,16 @@
41764875 //System.out.println("cut " + child);
41774876 //System.out.println("parent = " + child.parent);
41784877 // tmp.addChild(child);
4179
- if (GrafreeD.clipboardIsTempGroup)
4878
+ if (Grafreed.clipboardIsTempGroup)
41804879 tGroup.add/*Child*/(tmp);
41814880 else
4182
- GrafreeD.clipboard = tmp;
4881
+ Grafreed.clipboard = tmp;
41834882 }
41844883 else
4185
- if (GrafreeD.clipboardIsTempGroup)
4884
+ if (Grafreed.clipboardIsTempGroup)
41864885 tGroup.add/*Child*/(child);
41874886 else
4188
- GrafreeD.clipboard = child;
4887
+ Grafreed.clipboard = child;
41894888 }
41904889
41914890 //ResetModel();
....@@ -4217,21 +4916,23 @@
42174916 //System.out.println("cut " + elem);
42184917 //System.out.println("parent = " + elem.parent);
42194918 // tmp.addChild(elem);
4220
- if (GrafreeD.clipboardIsTempGroup)
4919
+ if (Grafreed.clipboardIsTempGroup)
42214920 tGroup.add/*Child*/(tmp);
42224921 else
4223
- GrafreeD.clipboard = tmp;
4922
+ Grafreed.clipboard = tmp;
42244923 }
42254924 else
4226
- if (GrafreeD.clipboardIsTempGroup)
4925
+ if (Grafreed.clipboardIsTempGroup)
42274926 tGroup.add/*Child*/(child);
42284927 else
4229
- GrafreeD.clipboard = child;
4928
+ Grafreed.clipboard = child;
42304929 }
42314930
42324931 }
4233
- if (GrafreeD.clipboardIsTempGroup)
4234
- GrafreeD.clipboard = tGroup;
4932
+
4933
+ if (Grafreed.clipboardIsTempGroup)
4934
+ Grafreed.clipboard = tGroup;
4935
+
42354936 if (cut)
42364937 {
42374938 ResetModel();
....@@ -4241,11 +4942,15 @@
42414942
42424943 void paste(boolean expand)
42434944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
42444949 // if (GrafreeD.clipboard == null)
42454950 // return;
42464951 boolean first = true;
42474952
4248
- if (GrafreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
42494954 {
42504955 Composite temp;
42514956
....@@ -4256,7 +4961,7 @@
42564961 temp = (Composite)Applet3D.clipboard.deepCopy();
42574962 */
42584963 Object3D elem;
4259
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4964
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
42604965 {
42614966 Object3D child = (Object3D)e.nextElement();
42624967
....@@ -4290,21 +4995,22 @@
42904995 //Object3D cb = Applet3D.clipboard;
42914996 //temp.addChild(cb);
42924997 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4293
- assert(GrafreeD.clipboard.parent == null);
4294
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4295
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4296
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4297
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4998
+ assert(Grafreed.clipboard.parent == null);
4999
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5000
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5001
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5002
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42985003 else
4299
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4300
- GrafreeD.clipboard.get(0).parent = keepparent;
5004
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5005
+ Grafreed.clipboard.get(0).parent = keepparent;
43015006 }
43025007
5008
+ Globals.SAVEONMAKE = keep;
43035009 ResetModel();
43045010 refreshContents();
43055011 }
43065012
4307
- void pasteInto(boolean copyit)
5013
+ void pasteInto(boolean copyit, boolean clone)
43085014 {
43095015 // if (GrafreeD.clipboard == null)
43105016 // return;
....@@ -4333,15 +5039,22 @@
43335039 if (copyit)
43345040 {
43355041 // paste(false);
4336
- CloneClipboard(false); // sept 2014
5042
+ if (clone)
5043
+ {
5044
+ CloneClipboard(false); // sept 2014
5045
+ }
5046
+ else
5047
+ {
5048
+ paste(false);
5049
+ }
43375050 }
43385051 else
43395052 {
43405053 boolean first = true;
43415054
4342
- if (GrafreeD.clipboardIsTempGroup)
5055
+ if (Grafreed.clipboardIsTempGroup)
43435056 {
4344
- Composite temp = (Composite)GrafreeD.clipboard;
5057
+ Composite temp = (Composite)Grafreed.clipboard;
43455058 Object3D copy;
43465059 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43475060 {
....@@ -4351,7 +5064,7 @@
43515064 }
43525065 } else
43535066 {
4354
- linkSomething(GrafreeD.clipboard); //.get(0));
5067
+ linkSomething(Grafreed.clipboard); //.get(0));
43555068 }
43565069 }
43575070 }
....@@ -4428,6 +5141,10 @@
44285141
44295142 void group(Object3D csg, boolean grab)
44305143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
44315148 if (//false) // why??
44325149 !group.selection.isEmpty())
44335150 {
....@@ -4541,10 +5258,15 @@
45415258 //node.add(csg);
45425259 //makeSomething(node);
45435260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
45445262 }
45455263
45465264 void Ungroup(Object3D g)
45475265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
45485270 if (g instanceof HiddenObject)
45495271 {
45505272 HiddenObject h = (HiddenObject) g;
....@@ -4561,6 +5283,7 @@
45615283 objEditor.makeSomething(g.get(i), false);
45625284 }
45635285 }
5286
+ Globals.SAVEONMAKE = keep;
45645287 }
45655288
45665289 void ungroup()
....@@ -4756,21 +5479,6 @@
47565479 }
47575480 */
47585481
4759
- void ImportGFD()
4760
- {
4761
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4762
- browser.show();
4763
- String filename = browser.getFile();
4764
- if (filename != null && filename.length() > 0)
4765
- {
4766
- String fullname = browser.getDirectory() + filename;
4767
-
4768
- //Object3D readobj =
4769
- objEditor.ReadGFD(fullname, objEditor);
4770
- //makeSomething(readobj);
4771
- }
4772
- }
4773
-
47745482 /*
47755483 public void Callback(Object obj)
47765484 {
....@@ -4794,26 +5502,9 @@
47945502 }
47955503 */
47965504
4797
- void ImportVRMLX3D()
4798
- {
4799
- if (GrafreeD.standAlone)
4800
- {
4801
- /**/
4802
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4803
- browser.show();
4804
- String filename = browser.getFile();
4805
- if (filename != null && filename.length() > 0)
4806
- {
4807
- String fullname = browser.getDirectory() + filename;
4808
- LoadVRMLX3D(fullname);
4809
- }
4810
- /**/
4811
- }
4812
- }
4813
-
48145505 String GetFile(String dialogName)
48155506 {
4816
- if (GrafreeD.standAlone)
5507
+ if (Grafreed.standAlone)
48175508 {
48185509 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48195510 browser.show();
....@@ -4877,10 +5568,33 @@
48775568 cButton flashSelectionButton;
48785569 cButton editButton;
48795570 cButton uneditButton;
5571
+ JCheckBox allParamsButton;
48805572 cButton clearpanelButton;
4881
- cButton allParamsButton;
48825573 cButton unselectButton;
48835574
5575
+ cButton restoreCameraButton;
5576
+
5577
+ cButton saveButton;
5578
+ cButton oneStepButton;
5579
+
5580
+ cButton groupButton;
5581
+ cButton ungroupButton;
5582
+ cButton compositeButton;
5583
+ cButton switchButton;
5584
+ cButton loopButton;
5585
+ cButton textureButton;
5586
+
5587
+ cButton gridButton;
5588
+ cButton boxButton;
5589
+ cButton sphereButton;
5590
+ cButton coneButton;
5591
+ cButton torusButton;
5592
+ cButton superButton;
5593
+ cButton kleinButton;
5594
+ cButton particlesButton;
5595
+ cButton overlayButton;
5596
+ cButton lightButton;
5597
+
48845598 cButton screenfitButton;
48855599 cButton screenfitpointButton;
48865600 cButton snapobjectButton;
....@@ -4892,14 +5606,6 @@
48925606
48935607 cButton setsupportButton;
48945608
4895
- cButton twoButton;
4896
- cButton sixButton;
4897
- cButton threeButton;
4898
- cButton sevenButton;
4899
- cButton fourButton; // full panel
4900
- cButton oneButton; // full XYZ
4901
- //cButton currentLayout;
4902
-
49035609 //
49045610 //Composite
49055611 Object3D // to do !!
....@@ -4909,9 +5615,11 @@
49095615 //JTree jTree;
49105616 private MenuItem lookAtItem;
49115617 private MenuItem lookFromItem;
4912
- private MenuItem switchItem;
5618
+ private MenuItem switchViewItem;
49135619 private MenuItem cutItem;
4914
- private MenuItem duplicateItem;
5620
+ private MenuItem undoItem;
5621
+ private MenuItem redoItem;
5622
+ private JMenuItem duplicateItem;
49155623 private MenuItem cloneItem;
49165624 private MenuItem cloneSupportItem;
49175625 private MenuItem overwriteGeoItem;
....@@ -4924,7 +5632,7 @@
49245632 private MenuItem linkverticesItem;
49255633 private MenuItem relinkverticesItem;
49265634 private MenuItem setMasterItem;
4927
- private MenuItem resetMeshItem;
5635
+ private MenuItem resetAllItem;
49285636 private MenuItem stepAllItem;
49295637 private MenuItem revertMeshItem;
49305638 private MenuItem poseMeshItem;
....@@ -4935,6 +5643,7 @@
49355643 private MenuItem mergeGeometriesItem;
49365644 private MenuItem copyItem;
49375645 private MenuItem pasteItem;
5646
+ private MenuItem pasteIntoItem;
49385647 private MenuItem pasteLinkItem;
49395648 private MenuItem pasteCloneItem;
49405649 private MenuItem pasteExpandItem;
....@@ -4973,6 +5682,10 @@
49735682 private MenuItem showleavesItem;
49745683 private MenuItem markleavesItem;
49755684 private MenuItem unmarkleavesItem;
5685
+ private MenuItem rewindleavesItem;
5686
+ private MenuItem unrewindleavesItem;
5687
+ private MenuItem randomleavesItem;
5688
+ private MenuItem unrandomleavesItem;
49765689
49775690 private MenuItem flipVItem;
49785691 private MenuItem unflipVItem;
....@@ -4984,15 +5697,17 @@
49845697 private MenuItem panoTexturesItem;
49855698
49865699 private MenuItem resetCentroidItem;
4987
- private MenuItem transformgeometryItem;
5700
+ private MenuItem resetCentroidXZItem;
49885701 private MenuItem resetTransformItem;
5702
+ private MenuItem transformGeometryItem;
5703
+ private MenuItem transformChildrenItem;
49895704 private MenuItem hideItem;
49905705 private MenuItem grabItem;
49915706 private MenuItem backItem;
49925707 private MenuItem frontItem;
49935708 private MenuItem cameraItem;
49945709 private MenuItem compositeItem;
4995
- private MenuItem randomItem;
5710
+ private MenuItem switchItem;
49965711 private MenuItem physicsItem;
49975712 private MenuItem frameselectorItem;
49985713 private MenuItem scriptNodeItem;
....@@ -5007,6 +5722,7 @@
50075722
50085723 private MenuItem resetParentItem;
50095724 private MenuItem repairParentItem;
5725
+ private MenuItem repairShadowItem;
50105726 private MenuItem sortbysizeItem;
50115727 private MenuItem sortbynameItem;
50125728
....@@ -5031,7 +5747,7 @@
50315747 private MenuItem blobItem;
50325748 private MenuItem latheItem;
50335749 private MenuItem bezierItem;
5034
- private MenuItem checkerItem;
5750
+ private MenuItem overlayItem;
50355751 private MenuItem meshItem;
50365752 // private MenuItem meshGroupItem;
50375753 private MenuItem springItem;
....@@ -5053,11 +5769,6 @@
50535769 private MenuItem doubleItem;
50545770 private MenuItem tripleItem;
50555771
5056
- private MenuItem importGFDItem;
5057
- private MenuItem importVRMLX3DItem;
5058
- private MenuItem import3DSItem;
5059
- private MenuItem importOBJItem;
5060
-
50615772 private MenuItem computeAOItem;
50625773 private MenuItem recompileItem;
50635774 private MenuItem editScriptItem;
....@@ -5067,4 +5778,8 @@
50675778 private MenuItem analyzeItem;
50685779 private MenuItem dumpItem;
50695780 //boolean freezemodel = false;
5781
+
5782
+ Menu cameraMenu;
5783
+ MenuItem editCameraItem;
5784
+ MenuItem restoreCameraItem;
50705785 }