Normand Briere
2019-07-18 d7a17c35c443e2cb6c09eaa3cfeaf590a571faa1
GroupEditor.java
....@@ -60,6 +60,12 @@
6060 this.copy = this.group = group;
6161 //selectees = this.group.selectees;
6262
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6369 if(ui)
6470 SetupUI(objEditor);
6571 }
....@@ -74,7 +80,13 @@
7480 this.copy = this.group = copy;
7581 //selectees = this.group.selectees;
7682
77
- SetupMenu2(objEditor);
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
89
+ SetupMenu2(this); //objEditor);
7890 SetupUI2(objEditor);
7991 objEditor.SetupUI(true);
8092 SetupViews(objEditor);
....@@ -84,6 +96,10 @@
8496
8597 void CloneSelection(boolean supports)
8698 {
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
87103 // Object3D keep = GrafreeD.clipboard;
88104 //Object3D obj;
89105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +110,19 @@
94110
95111 makeSomething(clone, i==group.selection.size()-1);
96112 }
113
+ Globals.REPLACEONMAKE = keep;
97114 }
98115
99116 void CloneClipboard(boolean supports)
100117 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
118
+ assert(Grafreed.clipboard.parent == null);
119
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
120
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
121
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
122
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106123 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
124
+ makeSomething(CloneObject(Grafreed.clipboard, false));
125
+ Grafreed.clipboard.get(0).parent = keepparent;
109126 }
110127
111128 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +136,7 @@
119136 // obj.support = null;
120137 if (!supports)
121138 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
139
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123140 obj.parent = parent;
124141 // obj.support = support;
125142 // clone.support = support; // aout 2013
....@@ -148,30 +165,29 @@
148165
149166 //JTextField nameField;
150167
151
- void SetupMenu2(ObjEditor oe)
168
+ void SetupMenu2(GroupEditor oe)
152169 {
153
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
154
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
155
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
156
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
157
- oe.cameraMenu.add("-");
158
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
159
- openWindowItem.addActionListener(this);
160
- editLeafItem.addActionListener(this);
161
- lookAtItem.addActionListener(this);
162
- //lookFromItem.addActinoListener(this);
163
- //switchItem.addActionListener(this);
170
+ oe.jTree = new cTree();
171
+
164172 Menu menu;
165173 oe.menuBar.add(menu = new Menu("Edit"));
166174 //editItem = menu.add(new MenuItem("Edit"));
167175 //editItem.addActionListener(this);
168
- duplicateItem = menu.add(new MenuItem("Duplicate"));
176
+
177
+// undoItem = menu.add(new MenuItem("Undo"));
178
+// undoItem.addActionListener(this);
179
+// redoItem = menu.add(new MenuItem("Redo"));
180
+// redoItem.addActionListener(this);
181
+// menu.add("-");
182
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
169183 duplicateItem.addActionListener(this);
170
- menu.add("-");
171184 cloneItem = menu.add(new MenuItem("Clone"));
172185 cloneItem.addActionListener(this);
186
+ if (Globals.ADVANCED)
187
+ {
173188 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
174189 cloneSupportItem.addActionListener(this);
190
+ }
175191 menu.add("-");
176192 cutItem = menu.add(new MenuItem("Cut"));
177193 cutItem.addActionListener(this);
....@@ -179,27 +195,123 @@
179195 copyItem.addActionListener(this);
180196 pasteItem = menu.add(new MenuItem("Paste"));
181197 pasteItem.addActionListener(this);
198
+
199
+ menu.add("-");
200
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
201
+ pasteIntoItem.addActionListener(this);
182202 pasteLinkItem = menu.add(new MenuItem("Paste link"));
183203 pasteLinkItem.addActionListener(this);
184204 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
185205 pasteCloneItem.addActionListener(this);
186206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
187207 // pasteExpandItem.addActionListener(this);
208
+ menu.add("-");
188209 clearItem = menu.add(new MenuItem("Clear"));
189210 clearItem.addActionListener(this);
211
+
212
+ if (Globals.ADVANCED)
213
+ {
214
+ // Deletes the cameras...
190215 clearAllItem = menu.add(new MenuItem("Clear All"));
191216 clearAllItem.addActionListener(this);
217
+ }
218
+
219
+ menuBar.add(cameraMenu = new Menu("View"));
220
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
221
+ //zBufferItem.addActionListener(this);
222
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
223
+ //normalLensItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
226
+
227
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
228
+// toggleFullScreenItem.addItemListener(this);
229
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
230
+// cameraMenu.add("-");
231
+//
232
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
233
+// toggleTextureItem.addItemListener(this);
234
+// toggleTextureItem.setState(CameraPane.textureon);
235
+//
236
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
237
+// toggleSwitchItem.addItemListener(this);
238
+// toggleSwitchItem.setState(CameraPane.SWITCH);
239
+
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
241
+ toggleHandleItem.addItemListener(this);
242
+ toggleHandleItem.setState(CameraPane.HANDLES);
243
+
244
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
245
+ togglePaintItem.addItemListener(this);
246
+ togglePaintItem.setState(CameraPane.PAINTMODE);
247
+
248
+ if (Globals.ADVANCED)
249
+ {
250
+ cameraMenu.add("-");
251
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
252
+ toggleLiveItem.addItemListener(this);
253
+ toggleLiveItem.setState(Globals.isLIVE());
192254
255
+ cameraMenu.add(stepItem = new MenuItem("Step"));
256
+ stepItem.addActionListener(this);
257
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
258
+ // toggleDLItem.addItemListener(this);
259
+ // toggleDLItem.setState(false);
260
+
261
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
262
+ toggleRenderItem.addItemListener(this);
263
+ toggleRenderItem.setState(!CameraPane.frozen);
264
+
265
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
266
+ toggleDebugItem.addItemListener(this);
267
+ toggleDebugItem.setState(Globals.DEBUG);
268
+
269
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
270
+ toggleFrustumItem.addItemListener(this);
271
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
272
+
273
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
274
+ toggleFootContactItem.addItemListener(this);
275
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
276
+
277
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
278
+ toggleTimelineItem.addItemListener(this);
279
+ }
280
+
281
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
282
+// toggleRootItem.addItemListener(this);
283
+// toggleRootItem.setState(false);
284
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
285
+// animationItem.addItemListener(this);
286
+// animationItem.setState(CameraPane.ANIMATION);
287
+ cameraMenu.add("-");
288
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
289
+ editCameraItem.addActionListener(this);
290
+
291
+ if (Globals.ADVANCED)
292
+ {
293
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
294
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
296
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
297
+ oe.cameraMenu.add("-");
298
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
299
+ openWindowItem.addActionListener(this);
300
+ editLeafItem.addActionListener(this);
301
+ lookAtItem.addActionListener(this);
302
+ //lookFromItem.addActinoListener(this);
303
+ //switchViewItem.addActionListener(this);
304
+ }
305
+
193306 oe.menuBar.add(menu = new Menu("Setting"));
194
- resetMeshItem = menu.add(new MenuItem("Reset All"));
195
- resetMeshItem.addActionListener(this);
196
- stepAllItem = menu.add(new MenuItem("Step All"));
197
- stepAllItem.addActionListener(this);
307
+ if (Globals.ADVANCED)
308
+ {
198309 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
199310 revertMeshItem.addActionListener(this);
200311 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
201312 resetreferencesItem.addActionListener(this);
202313 menu.add("-");
314
+ }
203315 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
204316 overwriteGeoItem.addActionListener(this);
205317 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -211,79 +323,104 @@
211323 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
212324 overwriteUVItem.addActionListener(this);
213325 menu.add("-");
326
+ if (Globals.ADVANCED)
327
+ {
214328 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
215329 generateMeshItem.addActionListener(this);
216330 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
217331 poseMeshItem.addActionListener(this);
218332 menu.add("-");
333
+ }
219334 resetsupportItem = menu.add(new MenuItem("Reset support"));
220335 resetsupportItem.addActionListener(this);
221336 linkverticesItem = menu.add(new MenuItem("Link to Support"));
222337 linkverticesItem.addActionListener(this);
223338 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224339 relinkverticesItem.addActionListener(this);
340
+
341
+ if (Globals.ADVANCED)
342
+ {
225343 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
226344 setMasterItem.addActionListener(this);
345
+ }
227346
228347 oe.menuBar.add(menu = new Menu("Group"));
229
- grabItem = menu.add(new MenuItem("Grab"));
230
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
231350 backItem = menu.add(new MenuItem("Back"));
232351 backItem.addActionListener(this);
233352 frontItem = menu.add(new MenuItem("Front"));
234353 frontItem.addActionListener(this);
235
- compositeItem = menu.add(new MenuItem("Composite"));
236
- compositeItem.addActionListener(this);
237
- hideItem = menu.add(new MenuItem("Hide"));
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
359
+ hideItem = menu.add(new MenuItem("Hidden Group"));
238360 hideItem.addActionListener(this);
361
+ }
239362 ungroupItem = menu.add(new MenuItem("Ungroup"));
240363 ungroupItem.addActionListener(this);
241
- menu.add("-");
242
- randomItem = menu.add(new MenuItem("Random"));
243
- randomItem.addActionListener(this);
244
- physicsItem = menu.add(new MenuItem("Physics"));
245
- physicsItem.addActionListener(this);
246
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
247
- frameselectorItem.addActionListener(this);
364
+
365
+// menu.add("-");
366
+//
367
+// switchItem = menu.add(new MenuItem("Switch node"));
368
+// switchItem.addActionListener(this);
369
+ if (Globals.ADVANCED)
370
+ {
248371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
249372 switchGeoItem.addActionListener(this);
250373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
251374 switchTransfoItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
375
+ morphItem = menu.add(new MenuItem("Morph Group"));
253376 morphItem.addActionListener(this);
377
+
378
+ menu.add("-");
379
+ physicsItem = menu.add(new MenuItem("Physics"));
380
+ physicsItem.addActionListener(this);
381
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
382
+ frameselectorItem.addActionListener(this);
254383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
255384 scriptNodeItem.addActionListener(this);
256
- cameraItem = menu.add(new MenuItem("Camera"));
257
- cameraItem.addActionListener(this);
385
+ }
258386
259387 oe.menuBar.add(menu = new Menu("Object"));
260
- textureItem = menu.add(new MenuItem("Texture"));
261
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
262390 billboardItem = menu.add(new MenuItem("Billboard"));
263391 billboardItem.addActionListener(this);
264392 csgItem = menu.add(new MenuItem("CSG"));
265393 csgItem.addActionListener(this);
266
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
267395 shadowXItem.addActionListener(this);
268
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
269397 shadowYItem.addActionListener(this);
270
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
271399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
403
+ if (Globals.ADVANCED)
404
+ {
405
+ menu.add("-");
272406 linkerItem = menu.add(new MenuItem("Linker"));
273407 linkerItem.addActionListener(this);
274408 templateItem = menu.add(new MenuItem("Template"));
275409 templateItem.addActionListener(this);
276
- attributeItem = menu.add(new MenuItem("Attribute"));
277
- attributeItem.addActionListener(this);
278410 pointflowItem = menu.add(new MenuItem("Point Flow"));
279411 pointflowItem.addActionListener(this);
412
+ }
280413 menu.add("-");
281414 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
282415 resetTransformItem.addActionListener(this);
283416 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
284417 resetCentroidItem.addActionListener(this);
285
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
- transformgeometryItem.addActionListener(this);
418
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
419
+ resetCentroidXZItem.addActionListener(this);
420
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
421
+ transformGeometryItem.addActionListener(this);
422
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
423
+ transformChildrenItem.addActionListener(this);
287424
288425 oe.menuBar.add(menu = new Menu("Geometry"));
289426 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -294,8 +431,11 @@
294431 genNormalsCADItem.addActionListener(this);
295432 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296433 genNormalsMESHItem.addActionListener(this);
434
+ if (Globals.ADVANCED)
435
+ {
297436 genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
298437 genNormalsMINEItem.addActionListener(this);
438
+ }
299439 stripifyItem = menu.add(new MenuItem("Stripify"));
300440 stripifyItem.addActionListener(this);
301441 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -317,23 +457,34 @@
317457 reduce34MeshItem.addActionListener(this);
318458 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
319459 increaseMeshItem.addActionListener(this);
320
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
321
- smoothMeshItem.addActionListener(this);
322460 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
323461 clipMeshItem.addActionListener(this);
462
+
463
+ if (Globals.ADVANCED)
464
+ {
465
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
466
+ smoothMeshItem.addActionListener(this);
467
+ }
324468
325469 oe.menuBar.add(menu = new Menu("Attributes"));
326470 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327471 clearMaterialsItem.addActionListener(this);
472
+ resetAllItem = menu.add(new MenuItem("Reset All"));
473
+ resetAllItem.addActionListener(this);
474
+ stepAllItem = menu.add(new MenuItem("Step All"));
475
+ stepAllItem.addActionListener(this);
328476 menu.add("-");
329477 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
330478 liveleavesItem.addActionListener(this);
331479 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
332480 unliveleavesItem.addActionListener(this);
481
+ if (Globals.ADVANCED)
482
+ {
333483 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
334484 supportleavesItem.addActionListener(this);
335485 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
336486 unsupportleavesItem.addActionListener(this);
487
+ }
337488 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
338489 hideleavesItem.addActionListener(this);
339490 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -342,6 +493,14 @@
342493 markleavesItem.addActionListener(this);
343494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
344495 unmarkleavesItem.addActionListener(this);
496
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
497
+ rewindleavesItem.addActionListener(this);
498
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
499
+ unrewindleavesItem.addActionListener(this);
500
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
501
+ randomleavesItem.addActionListener(this);
502
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
503
+ unrandomleavesItem.addActionListener(this);
345504 menu.add("-");
346505 flipVItem = menu.add(new MenuItem("Flip V"));
347506 flipVItem.addActionListener(this);
....@@ -377,35 +536,41 @@
377536 sortbynameItem = menu.add(new MenuItem("Sort by name"));
378537 sortbynameItem.addActionListener(this);
379538 menu.add("-");
539
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
540
+ shareGeometriesItem.addActionListener(this);
541
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
542
+ mergeGeometriesItem.addActionListener(this);
543
+ if (Globals.ADVANCED)
544
+ {
545
+ // Pretty much the same as duplicate and clone.
380546 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381547 extractGeometriesItem.addActionListener(this);
382548 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383549 cloneGeometriesItem.addActionListener(this);
384
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
385
- shareGeometriesItem.addActionListener(this);
386
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
387
- mergeGeometriesItem.addActionListener(this);
550
+ }
388551
389552 oe.menuBar.add(menu = new Menu("Insert"));
390553 buildCreateMenu(menu);
391554
392
-
393
- oe.menuBar.add(menu = new Menu("Include"));
394
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
395
- importGFDItem.addActionListener(this);
396
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
397
- importVRMLX3DItem.addActionListener(this);
398
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
399
- importOBJItem.addActionListener(this);
400
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
401
- import3DSItem.addActionListener(this);
402
-
403555 oe.menuBar.add(menu = new Menu("Tools"));
404556 buildToolsMenu(menu);
405557 }
406558
559
+
407560 void SetupUI2(ObjEditor oe)
408561 {
562
+ // June 2019
563
+ if (oe == null)
564
+ {
565
+ //super.SetupUI2(this);
566
+ //return;
567
+ }
568
+
569
+ if (copy != group)
570
+ {
571
+ //super.SetupUI2(this);
572
+ }
573
+
409574 //new Exception().printStackTrace();
410575
411576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -434,98 +599,230 @@
434599 oe.radioPanel.add(dummyButton);
435600 oe.buttonGroup.add(dummyButton);
436601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
437606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
438607
439
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
440
- liveCB.setToolTipText("Enabled animation");
441
- liveCB.addItemListener(this);
442
-
443
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
444
- trackCB.setToolTipText("Enable tracking");
445
- trackCB.addItemListener(this);
446
-
447
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
611
+
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
618
+
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ fullButton.setToolTipText("Full-screen window");
621
+ fullButton.addActionListener(this);
622
+
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
448624 screenfitButton.setToolTipText("Screen fit");
449625 screenfitButton.addActionListener(this);
450626
627
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ restoreCameraButton.setToolTipText("Restore viewpoint");
629
+ restoreCameraButton.addActionListener(this);
630
+
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
633
+ saveButton.addActionListener(this);
634
+
635
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ undoButton.setToolTipText("Previous version");
637
+ undoButton.addActionListener(this);
638
+ undoButton.setEnabled(false);
639
+
640
+ cGridBag updown = new cGridBag().setVertical(true);
641
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ restoreButton.setToolTipText("Restore current");
643
+ restoreButton.addActionListener(this);
644
+ restoreButton.setEnabled(false);
645
+
646
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ replaceButton.setToolTipText("Replace current");
648
+ replaceButton.addActionListener(this);
649
+ replaceButton.setEnabled(false);
650
+
651
+ copyOptionsPanel.add(updown);
652
+
653
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ redoButton.setToolTipText("Next version");
655
+ redoButton.addActionListener(this);
656
+ redoButton.setEnabled(false);
657
+
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
659
+ liveCB.setToolTipText("Enable animation");
660
+ liveCB.addItemListener(this);
661
+
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
+ oneStepButton.setToolTipText("Animate one step forward");
664
+ oneStepButton.addActionListener(this);
665
+
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
667
+ fastCB.setToolTipText("Fast mode");
668
+ fastCB.addItemListener(this);
669
+
670
+ //oe.toolboxPanel.Return();
671
+
672
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
673
+// trackCB.setToolTipText("Enable tracking");
674
+// trackCB.addItemListener(this);
675
+
451676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
452677 // screenfitpointButton.addActionListener(this);
453
-// oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
455
- snapobjectButton.addActionListener(this);
456
- snapobjectButton.setToolTipText("Snap Object");
457
- oe.aConstraints.gridx += 1;
458678
459
- //aConstraints.gridx = 0;
460
- //aConstraints.gridy += 1;
461
- oe.aConstraints.weighty = 0;
462
- oe.aConstraints.gridwidth = 1;
463
-
464
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
465
- flashSelectionButton.setToolTipText("Show selection");
466
- flashSelectionButton.addActionListener(this);
679
+ if (Globals.ADVANCED)
680
+ {
681
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ snapobjectButton.addActionListener(this);
683
+ snapobjectButton.setToolTipText("Snap Object");
684
+ }
685
+
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
467687
468
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
469
-
470
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
471689 twoButton.setToolTipText("Show center view only");
472690 twoButton.addActionListener(this);
473
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
691
+ this.fullscreenLayout = twoButton;
692
+
693
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
474694 fourButton.addActionListener(this);
475695 fourButton.setToolTipText("Show left panel only");
476
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
696
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
477697 sixButton.setToolTipText("2-column layout left");
478698 sixButton.addActionListener(this);
479
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
480700 threeButton.setToolTipText("2-column layout right");
481701 threeButton.addActionListener(this);
482
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
702
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
483703 sevenButton.setToolTipText("3-column layout");
484704 sevenButton.addActionListener(this);
485705 //
486706
487
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
488
- rootButton.setToolTipText("Edit object in new tab");
707
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ rootButton.setToolTipText("Edit selection in new tab");
489709 rootButton.addActionListener(this);
490
- oe.aConstraints.gridx += 1;
491
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
710
+
711
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492712 closeButton.setToolTipText("Close tab");
493713 closeButton.addActionListener(this);
494714 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
495715 //clearButton.addActionListener(this);
496
- oe.aConstraints.gridx += 1;
497
-
498
- oe.aConstraints.gridx = 1; //
499
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
500
- editButton.addActionListener(this);
501
- oe.aConstraints.gridx += 1;
502
- oe.aConstraints.weighty = 0;
503
- oe.aConstraints.gridwidth = 1;
504716
505
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
717
+ // INSERT
718
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ gridButton.setToolTipText("Create grid");
720
+ gridButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ boxButton.setToolTipText("Create box");
724
+ boxButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ sphereButton.setToolTipText("Create sphere");
728
+ sphereButton.addActionListener(this);
729
+
730
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
731
+ coneButton.setToolTipText("Create cone");
732
+ coneButton.addActionListener(this);
733
+
734
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
735
+ torusButton.setToolTipText("Create torus");
736
+ torusButton.addActionListener(this);
737
+
738
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
739
+ superButton.setToolTipText("Create superellipsoid");
740
+ superButton.addActionListener(this);
741
+
742
+ if (Globals.ADVANCED)
743
+ {
744
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ kleinButton.setToolTipText("Create Klein bottle");
746
+ kleinButton.addActionListener(this);
747
+ }
748
+
749
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ particlesButton.setToolTipText("Create particle system");
751
+ particlesButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.Return();
754
+
755
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ groupButton.setToolTipText("Create group");
757
+ groupButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ compositeButton.setToolTipText("Create composite");
761
+ compositeButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ switchButton.setToolTipText("Create item switcher");
765
+ switchButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ loopButton.setToolTipText("Create loop");
769
+ loopButton.addActionListener(this);
770
+
771
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
772
+ textureButton.setToolTipText("Create texture");
773
+ textureButton.addActionListener(this);
774
+
775
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
776
+ overlayButton.setToolTipText("Create overlay");
777
+ overlayButton.addActionListener(this);
778
+
779
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ lightButton.setToolTipText("Create light");
781
+ lightButton.addActionListener(this);
782
+
783
+ for (int i=6; --i>=0;)
784
+ {
785
+ oe.toolboxPanel.Return();
786
+ oe.toolboxPanel.add(new cGridBag());
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ }
794
+
795
+ // EDIT panel
796
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ editButton.setToolTipText("Pin selection controls");
798
+ editButton.addActionListener(this);
799
+
800
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ uneditButton.setToolTipText("Remove selection controls");
506802 uneditButton.addActionListener(this);
507803
508
- oe.aConstraints.gridx += 1;
509
- oe.aConstraints.weighty = 0;
510
- oe.aConstraints.gridwidth = 1;
511
-
512
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
513
- clearPanelButton.addActionListener(this);
514
-
515
- oe.aConstraints.gridx += 1;
516
- oe.aConstraints.weighty = 0;
517
- oe.aConstraints.gridwidth = 1;
518
-
519
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
804
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
805
+ allParamsButton.setToolTipText("Show all controle");
520806 allParamsButton.addActionListener(this);
521807
522
- oe.aConstraints.gridx += 1;
523
- oe.aConstraints.weighty = 0;
524
- oe.aConstraints.gridwidth = 1;
525
-
526
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
808
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ clearPanelButton.setToolTipText("Clear edit panel");
810
+ clearPanelButton.addActionListener(this);
811
+
812
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ unselectButton.setToolTipText("Unselect");
527814 unselectButton.addActionListener(this);
528815
816
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ flashSelectionButton.setToolTipText("Highlight selection");
818
+ flashSelectionButton.addActionListener(this);
819
+
820
+ editCommandsPanel.preferredHeight = 1;
821
+
822
+ SetPinStates(false);
823
+// oe.treePanel.add(commandsPanel);
824
+// oe.treePanel.Return();
825
+
529826 // oe.aConstraints.gridx += 1;
530827 // oe.aConstraints.weighty = 0;
531828 // oe.aConstraints.gridwidth = 1;
....@@ -537,40 +834,25 @@
537834 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
538835 // gcButton.addActionListener(this);
539836
540
- oe.aConstraints.gridx = 0;
541
- oe.aConstraints.gridy += 1;
542
-
543
- //ctrlPanel.add(objList = new List(5, true));
544
- oe.aConstraints.gridwidth = 100;
545
- // oe.aConstraints.gridheight = 100;
546
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
547
- oe.aConstraints.gridheight = 1;
548
- oe.aConstraints.weighty = 0.5;
549
- oe.aConstraints.gridx = 0;
550
- JScrollPane jSP;
837
+ cGridBag jSPPanel = new cGridBag();
838
+
839
+ JScrollPane jSP;
551840 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
552
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
841
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
553842 ResetModel();
554
- oe.aConstraints.weighty = 0.5;
555
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
556
- oe.aConstraints.gridy += 1;
557
- oe.aConstraints.gridwidth = 1;
558
-
559
- oe.aConstraints.weighty = 0;
560
- oe.aConstraints.gridwidth = 2;
561
-
562
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
563
- colorCB.addItemListener(this);
564
- oe.aConstraints.gridx += 2;
565
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
566
- materialCB.addItemListener(this);
567
- oe.aConstraints.gridx += 2;
568
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
569
- textureCB.addItemListener(this);
570
-
571
- oe.aConstraints.gridx = 0;
572
- oe.aConstraints.gridy += 1;
573843
844
+ oe.treePanel.add(jSPPanel);
845
+ oe.treePanel.Return();
846
+
847
+ oe.treePanel.add(copyOptionsPanel);
848
+ oe.treePanel.Return();
849
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
850
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
851
+ sliderPane.preferredHeight = 1;
852
+
853
+// mainPanel.setDividerLocation(0.5); //1.0);
854
+// mainPanel.setResizeWeight(0.5);
855
+
574856 //jList.addListSelectionListener(this);
575857 oe.jTree.addTreeSelectionListener(this);
576858 //jTree.setRootVisible(false);
....@@ -595,47 +877,61 @@
595877
596878 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
597879 {
598
- //constraints.gridx = 0;
599
- //constraints.gridy = 0;
600
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
601
- fastCB.setToolTipText("Fast mode");
602
- fastCB.addItemListener(this);
603
- //constraints.gridy += 1;
604
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
605
- supportCB.setToolTipText("Enabled rigging");
606
- supportCB.addItemListener(this);
880
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
881
+ colorCB.setToolTipText("Copy color when dropped");
882
+ colorCB.addItemListener(this);
607883
608
- // constraints.gridy += 1;
884
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
885
+ materialCB.setToolTipText("Copy material when dropped");
886
+ materialCB.addItemListener(this);
887
+
888
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
889
+ textureCB.setToolTipText("Copy texture when dropped");
890
+ textureCB.addItemListener(this);
891
+
892
+ panel.Return();
893
+
894
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
895
+ boxCB.setToolTipText("Display bounding boxes");
896
+ boxCB.addItemListener(this);
897
+
898
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
899
+ zoomBoxCB.setToolTipText("Display only for wheel");
900
+ zoomBoxCB.addItemListener(this);
901
+
902
+ if (true) // Globals.ADVANCED)
903
+ {
904
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
905
+// supportCB.setToolTipText("Enable rigging");
906
+// supportCB.addItemListener(this);
907
+
908
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
909
+ freezeCB.setToolTipText("Fast moving camera");
910
+ freezeCB.addItemListener(this);
911
+
609912 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
610913 // localCB.addItemListener(this);
611914
612
- //constraints.gridy += 1;
915
+ panel.Return();
916
+
613917 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
614918 crowdCB.setToolTipText("Used for crowds");
615919 crowdCB.addItemListener(this);
616920
617
- //constraints.gridy += 1;
618921 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
619922 smoothCB.setToolTipText("Snapping delay");
620923 smoothCB.addItemListener(this);
621924
622
- //constraints.gridy += 1;
623925 panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
624926 slowCB.setToolTipText("Smooth interpolation");
625927 slowCB.addItemListener(this);
626
- //constraints.gridy += 1;
627
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
628
- boxCB.setToolTipText("Display bounding boxes");
629
- boxCB.addItemListener(this);
630
- //constraints.gridy += 1;
631
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
632
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
633
- zoomBoxCB.addItemListener(this);
634
-
928
+
635929 // constraints.gridy += 1;
636930 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
637931 // speakerMocapCB.addItemListener(this);
638932
933
+ panel.Return();
934
+
639935 if (false)
640936 {
641937 // handled in scripts
....@@ -650,26 +946,72 @@
650946 //constraints.gridy += 1;
651947 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
652948 smoothfocusCB.addItemListener(this);
949
+ panel.Return();
653950 }
654951
655952 //constraints.gridx += 1;
656953 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
657954 // debugCB.addItemListener(this);
658955
659
- //constraints.gridy += 1;
956
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
957
+ trackCB.setToolTipText("Enable tracking target");
958
+ trackCB.addItemListener(this);
959
+
660960 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
961
+ oeilCB.setToolTipText("Move camera when tracking");
661962 oeilCB.addItemListener(this);
662963
663
- //constraints.gridy += 1;
964
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
965
+ shadowCB.setToolTipText("When live compute shadows");
966
+ shadowCB.addItemListener(this);
967
+
968
+ panel.Return();
969
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
970
+ toggleTextureCB.setToolTipText("Load textures");
971
+ toggleTextureCB.addItemListener(this);
972
+
973
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
974
+ toggleSwitchCB.setToolTipText("Choose a single item");
975
+ toggleSwitchCB.addItemListener(this);
976
+
977
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
978
+ autokeepCB.setToolTipText("On structure change");
979
+ autokeepCB.addItemListener(this);
980
+
981
+ panel.Return();
982
+ if (Globals.ADVANCED)
983
+ {
664984 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
665985 lookAtCB.setToolTipText("Look-at target");
666986 lookAtCB.addItemListener(this);
987
+ }
988
+
989
+ }
990
+
991
+ cGridBag fill = new cGridBag();
992
+ fill.preferredHeight = 200;
993
+ cGridBag fill2 = new cGridBag();
994
+ fill2.preferredHeight = 200;
995
+ cGridBag fill3 = new cGridBag();
996
+ fill3.preferredHeight = 200;
997
+
998
+ panel.add(fill);
999
+ panel.add(fill2);
1000
+ panel.add(fill3);
6671001
6681002 }
6691003
6701004 void EditObject(Object3D obj)
6711005 {
6721006 cRadio radioButton = new cRadio(obj.name);
1007
+
1008
+ // June 2019. Patch to avoid bug with transparency.
1009
+ radioButton.hadMaterial = obj.material != null;
1010
+ if (!radioButton.hadMaterial)
1011
+ {
1012
+ obj.material = new cMaterial();
1013
+ }
1014
+
6731015 radioButton.SetObject(obj);
6741016 radioButton.layout = sevenButton;
6751017 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -678,8 +1020,11 @@
6781020 buttonGroup.add(radioButton);
6791021 radioButton.doClick();
6801022 }
1023
+
6811024 void SetupViews(ObjEditor oe)
6821025 {
1026
+ theFrame = this;
1027
+
6831028 oe.SetupViews();
6841029
6851030 System.out.println("SetupViews");
....@@ -688,23 +1033,28 @@
6881033 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6891034 }
6901035
691
- JCheckBox liveCB;
692
- JCheckBox supportCB;
693
- JCheckBox localCB;
694
- JCheckBox crowdCB;
695
- JCheckBox smoothCB;
696
- JCheckBox fastCB;
697
- JCheckBox slowCB;
698
- JCheckBox boxCB;
699
- JCheckBox zoomBoxCB;
700
- JCheckBox trackCB;
701
- JCheckBox smoothfocusCB;
1036
+ cToggleButton liveCB;
1037
+ cCheckBox supportCB;
1038
+ cCheckBox localCB;
1039
+ cCheckBox crowdCB;
1040
+ cCheckBox smoothCB;
1041
+ cToggleButton fastCB;
1042
+ cCheckBox slowCB;
1043
+ cCheckBox boxCB;
1044
+ cCheckBox zoomBoxCB;
1045
+ cCheckBox freezeCB;
1046
+ //cToggleButton trackCB;
1047
+ cCheckBox trackCB;
1048
+ cCheckBox smoothfocusCB;
7021049 // JCheckBox speakerMocapCB;
703
- JCheckBox speakerCameraCB;
704
- JCheckBox speakerFocusCB;
705
- JCheckBox debugCB;
706
- JCheckBox oeilCB;
707
- JCheckBox lookAtCB;
1050
+ cCheckBox speakerCameraCB;
1051
+ cCheckBox speakerFocusCB;
1052
+ cCheckBox debugCB;
1053
+
1054
+ cCheckBox oeilCB;
1055
+ cCheckBox shadowCB;
1056
+ cCheckBox autokeepCB;
1057
+ cCheckBox lookAtCB;
7081058
7091059 // static int COLOR = 1;
7101060 // static int MATERIAL = 2;
....@@ -712,9 +1062,9 @@
7121062
7131063 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7141064
715
- JCheckBox colorCB;
716
- JCheckBox materialCB;
717
- JCheckBox textureCB;
1065
+ cCheckBox colorCB;
1066
+ cCheckBox materialCB;
1067
+ cCheckBox textureCB;
7181068
7191069 public void itemStateChanged(ItemEvent e)
7201070 {
....@@ -742,6 +1092,7 @@
7421092 } else if(e.getSource() == liveCB)
7431093 {
7441094 cameraView.ToggleLive();
1095
+ refreshContents(false);
7451096 }
7461097 else if(e.getSource() == supportCB)
7471098 {
....@@ -806,6 +1157,18 @@
8061157 {
8071158 cameraView.ToggleOeil();
8081159 }
1160
+ else if(e.getSource() == shadowCB)
1161
+ {
1162
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1163
+ }
1164
+ else if(e.getSource() == freezeCB)
1165
+ {
1166
+ Globals.FREEZEONMOVE ^= true;
1167
+ }
1168
+ else if(e.getSource() == autokeepCB)
1169
+ {
1170
+ Globals.REPLACEONMAKE ^= true;
1171
+ }
8091172 else if(e.getSource() == lookAtCB)
8101173 {
8111174 cameraView.ToggleLookAt();
....@@ -822,7 +1185,8 @@
8221185
8231186 /**/
8241187 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
825
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1188
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ TreePath path = objEditor.jTree.getSelectionPath();
8261190 if ((path == null) || (path.getPathCount() <= 1)) {
8271191 // We can't move the root node or an empty selection
8281192 return;
....@@ -885,8 +1249,6 @@
8851249 }
8861250 }
8871251
888
- String string = (String) object;
889
-
8901252 System.out.println("Transfer = " + object + "; drop : " + target);
8911253 // if( object instanceof java.io.File[])
8921254 // {
....@@ -894,7 +1256,11 @@
8941256 // objEditor.DropFile((java.io.File[]) object, true);
8951257 // return;
8961258 // }
897
- if (string.charAt(0) == '/')
1259
+
1260
+ String string = object.toString();
1261
+
1262
+ // File path for Mac and Windows
1263
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8981264 {
8991265 // file(s)
9001266 String[] names = string.split("\n");
....@@ -921,7 +1287,7 @@
9211287
9221288 flashIt = false;
9231289 CameraPane pane = (CameraPane) target;
924
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1290
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9251291 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9261292
9271293 if (group.selection.size() == 1)
....@@ -937,23 +1303,33 @@
9371303
9381304 assert target == objEditor.jTree;
9391305 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1306
+ Object3D destinationLeaf;
9401307 try {
941
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1308
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9421309 } catch (Exception e) {
9431310 System.out.println("destinationPath : " + destinationPath);
9441311 return;
9451312 }
9461313
947
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1314
+ for (int i=group.selection.size(); --i>=0;)
9481315 {
1316
+ Object3D child = (Object3D)group.selection.elementAt(i);
1317
+
1318
+ // Cannot move into itself
1319
+ if (child == destinationLeaf)
1320
+ return;
1321
+ }
1322
+
1323
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1324
+// {
9491325 loadClipboard(true);
9501326 objEditor.jTree.setSelectionPath(destinationPath);
951
- pasteInto(false);
952
- } else {
953
- loadClipboard(false);
954
- objEditor.jTree.setSelectionPath(destinationPath);
955
- pasteInto(false); // true); // ???
956
- }
1327
+ pasteInto(false, false);
1328
+// } else {
1329
+// loadClipboard(false);
1330
+// objEditor.jTree.setSelectionPath(destinationPath);
1331
+// pasteInto(false, false); // true); // ???
1332
+// }
9571333 }
9581334 public void dropActionChanged(DropTargetDragEvent dtde)
9591335 // Called if the user has modified the current drop gesture
....@@ -1058,85 +1434,107 @@
10581434 {
10591435 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10601436 //heightFieldItem.addActionListener(this);
1061
- gridItem = menu.add(new MenuItem("Grid"));
1062
- gridItem.addActionListener(this);
1063
- rectoidItem = menu.add(new MenuItem("Box"));
1064
- rectoidItem.addActionListener(this);
1065
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1066
- ellipsoidItem.addActionListener(this);
1067
- coneItem = menu.add(new MenuItem("Cone"));
1068
- coneItem.addActionListener(this);
1069
- torusItem = menu.add(new MenuItem("Torus"));
1070
- torusItem.addActionListener(this);
1071
- superItem = menu.add(new MenuItem("Superellipsoid"));
1072
- superItem.addActionListener(this);
1437
+// gridItem = menu.add(new MenuItem("Grid"));
1438
+// gridItem.addActionListener(this);
1439
+// rectoidItem = menu.add(new MenuItem("Box"));
1440
+// rectoidItem.addActionListener(this);
1441
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1442
+// ellipsoidItem.addActionListener(this);
1443
+// coneItem = menu.add(new MenuItem("Cone"));
1444
+// coneItem.addActionListener(this);
1445
+// torusItem = menu.add(new MenuItem("Torus"));
1446
+// torusItem.addActionListener(this);
1447
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1448
+// superItem.addActionListener(this);
1449
+
1450
+ cameraItem = menu.add(new MenuItem("Camera"));
1451
+ cameraItem.addActionListener(this);
1452
+
1453
+ if (!Globals.ADVANCED)
1454
+ {
10731455 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10741456 kleinItem.addActionListener(this);
1075
- particleItem = menu.add(new MenuItem("Particle system"));
1076
- particleItem.addActionListener(this);
1457
+ }
1458
+
1459
+// particleItem = menu.add(new MenuItem("Particle system"));
1460
+// particleItem.addActionListener(this);
1461
+ if (Globals.ADVANCED)
1462
+ {
10771463 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10781464 ragdollItem.addActionListener(this);
10791465 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10801466 ragdoll2Item.addActionListener(this);
1467
+ }
10811468 menu.add("-");
1082
- meshItem = menu.add(new MenuItem("Mesh"));
1469
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10831470 meshItem.addActionListener(this);
10841471 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10851472 // meshGroupItem.addActionListener(this);
1473
+ if (Globals.ADVANCED)
1474
+ {
10861475 springItem = menu.add(new MenuItem("Spring"));
10871476 springItem.addActionListener(this);
10881477 flagItem = menu.add(new MenuItem("Flag"));
10891478 flagItem.addActionListener(this);
1090
- bezierItem = menu.add(new MenuItem("Patch"));
1091
- bezierItem.addActionListener(this);
1092
- checkerItem = menu.add(new MenuItem("Checker"));
1093
- checkerItem.addActionListener(this);
10941479 blobItem = menu.add(new MenuItem("Blob"));
10951480 blobItem.addActionListener(this);
10961481 latheItem = menu.add(new MenuItem("Lathe"));
10971482 latheItem.addActionListener(this);
1098
- lightItem = menu.add(new MenuItem("Light"));
1099
- lightItem.addActionListener(this);
1483
+ }
1484
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1485
+ bezierItem.addActionListener(this);
1486
+// overlayItem = menu.add(new MenuItem("Overlay"));
1487
+// overlayItem.addActionListener(this);
1488
+// lightItem = menu.add(new MenuItem("Light"));
1489
+// lightItem.addActionListener(this);
11001490 menu.add("-");
11011491 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11021492 //superLoopItem.addActionListener(this);
1103
- loopItem = menu.add(new MenuItem("Loop"));
1104
- loopItem.addActionListener(this);
1493
+// loopItem = menu.add(new MenuItem("Loop"));
1494
+// loopItem.addActionListener(this);
11051495 doubleItem = menu.add(new MenuItem("Fork"));
11061496 doubleItem.addActionListener(this);
1497
+ if (Globals.ADVANCED)
1498
+ {
11071499 tripleItem = menu.add(new MenuItem("Trident"));
11081500 tripleItem.addActionListener(this);
1501
+ }
11091502 }
11101503
11111504 void buildToolsMenu(Menu menu)
11121505 {
11131506 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11141507 animationItem.addItemListener(this);
1115
- animationItem.setState(CameraPane.ANIMATION);
1508
+ animationItem.setState(Globals.ANIMATION);
1509
+
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
11161512
11171513 menu.add("-");
11181514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11191515 parseverticesItem.addActionListener(this);
11201516 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11211517 textureFieldItem.addActionListener(this);
1122
- alignItem = menu.add(new MenuItem("Align"));
1518
+ alignItem = menu.add(new MenuItem("Align Objects"));
11231519 alignItem.addActionListener(this);
1124
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1125
- mirrorItem.addActionListener(this);
11261520 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11271521 reduceMorphItem.addActionListener(this);
11281522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11291523 reduce34MorphItem.addActionListener(this);
1130
-
1131
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1132
- computeAOItem.addActionListener(this);
11331524 menu.add("-");
1134
-
11351525 menu.add(memoryItem = new MenuItem("Memory Usage"));
11361526 memoryItem.addActionListener(this);
1527
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1528
+ computeAOItem.addActionListener(this);
1529
+
1530
+ if (Globals.ADVANCED)
1531
+ {
1532
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1533
+ mirrorItem.addActionListener(this);
1534
+ menu.add("-");
11371535 menu.add(analyzeItem = new MenuItem("Analyze"));
11381536 analyzeItem.addActionListener(this);
1139
- menu.add(dumpItem = new MenuItem("Dump"));
1537
+ menu.add(dumpItem = new MenuItem("Print"));
11401538 dumpItem.addActionListener(this);
11411539 // menu.add(pathItem = new MenuItem("From-to path"));
11421540 // pathItem.addActionListener(this);
....@@ -1154,6 +1552,7 @@
11541552 menu.add("-");
11551553 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11561554 editScriptItem.addActionListener(this);
1555
+ }
11571556 }
11581557
11591558 void ScreenFit()
....@@ -1276,9 +1675,24 @@
12761675 shadow.material = new cMaterial(obj.material);
12771676 shadow.material.diffuse = 0.0001f;
12781677 shadow.material.specular = 0.0001f;
1678
+ //shadow.projectedVertices[1].x = 300;
12791679
12801680 makeSomething(shadow);
12811681 }
1682
+
1683
+ private void ClearUnpinned()
1684
+ {
1685
+ //for (Object3D obj : listUI)
1686
+ for (int i=listUI.size(); --i>=0;)
1687
+ {
1688
+ Object3D obj = listUI.elementAt(i);
1689
+ if (!obj.pinned)
1690
+ {
1691
+ obj.CloseUI();
1692
+ listUI.remove(i);
1693
+ }
1694
+ }
1695
+ }
12821696
12831697 /**
12841698 * applyExample
....@@ -1482,9 +1896,9 @@
14821896
14831897 void Overwrite(int mask)
14841898 {
1485
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1899
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14861900 {
1487
- Object3D content = GrafreeD.clipboard.get(0);
1901
+ Object3D content = Grafreed.clipboard.get(0);
14881902
14891903 if (content instanceof cGroup && ((cGroup)content).transientlink )
14901904 content = ((cGroup)content).get(0);
....@@ -1523,7 +1937,7 @@
15231937 {
15241938 ScreenFit();
15251939 } else
1526
- if (source == switchItem)
1940
+ if (source == switchViewItem)
15271941 {
15281942 cVector v1 = new cVector();
15291943 cVector v2 = new cVector();
....@@ -1532,11 +1946,11 @@
15321946 objEditor.cameraView.renderCamera.setAim(v2, v1);
15331947 objEditor.cameraView.repaint();
15341948 } else
1535
- if (source == rectoidItem)
1949
+ if (source == rectoidItem || source == boxButton)
15361950 {
15371951 makeSomething(new Box());
15381952 } else
1539
- if (source == particleItem)
1953
+ if (source == particleItem || source == particlesButton)
15401954 {
15411955 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15421956 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1615,27 +2029,27 @@
16152029
16162030 makeSomething(obj);
16172031 } else
1618
- if (source == gridItem)
2032
+ if (source == gridItem || source == gridButton)
16192033 {
16202034 makeSomething(new Grid());
16212035 } else
1622
- if (source == ellipsoidItem)
2036
+ if (source == ellipsoidItem || source == sphereButton)
16232037 {
16242038 makeSomething(new Sphere());
16252039 } else
1626
- if (source == coneItem)
2040
+ if (source == coneItem || source == coneButton)
16272041 {
16282042 makeSomething(new Cone());
16292043 } else
1630
- if (source == torusItem)
2044
+ if (source == torusItem || source == torusButton)
16312045 {
16322046 makeSomething(new Torus());
16332047 } else
1634
- if (source == superItem)
2048
+ if (source == superItem || source == superButton)
16352049 {
16362050 makeSomething(new Superellipsoid());
16372051 } else
1638
- if (source == kleinItem)
2052
+ if (source == kleinItem || source == kleinButton)
16392053 {
16402054 makeSomething(new Klein());
16412055 } else
....@@ -1655,7 +2069,7 @@
16552069 {
16562070 makeSomething(new BezierSurface());
16572071 } else
1658
- if (source == checkerItem)
2072
+ if (source == overlayItem || source == overlayButton)
16592073 {
16602074 /*
16612075 Object3D obj = new BezierSurface(5,8);
....@@ -1703,7 +2117,7 @@
17032117 s.setup();
17042118 makeSomething(s);
17052119 } else
1706
- if (source == lightItem)
2120
+ if (source == lightItem || source == lightButton)
17072121 {
17082122 makeSomething(new Light());
17092123 } else
....@@ -1753,30 +2167,30 @@
17532167
17542168 group(g);
17552169 } else
1756
- if (source == loopItem)
2170
+ if (source == loopItem || source == loopButton)
17572171 {
17582172 Composite csg = new GroupLeaf();
17592173 csg.count = 5;
17602174 group(csg);
1761
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
17622176 csg.addChild(child);
17632177 child.addChild(csg);
17642178 } else
17652179 if (source == doubleItem)
17662180 {
1767
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
17682182 csg.count = 5;
17692183 group(csg);
1770
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
17712185 csg.addChild(child);
17722186 child.addChild(csg);
1773
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
17742188 csg.addChild(child);
17752189 child.addChild(csg);
17762190 } else
17772191 if (source == tripleItem)
17782192 {
1779
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
17802194 csg.count = 4;
17812195 group(csg);
17822196 Composite child = new cGroup();
....@@ -1788,23 +2202,6 @@
17882202 child = new cGroup();
17892203 csg.addChild(child);
17902204 child.addChild(csg);
1791
- } else
1792
-
1793
- if (source == importGFDItem)
1794
- {
1795
- ImportGFD();
1796
- } else
1797
- if (source == importVRMLX3DItem)
1798
- {
1799
- ImportVRMLX3D();
1800
- } else
1801
- if (source == import3DSItem)
1802
- {
1803
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1804
- } else
1805
- if (source == importOBJItem)
1806
- {
1807
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
18082205 } else
18092206 if (source == computeAOItem)
18102207 {
....@@ -1824,7 +2221,7 @@
18242221 if (source == invariantsItem)
18252222 {
18262223 System.out.println("Invariants:");
1827
- GrafreeD.grafreeD.universe.invariants();
2224
+ Grafreed.grafreeD.universe.invariants();
18282225 } else
18292226 if (source == memoryItem)
18302227 {
....@@ -1843,19 +2240,61 @@
18432240 {
18442241 DumpObject();
18452242 } else
2243
+ if (source == minButton)
2244
+ {
2245
+ Minimize();
2246
+ } else
2247
+ if (source == maxButton)
2248
+ {
2249
+ Maximize();
2250
+ } else
2251
+ if (source == fullButton)
2252
+ {
2253
+ ToggleFullScreen();
2254
+ } else
2255
+ if (source == undoButton)
2256
+ {
2257
+ // Go to previous version
2258
+ //if (!Undo())
2259
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2260
+ Undo();
2261
+ } else
2262
+ if (source == restoreButton)
2263
+ {
2264
+ // Restore current version
2265
+ Restore();
2266
+ } else
2267
+ if (source == replaceButton)
2268
+ {
2269
+ // Overwrite current version
2270
+ Replace();
2271
+ } else
2272
+ if (source == redoButton)
2273
+ {
2274
+ // Go to next version
2275
+ Redo();
2276
+ } else
2277
+ if (source == saveButton)
2278
+ {
2279
+ // Save a new version
2280
+ if (!Save(true))
2281
+ java.awt.Toolkit.getDefaultToolkit().beep();
2282
+ } else
2283
+ if (source == oneStepButton)
2284
+ {
2285
+ Globals.ONESTEP = true;
2286
+ cameraView.repaint();
2287
+ } else
18462288 if (source == screenfitButton)
18472289 {
1848
- //Reload(lastConverter, lastFilename, true);
18492290 ScreenFit();
18502291 } else
18512292 if (source == screenfitpointButton)
18522293 {
1853
- //Reload(lastConverter, lastFilename, true);
18542294 ScreenFitPoint();
18552295 } else
18562296 if (source == snapobjectButton)
18572297 {
1858
- //Reload(lastConverter, lastFilename, true);
18592298 SnapObject();
18602299 } else
18612300 // if (event.getSource() == recompileButton)
....@@ -1892,12 +2331,20 @@
18922331 {
18932332 loadClipboard(true);
18942333 } else
2334
+ if (source == undoItem)
2335
+ {
2336
+ Undo();
2337
+ } else
2338
+ if (source == redoItem)
2339
+ {
2340
+ Redo();
2341
+ } else
18952342 if (source == duplicateItem)
18962343 {
1897
- Object3D keep = GrafreeD.clipboard;
2344
+ Object3D keep = Grafreed.clipboard;
18982345 loadClipboard(false);
18992346 paste(false);
1900
- GrafreeD.clipboard = keep;
2347
+ Grafreed.clipboard = keep;
19012348 } else
19022349 if (source == cloneItem)
19032350 {
....@@ -1915,13 +2362,17 @@
19152362 {
19162363 paste(false);
19172364 } else
2365
+ if (source == pasteIntoItem)
2366
+ {
2367
+ pasteInto(true, false);
2368
+ } else
19182369 if (source == pasteLinkItem)
19192370 {
1920
- pasteInto(false);
2371
+ pasteInto(false, false);
19212372 } else
19222373 if (source == pasteCloneItem)
19232374 {
1924
- pasteInto(true);
2375
+ pasteInto(true, true);
19252376 } else
19262377 if (source == pasteExpandItem)
19272378 {
....@@ -2113,9 +2564,9 @@
21132564 // group.selection.get(0).setMasterThis(content); // should be identity
21142565 // refreshContents();
21152566 // }
2116
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2567
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21172568 {
2118
- Object3D content = GrafreeD.clipboard.get(0);
2569
+ Object3D content = Grafreed.clipboard.get(0);
21192570
21202571 if (content instanceof cGroup && ((cGroup)content).transientlink )
21212572 content = ((cGroup)content).get(0);
....@@ -2123,11 +2574,11 @@
21232574 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21242575 for (int i=0; i<group.selection.size(); i++)
21252576 {
2126
- boolean random = CameraPane.RANDOM;
2127
- CameraPane.RANDOM = false; // parse all random nodes
2577
+ boolean random = CameraPane.SWITCH;
2578
+ CameraPane.SWITCH = false; // parse all random nodes
21282579 group.selection.get(i).linkVerticesThis(content);
21292580 // group.selection.get(i).setMasterThis(content); // should be identity
2130
- CameraPane.RANDOM = random;
2581
+ CameraPane.SWITCH = random;
21312582 }
21322583 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21332584 refreshContents();
....@@ -2137,20 +2588,20 @@
21372588 {
21382589 for (int i=0; i<group.selection.size(); i++)
21392590 {
2140
- boolean random = CameraPane.RANDOM;
2141
- CameraPane.RANDOM = false; // parse all random nodes
2591
+ boolean random = CameraPane.SWITCH;
2592
+ CameraPane.SWITCH = false; // parse all random nodes
21422593 group.selection.get(i).linkVerticesThis(null);
2143
- CameraPane.RANDOM = random;
2594
+ CameraPane.SWITCH = random;
21442595 }
21452596
21462597 refreshContents();
21472598 } else
21482599 if (source == relinkverticesItem)
21492600 {
2150
- boolean random = CameraPane.RANDOM;
2151
- CameraPane.RANDOM = false; // parse all random nodes
2601
+ boolean random = CameraPane.SWITCH;
2602
+ CameraPane.SWITCH = false; // parse all random nodes
21522603 group.selection.RelinkToSupport();
2153
- CameraPane.RANDOM = random;
2604
+ CameraPane.SWITCH = random;
21542605
21552606 refreshContents();
21562607 } else
....@@ -2165,9 +2616,9 @@
21652616 } else
21662617 if (source == setMasterItem)
21672618 {
2168
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2619
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21692620 {
2170
- Object3D content = GrafreeD.clipboard.get(0);
2621
+ Object3D content = Grafreed.clipboard.get(0);
21712622
21722623 if (content instanceof cGroup && ((cGroup)content).transientlink )
21732624 content = ((cGroup)content).get(0);
....@@ -2180,9 +2631,9 @@
21802631 {
21812632 if (group.selection.size() == 1)
21822633 {
2183
- if (GrafreeD.clipboard.size() == 1)
2634
+ if (Grafreed.clipboard.size() == 1)
21842635 {
2185
- Object3D content = GrafreeD.clipboard.get(0);
2636
+ Object3D content = Grafreed.clipboard.get(0);
21862637
21872638 if (content instanceof cGroup && ((cGroup)content).transientlink )
21882639 content = ((cGroup)content).get(0);
....@@ -2199,7 +2650,7 @@
21992650 {
22002651 RevertMeshes();
22012652 } else
2202
- if (source == resetMeshItem)
2653
+ if (source == resetAllItem)
22032654 {
22042655 ResetAll();
22052656 } else
....@@ -2219,9 +2670,9 @@
22192670 {
22202671 ClearSelection(true);
22212672 } else
2222
- if (source == grabItem)
2673
+ if (source == grabItem || source == groupButton)
22232674 {
2224
- group(new cGroup(), true);
2675
+ group(new cGroup(), false); // true);
22252676 } else
22262677 if (source == hideItem)
22272678 {
....@@ -2239,16 +2690,16 @@
22392690 {
22402691 makeSomething(new Camera());
22412692 } else
2242
- if (source == compositeItem)
2693
+ if (source == compositeItem || source == compositeButton)
22432694 {
22442695 group(new Composite());
22452696 } else
2246
- if (source == randomItem)
2697
+ if (source == switchItem || source == switchButton)
22472698 {
22482699 RandomNode random = new RandomNode();
22492700 group(random);
22502701 if (random.size() > 0)
2251
- random.name = random.get(0).name + "Rnd";
2702
+ random.name = random.get(0).name + "Switch";
22522703 } else
22532704 if (source == physicsItem)
22542705 {
....@@ -2345,7 +2796,7 @@
23452796 {
23462797 group(new cLinker());
23472798 } else
2348
- if (source == textureItem)
2799
+ if (source == textureItem || source == textureButton)
23492800 {
23502801 group(new TextureNode());
23512802 } else
....@@ -2365,17 +2816,30 @@
23652816 {
23662817 CastShadow(2);
23672818 } else
2368
- if (source == ungroupItem)
2819
+ if (source == ungroupItem || source == ungroupButton)
23692820 {
2370
- //ungroup();
2821
+ boolean hasRoot = false;
2822
+
23712823 for (int i=0; i<group.selection.size(); i++)
23722824 {
2373
- Ungroup(group.selection.get(i));
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
23742830 }
23752831
2376
- ClearSelection(false);
2377
-
2378
- refreshContents();
2832
+ if (!hasRoot)
2833
+ {
2834
+ for (int i=0; i<group.selection.size(); i++)
2835
+ {
2836
+ Ungroup(group.selection.get(i));
2837
+ }
2838
+
2839
+ ClearSelection(false);
2840
+
2841
+ refreshContents();
2842
+ }
23792843 } else
23802844 if (source == genUVItem)
23812845 {
....@@ -2387,7 +2851,7 @@
23872851 } else
23882852 if (source == genNormalsMESHItem)
23892853 {
2390
- GenNormals(true); // TODO
2854
+ GenNormalsMESH();
23912855 } else
23922856 if (source == genNormalsORGANItem)
23932857 {
....@@ -2452,6 +2916,22 @@
24522916 if (source == unmarkleavesItem)
24532917 {
24542918 MarkLeaves(false);
2919
+ } else
2920
+ if (source == rewindleavesItem)
2921
+ {
2922
+ RewindLeaves(true);
2923
+ } else
2924
+ if (source == unrewindleavesItem)
2925
+ {
2926
+ RewindLeaves(false);
2927
+ } else
2928
+ if (source == randomleavesItem)
2929
+ {
2930
+ RandomLeaves(true);
2931
+ } else
2932
+ if (source == unrandomleavesItem)
2933
+ {
2934
+ RandomLeaves(false);
24552935 } else
24562936 if (source == flipVItem)
24572937 {
....@@ -2537,9 +3017,13 @@
25373017 {
25383018 SmoothMesh();
25393019 } else
2540
- if (source == transformgeometryItem)
3020
+ if (source == transformGeometryItem)
25413021 {
25423022 TransformGeometry();
3023
+ } else
3024
+ if (source == transformChildrenItem)
3025
+ {
3026
+ TransformChildren();
25433027 } else
25443028 if (source == resetTransformItem)
25453029 {
....@@ -2547,7 +3031,11 @@
25473031 } else
25483032 if (source == resetCentroidItem)
25493033 {
2550
- ResetCentroid();
3034
+ ResetCentroid(true);
3035
+ } else
3036
+ if (source == resetCentroidXZItem)
3037
+ {
3038
+ ResetCentroid(false);
25513039 } else
25523040 if (source == resetParentItem)
25533041 {
....@@ -2679,6 +3167,10 @@
26793167 if (source == twoButton)
26803168 {
26813169 radio.layout = twoButton;
3170
+
3171
+ if (CameraPane.FULLSCREEN)
3172
+ fullscreenLayout = radio.layout;
3173
+
26823174 // bug
26833175 //gridPanel.setDividerLocation(1.0);
26843176 //bigPanel.setDividerLocation(0.0);
....@@ -2711,10 +3203,31 @@
27113203 bigThree.ClearUI();
27123204 bigThree.add(centralPanel);
27133205 bigThree.FlushUI();
3206
+
3207
+ cameraView.requestFocusInWindow();
3208
+
3209
+// refreshContents(true);
3210
+//
3211
+// try
3212
+// {
3213
+// java.awt.Robot bot = new java.awt.Robot();
3214
+// int mask = InputEvent.BUTTON1_MASK;
3215
+// bot.mouseMove(100, 100);
3216
+// bot.mousePress(mask);
3217
+// bot.mouseRelease(mask);
3218
+// }
3219
+// catch (Exception e)
3220
+// {
3221
+//
3222
+// }
3223
+
27143224 } else
27153225 if (source == threeButton)
27163226 {
27173227 radio.layout = threeButton;
3228
+
3229
+ if (CameraPane.FULLSCREEN)
3230
+ fullscreenLayout = radio.layout;
27183231
27193232 // bigThree.remove(scenePanel);
27203233 // bigThree.remove(centralPanel);
....@@ -2747,10 +3260,15 @@
27473260 bigThree.add(centralPanel);
27483261 bigThree.add(XYZPanel);
27493262 bigThree.FlushUI();
3263
+
3264
+ cameraView.requestFocusInWindow();
27503265 } else
27513266 if (source == fourButton)
27523267 {
27533268 radio.layout = fourButton;
3269
+
3270
+ if (CameraPane.FULLSCREEN)
3271
+ fullscreenLayout = radio.layout;
27543272
27553273 // bigThree.remove(scenePanel);
27563274 // bigThree.remove(centralPanel);
....@@ -2782,10 +3300,15 @@
27823300 bigThree.ClearUI();
27833301 bigThree.add(scenePanel);
27843302 bigThree.FlushUI();
3303
+
3304
+ cameraView.requestFocusInWindow();
27853305 } else
27863306 if (source == sixButton)
27873307 {
27883308 radio.layout = sixButton;
3309
+
3310
+ if (CameraPane.FULLSCREEN)
3311
+ fullscreenLayout = radio.layout;
27893312
27903313 // bigThree.remove(scenePanel);
27913314 // bigThree.remove(centralPanel);
....@@ -2818,10 +3341,15 @@
28183341 bigThree.add(scenePanel);
28193342 bigThree.add(centralPanel);
28203343 bigThree.FlushUI();
3344
+
3345
+ cameraView.requestFocusInWindow();
28213346 } else
28223347 if (source == sevenButton)
28233348 {
28243349 radio.layout = sevenButton;
3350
+
3351
+ if (CameraPane.FULLSCREEN)
3352
+ fullscreenLayout = radio.layout;
28253353
28263354 // bigThree.remove(scenePanel);
28273355 // bigThree.remove(centralPanel);
....@@ -2855,6 +3383,8 @@
28553383 bigThree.add(centralPanel);
28563384 bigThree.add(XYZPanel);
28573385 bigThree.FlushUI();
3386
+
3387
+ cameraView.requestFocusInWindow();
28583388 } else
28593389 if (source == rootButton)
28603390 {
....@@ -2866,6 +3396,7 @@
28663396 EditObject(obj);
28673397 }
28683398
3399
+ cameraView.requestFocusInWindow();
28693400 refreshContents(true);
28703401 } else
28713402 if (source == closeButton)
....@@ -2875,22 +3406,37 @@
28753406 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28763407 {
28773408 ab = (cRadio)e.nextElement();
2878
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3409
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28793410 {
3411
+ // Patch to avoid bug with transparency.
3412
+ if (!ab.hadMaterial)
3413
+ {
3414
+ ab.object.material = null;
3415
+ }
3416
+
28803417 buttonGroup.remove(ab);
28813418 radioPanel.remove(ab);
28823419
2883
- ab.GetObject().editWindow = null;
3420
+ //ab.GetObject().editWindow = null;
3421
+ ab.GetObject().manipWindow = null;
28843422 // ab.GetObject().objectUI = null; // ?????????
28853423
28863424 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28873425 break;
28883426 }
28893427 }
3428
+
3429
+ cameraView.requestFocusInWindow();
28903430 refreshContents(true);
28913431 } else
28923432 if (source == editItem || source == editButton)
28933433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
28943440 EditSelection(false);
28953441 } else
28963442 if (source == uneditButton)
....@@ -2900,12 +3446,13 @@
29003446 Object3D child = (Object3D)e.nextElement();
29013447 if(child.editWindow != null)
29023448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
29033450 child.CloseUI();
29043451 listUI.remove(child);
29053452
2906
- child.editWindow = null; // ???????????
3453
+ //child.editWindow = null; // ???????????
29073454 }
2908
- objEditor.ctrlPanel.validate();
3455
+ objEditor.ctrlPanel.FlushUI();
29093456 //objEditor.jTree.clearSelection();
29103457 //objEditor.ResetSliders();
29113458 refreshContents(true);
....@@ -2916,6 +3463,7 @@
29163463 //copy.ClearUI();
29173464 for (Object3D obj : listUI)
29183465 {
3466
+ obj.pinned = false;
29193467 obj.CloseUI();
29203468 }
29213469 listUI.clear();
....@@ -2925,7 +3473,7 @@
29253473 {
29263474 assert(copy == group);
29273475
2928
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29293477
29303478 for (Object3D obj : listUI)
29313479 {
....@@ -2974,6 +3522,9 @@
29743522 }
29753523
29763524 copy = group;
3525
+
3526
+ SetUndoStates();
3527
+
29773528 //Globals.theRenderer.object = group;
29783529 if(!useclient)
29793530 {
....@@ -2989,20 +3540,46 @@
29893540 frontView.object = group;
29903541 sideView.object = group;
29913542 }
2992
- group.editWindow = this;
3543
+
3544
+// fix "+" issue
3545
+ //group.editWindow = this;
3546
+ group.manipWindow = this;
3547
+
29933548 /*
29943549 currentLayout = radio.layout;
29953550 if (currentLayout == null)
29963551 currentLayout = sevenButton;
29973552 */
29983553 radio.layout.doClick();
3554
+
3555
+ ClearUnpinned();
3556
+ Grafreed.Assert(group != null);
3557
+ Grafreed.Assert(group.selection != null);
3558
+ SetPinStates(group.selection.size() > 0);
3559
+ if (group.selection.size() == 1)
3560
+ EditSelection(false);
29993561 keepparent = group.parent;
30003562 // PARENT = NULL or not???
30013563 //group.parent = null; // ROOT
30023564 //group.attributes = -1;
30033565 ResetModel();
3566
+
3567
+ cameraView.requestFocusInWindow();
30043568 refreshContents(true);
3005
- }
3569
+ } else if (event.getSource() == editCameraItem)
3570
+ {
3571
+ cameraView.ProtectCamera();
3572
+ cameraView.repaint();
3573
+ return;
3574
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3575
+ {
3576
+ cameraView.RevertCamera();
3577
+ cameraView.repaint();
3578
+ return;
3579
+ // } else if (event.getSource() == textureButton)
3580
+ // {
3581
+ // return; // true;
3582
+ }
30063583 else
30073584 {
30083585 //return super.action(event, arg);
....@@ -3011,7 +3588,6 @@
30113588 }
30123589
30133590 boolean useclient = false;
3014
- cRadio radio;
30153591
30163592 void ToggleRoot()
30173593 {
....@@ -3063,6 +3639,28 @@
30633639 refreshContents();
30643640 }
30653641
3642
+ void TransformChildren()
3643
+ {
3644
+ Object3D obj;
3645
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3646
+ {
3647
+ obj = (Object3D)e.nextElement();
3648
+ obj.KeepTextureMatrices();
3649
+ obj.TransformChildren();
3650
+ obj.RestoreTextureMatrices();
3651
+
3652
+// if (obj.parent == null)
3653
+// {
3654
+// System.out.println("NULL PARENT!");
3655
+// new Exception().printStackTrace();
3656
+// }
3657
+// else
3658
+// TouchTransform(obj);
3659
+// //obj.parent.Touch();
3660
+ }
3661
+
3662
+ refreshContents();
3663
+ }
30663664
30673665 void ResetTransform()
30683666 {
....@@ -3175,7 +3773,7 @@
31753773 refreshContents();
31763774 }
31773775
3178
- void ResetCentroid()
3776
+ void ResetCentroid(boolean full)
31793777 {
31803778 Object3D obj;
31813779 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3190,12 +3788,16 @@
31903788 LA.matIdentity(Object3D.mat);
31913789 obj.getBounds(minima, maxima, false);
31923790 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3193
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3791
+ if (full)
3792
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31943793 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31953794 obj.TransformMesh(Object3D.mat);
3795
+
31963796 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3197
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3797
+ if (full)
3798
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31983799 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3800
+
31993801 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32003802 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32013803 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3224,7 +3826,8 @@
32243826
32253827 int size = obj.MemorySize();
32263828
3227
- System.err.println((size/1024) + " KB is the size of " + obj);
3829
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3830
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32283831 }
32293832 }
32303833 catch (Exception e)
....@@ -3261,9 +3864,9 @@
32613864 obj = (Object3D)e.nextElement();
32623865
32633866 System.out.println("Object is: " + obj);
3264
- GrafreeD.AnalyzeObject(obj);
3867
+ Grafreed.AnalyzeObject(obj);
32653868 System.out.println("Boundary rep: " + obj.bRep);
3266
- GrafreeD.AnalyzeObject(obj.bRep);
3869
+ Grafreed.AnalyzeObject(obj.bRep);
32673870
32683871 // System.err.println((size/1024) + " KB is the size of " + obj);
32693872 }
....@@ -3305,6 +3908,13 @@
33053908 void GenNormals(boolean crease)
33063909 {
33073910 group.GenNormalsS(crease);
3911
+
3912
+ refreshContents();
3913
+ }
3914
+
3915
+ void GenNormalsMESH()
3916
+ {
3917
+ group.GenNormalsMeshS();
33083918
33093919 refreshContents();
33103920 }
....@@ -3477,8 +4087,8 @@
34774087
34784088 void ParseVertices()
34794089 {
3480
- boolean epsequal = GrafreeD.epsequal;
3481
- GrafreeD.epsequal = true;
4090
+ boolean epsequal = Grafreed.epsequal;
4091
+ Grafreed.epsequal = true;
34824092
34834093 for (int i=0; i<group.selection.size(); i++)
34844094 {
....@@ -3503,7 +4113,7 @@
35034113 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35044114 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35054115
3506
- g.add(GrafreeD.clipboard);
4116
+ g.add(Grafreed.clipboard);
35074117
35084118 buffer.add(g);
35094119 }
....@@ -3518,7 +4128,7 @@
35184128 makeSomething(buffer, i==group.selection.size()-1);
35194129 }
35204130
3521
- GrafreeD.epsequal = epsequal;
4131
+ Grafreed.epsequal = epsequal;
35224132
35234133 refreshContents();
35244134 }
....@@ -3536,7 +4146,16 @@
35364146 String pigment = Object3D.GetPigment(tex);
35374147 //String bump = Object3D.GetBump(tex);
35384148
3539
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4149
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4150
+
4151
+ try
4152
+ {
4153
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4154
+ }
4155
+ catch (Exception e)
4156
+ {
4157
+ System.err.println("FAIL: " + node);
4158
+ }
35404159
35414160 double s = v.s;
35424161
....@@ -3624,11 +4243,11 @@
36244243
36254244 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36264245
3627
- boolean random = CameraPane.RANDOM;
3628
- CameraPane.RANDOM = false; // parse all random nodes
4246
+ boolean random = CameraPane.SWITCH;
4247
+ CameraPane.SWITCH = false; // parse all random nodes
36294248 lowres.linkVerticesThis(null);
36304249 lowres.linkVerticesThis(sn);
3631
- CameraPane.RANDOM = random;
4250
+ CameraPane.SWITCH = random;
36324251
36334252 System.err.flush();
36344253
....@@ -3668,7 +4287,7 @@
36684287 return;
36694288
36704289 Object3D poses = group.selection.get(0);
3671
- Object3D ref = GrafreeD.clipboard.get(0);
4290
+ Object3D ref = Grafreed.clipboard.get(0);
36724291
36734292 Object3D newgroup = new Object3D("Po:" + poses.name);
36744293
....@@ -3862,9 +4481,9 @@
38624481
38634482 void ClipMesh()
38644483 {
3865
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4484
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38664485 {
3867
- Object3D content = GrafreeD.clipboard.get(0);
4486
+ Object3D content = Grafreed.clipboard.get(0);
38684487
38694488 if (content instanceof cGroup && ((cGroup)content).transientlink )
38704489 content = ((cGroup)content).get(0);
....@@ -3873,7 +4492,7 @@
38734492 // {
38744493 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38754494 // }
3876
- group.selection.ClipMesh(GrafreeD.clipboard);
4495
+ group.selection.ClipMesh(Grafreed.clipboard);
38774496 }
38784497 // group.selection.ClipMesh(GrafreeD.clipboard);
38794498 System.out.println("DONE.");
....@@ -3920,6 +4539,18 @@
39204539 void MarkLeaves(boolean hide)
39214540 {
39224541 group.selection.MarkLeaves(hide);
4542
+ refreshContents();
4543
+ }
4544
+
4545
+ void RewindLeaves(boolean hide)
4546
+ {
4547
+ group.selection.RewindLeaves(hide);
4548
+ refreshContents();
4549
+ }
4550
+
4551
+ void RandomLeaves(boolean hide)
4552
+ {
4553
+ group.selection.RandomLeaves(hide);
39234554 refreshContents();
39244555 }
39254556
....@@ -3994,10 +4625,6 @@
39944625 // }
39954626 // }
39964627
3997
- static boolean allparams = true;
3998
-
3999
- static Vector<Object3D> listUI = new Vector<Object3D>();
4000
-
40014628 void EditSelection(boolean newWindow)
40024629 {
40034630 // aConstraints.gridy = 0;
....@@ -4005,10 +4632,10 @@
40054632 {
40064633 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40074634 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4008
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4635
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40094636
40104637 Object3D elem = (Object3D)group.selection.elementAt(i);
4011
- if(elem != group)
4638
+ if(elem != group || !newWindow)
40124639 {
40134640 // if (!(elem instanceof Composite))
40144641 // newWindow = false;
....@@ -4090,7 +4717,8 @@
40904717 //new Exception().printStackTrace();
40914718
40924719 freezemodel = true;
4093
-
4720
+ ClearUnpinned();
4721
+
40944722 /**/
40954723 //switch (event.id)
40964724 {
....@@ -4098,7 +4726,6 @@
40984726 //case 702: // Event.LIST_DESELECT
40994727 group.deselectAll();
41004728 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4101
- objEditor.ClearInfo(); // .GetMaterial());
41024729 if (tps != null)
41034730 {
41044731 for (int i=0; i < tps.length; i++)
....@@ -4107,33 +4734,39 @@
41074734
41084735 //if (child.parent != null)
41094736 //child.parent.addSelectee(child);
4737
+ objEditor.SetMaterial(child);
41104738 group.addSelectee(child);
4111
- objEditor.SetMaterial(child); // .GetMaterial());
4112
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4113
- System.err.println("info : " + child.GetPath());
41144739 }
41154740 }
4116
- else
4117
- {
4118
- objEditor.SetMaterial(group); // .GetMaterial());
4119
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4120
- System.err.println("info : " + group.GetPath());
4121
- }
4741
+// else
4742
+// {
4743
+// objEditor.SetMaterial(group); // .GetMaterial());
4744
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4745
+// System.err.println("info : " + group.GetPath());
4746
+// }
41224747
4123
- objEditor.SetText(); // jan 2014
4124
-
4125
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4748
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41264749 CameraPane.flash = true;
41274750
4128
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4751
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41294752 // a camera
41304753 {
4131
- CameraPane.camerachangeframe = 0; // don't refuse it
4132
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4754
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4755
+ {
4756
+ CameraPane.camerachangeframe = 0; // don't refuse it
4757
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4758
+ }
41334759 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41344760 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41354761 }
41364762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
41374770 refreshContents();
41384771 //return true;
41394772 }
....@@ -4142,6 +4775,35 @@
41424775
41434776 freezemodel = false;
41444777 }
4778
+
4779
+ void SetPinStates(boolean enabled)
4780
+ {
4781
+ editButton.setEnabled(enabled);
4782
+ uneditButton.setEnabled(enabled);
4783
+ unselectButton.setEnabled(enabled);
4784
+ flashSelectionButton.setEnabled(enabled);
4785
+ }
4786
+
4787
+ void refreshContents(boolean cp)
4788
+ {
4789
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4790
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4791
+ {
4792
+ objEditor.ClearInfo(); // .GetMaterial());
4793
+
4794
+ for (int i=0; i < group.selection.Size(); i++)
4795
+ {
4796
+ Object3D child = (Object3D) group.selection.get(i);
4797
+
4798
+ objEditor.AddInfo(child, this, true);
4799
+ System.err.println("info : " + child.GetPath());
4800
+ }
4801
+
4802
+ objEditor.SetText(); // jan 2014
4803
+ }
4804
+
4805
+ super.refreshContents(cp);
4806
+ }
41454807
41464808 void linkSomething(Object3D thing)
41474809 {
....@@ -4213,16 +4875,19 @@
42134875 {
42144876 if (group.selection.isEmpty())
42154877 return;
4216
- GrafreeD.clipboardIsTempGroup = false;
4878
+
4879
+ Grafreed.clipboardIsTempGroup = false;
42174880 Composite tGroup = null;
42184881 if (group.selection.size() > 0) // 1)
42194882 {
42204883 tGroup = new cGroup();
4221
- GrafreeD.clipboardIsTempGroup = true;
4884
+ Grafreed.clipboardIsTempGroup = true;
42224885 }
42234886
42244887 if (cut)
42254888 {
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
42264891 //int indices[] = jList.getSelectedIndices();
42274892 //for (int i = indices.length - 1; i >= 0; i--)
42284893 //jList.remove(indices[i]);
....@@ -4258,16 +4923,16 @@
42584923 //System.out.println("cut " + child);
42594924 //System.out.println("parent = " + child.parent);
42604925 // tmp.addChild(child);
4261
- if (GrafreeD.clipboardIsTempGroup)
4926
+ if (Grafreed.clipboardIsTempGroup)
42624927 tGroup.add/*Child*/(tmp);
42634928 else
4264
- GrafreeD.clipboard = tmp;
4929
+ Grafreed.clipboard = tmp;
42654930 }
42664931 else
4267
- if (GrafreeD.clipboardIsTempGroup)
4932
+ if (Grafreed.clipboardIsTempGroup)
42684933 tGroup.add/*Child*/(child);
42694934 else
4270
- GrafreeD.clipboard = child;
4935
+ Grafreed.clipboard = child;
42714936 }
42724937
42734938 //ResetModel();
....@@ -4299,21 +4964,23 @@
42994964 //System.out.println("cut " + elem);
43004965 //System.out.println("parent = " + elem.parent);
43014966 // tmp.addChild(elem);
4302
- if (GrafreeD.clipboardIsTempGroup)
4967
+ if (Grafreed.clipboardIsTempGroup)
43034968 tGroup.add/*Child*/(tmp);
43044969 else
4305
- GrafreeD.clipboard = tmp;
4970
+ Grafreed.clipboard = tmp;
43064971 }
43074972 else
4308
- if (GrafreeD.clipboardIsTempGroup)
4973
+ if (Grafreed.clipboardIsTempGroup)
43094974 tGroup.add/*Child*/(child);
43104975 else
4311
- GrafreeD.clipboard = child;
4976
+ Grafreed.clipboard = child;
43124977 }
43134978
43144979 }
4315
- if (GrafreeD.clipboardIsTempGroup)
4316
- GrafreeD.clipboard = tGroup;
4980
+
4981
+ if (Grafreed.clipboardIsTempGroup)
4982
+ Grafreed.clipboard = tGroup;
4983
+
43174984 if (cut)
43184985 {
43194986 ResetModel();
....@@ -4323,11 +4990,15 @@
43234990
43244991 void paste(boolean expand)
43254992 {
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
43264997 // if (GrafreeD.clipboard == null)
43274998 // return;
43284999 boolean first = true;
43295000
4330
- if (GrafreeD.clipboardIsTempGroup)
5001
+ if (Grafreed.clipboardIsTempGroup)
43315002 {
43325003 Composite temp;
43335004
....@@ -4338,7 +5009,7 @@
43385009 temp = (Composite)Applet3D.clipboard.deepCopy();
43395010 */
43405011 Object3D elem;
4341
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5012
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43425013 {
43435014 Object3D child = (Object3D)e.nextElement();
43445015
....@@ -4372,21 +5043,22 @@
43725043 //Object3D cb = Applet3D.clipboard;
43735044 //temp.addChild(cb);
43745045 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4375
- assert(GrafreeD.clipboard.parent == null);
4376
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4377
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4378
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4379
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5046
+ assert(Grafreed.clipboard.parent == null);
5047
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5048
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5049
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5050
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43805051 else
4381
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4382
- GrafreeD.clipboard.get(0).parent = keepparent;
5052
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5053
+ Grafreed.clipboard.get(0).parent = keepparent;
43835054 }
43845055
5056
+ Globals.REPLACEONMAKE = keep;
43855057 ResetModel();
43865058 refreshContents();
43875059 }
43885060
4389
- void pasteInto(boolean copyit)
5061
+ void pasteInto(boolean copyit, boolean clone)
43905062 {
43915063 // if (GrafreeD.clipboard == null)
43925064 // return;
....@@ -4415,15 +5087,22 @@
44155087 if (copyit)
44165088 {
44175089 // paste(false);
4418
- CloneClipboard(false); // sept 2014
5090
+ if (clone)
5091
+ {
5092
+ CloneClipboard(false); // sept 2014
5093
+ }
5094
+ else
5095
+ {
5096
+ paste(false);
5097
+ }
44195098 }
44205099 else
44215100 {
44225101 boolean first = true;
44235102
4424
- if (GrafreeD.clipboardIsTempGroup)
5103
+ if (Grafreed.clipboardIsTempGroup)
44255104 {
4426
- Composite temp = (Composite)GrafreeD.clipboard;
5105
+ Composite temp = (Composite)Grafreed.clipboard;
44275106 Object3D copy;
44285107 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44295108 {
....@@ -4433,7 +5112,7 @@
44335112 }
44345113 } else
44355114 {
4436
- linkSomething(GrafreeD.clipboard); //.get(0));
5115
+ linkSomething(Grafreed.clipboard); //.get(0));
44375116 }
44385117 }
44395118 }
....@@ -4510,6 +5189,10 @@
45105189
45115190 void group(Object3D csg, boolean grab)
45125191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
45135196 if (//false) // why??
45145197 !group.selection.isEmpty())
45155198 {
....@@ -4623,10 +5306,15 @@
46235306 //node.add(csg);
46245307 //makeSomething(node);
46255308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
46265310 }
46275311
46285312 void Ungroup(Object3D g)
46295313 {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
46305318 if (g instanceof HiddenObject)
46315319 {
46325320 HiddenObject h = (HiddenObject) g;
....@@ -4643,6 +5331,7 @@
46435331 objEditor.makeSomething(g.get(i), false);
46445332 }
46455333 }
5334
+ Globals.REPLACEONMAKE = keep;
46465335 }
46475336
46485337 void ungroup()
....@@ -4838,21 +5527,6 @@
48385527 }
48395528 */
48405529
4841
- void ImportGFD()
4842
- {
4843
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4844
- browser.show();
4845
- String filename = browser.getFile();
4846
- if (filename != null && filename.length() > 0)
4847
- {
4848
- String fullname = browser.getDirectory() + filename;
4849
-
4850
- //Object3D readobj =
4851
- objEditor.ReadGFD(fullname, objEditor);
4852
- //makeSomething(readobj);
4853
- }
4854
- }
4855
-
48565530 /*
48575531 public void Callback(Object obj)
48585532 {
....@@ -4876,26 +5550,9 @@
48765550 }
48775551 */
48785552
4879
- void ImportVRMLX3D()
4880
- {
4881
- if (GrafreeD.standAlone)
4882
- {
4883
- /**/
4884
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4885
- browser.show();
4886
- String filename = browser.getFile();
4887
- if (filename != null && filename.length() > 0)
4888
- {
4889
- String fullname = browser.getDirectory() + filename;
4890
- LoadVRMLX3D(fullname);
4891
- }
4892
- /**/
4893
- }
4894
- }
4895
-
48965553 String GetFile(String dialogName)
48975554 {
4898
- if (GrafreeD.standAlone)
5555
+ if (Grafreed.standAlone)
48995556 {
49005557 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49015558 browser.show();
....@@ -4959,10 +5616,33 @@
49595616 cButton flashSelectionButton;
49605617 cButton editButton;
49615618 cButton uneditButton;
5619
+ JCheckBox allParamsButton;
49625620 cButton clearpanelButton;
4963
- cButton allParamsButton;
49645621 cButton unselectButton;
49655622
5623
+ cButton restoreCameraButton;
5624
+
5625
+ cButton saveButton;
5626
+ cButton oneStepButton;
5627
+
5628
+ cButton groupButton;
5629
+ cButton ungroupButton;
5630
+ cButton compositeButton;
5631
+ cButton switchButton;
5632
+ cButton loopButton;
5633
+ cButton textureButton;
5634
+
5635
+ cButton gridButton;
5636
+ cButton boxButton;
5637
+ cButton sphereButton;
5638
+ cButton coneButton;
5639
+ cButton torusButton;
5640
+ cButton superButton;
5641
+ cButton kleinButton;
5642
+ cButton particlesButton;
5643
+ cButton overlayButton;
5644
+ cButton lightButton;
5645
+
49665646 cButton screenfitButton;
49675647 cButton screenfitpointButton;
49685648 cButton snapobjectButton;
....@@ -4974,14 +5654,6 @@
49745654
49755655 cButton setsupportButton;
49765656
4977
- cButton twoButton;
4978
- cButton sixButton;
4979
- cButton threeButton;
4980
- cButton sevenButton;
4981
- cButton fourButton; // full panel
4982
- cButton oneButton; // full XYZ
4983
- //cButton currentLayout;
4984
-
49855657 //
49865658 //Composite
49875659 Object3D // to do !!
....@@ -4991,9 +5663,11 @@
49915663 //JTree jTree;
49925664 private MenuItem lookAtItem;
49935665 private MenuItem lookFromItem;
4994
- private MenuItem switchItem;
5666
+ private MenuItem switchViewItem;
49955667 private MenuItem cutItem;
4996
- private MenuItem duplicateItem;
5668
+ private MenuItem undoItem;
5669
+ private MenuItem redoItem;
5670
+ private JMenuItem duplicateItem;
49975671 private MenuItem cloneItem;
49985672 private MenuItem cloneSupportItem;
49995673 private MenuItem overwriteGeoItem;
....@@ -5006,7 +5680,7 @@
50065680 private MenuItem linkverticesItem;
50075681 private MenuItem relinkverticesItem;
50085682 private MenuItem setMasterItem;
5009
- private MenuItem resetMeshItem;
5683
+ private MenuItem resetAllItem;
50105684 private MenuItem stepAllItem;
50115685 private MenuItem revertMeshItem;
50125686 private MenuItem poseMeshItem;
....@@ -5017,6 +5691,7 @@
50175691 private MenuItem mergeGeometriesItem;
50185692 private MenuItem copyItem;
50195693 private MenuItem pasteItem;
5694
+ private MenuItem pasteIntoItem;
50205695 private MenuItem pasteLinkItem;
50215696 private MenuItem pasteCloneItem;
50225697 private MenuItem pasteExpandItem;
....@@ -5055,6 +5730,10 @@
50555730 private MenuItem showleavesItem;
50565731 private MenuItem markleavesItem;
50575732 private MenuItem unmarkleavesItem;
5733
+ private MenuItem rewindleavesItem;
5734
+ private MenuItem unrewindleavesItem;
5735
+ private MenuItem randomleavesItem;
5736
+ private MenuItem unrandomleavesItem;
50585737
50595738 private MenuItem flipVItem;
50605739 private MenuItem unflipVItem;
....@@ -5066,15 +5745,17 @@
50665745 private MenuItem panoTexturesItem;
50675746
50685747 private MenuItem resetCentroidItem;
5069
- private MenuItem transformgeometryItem;
5748
+ private MenuItem resetCentroidXZItem;
50705749 private MenuItem resetTransformItem;
5750
+ private MenuItem transformGeometryItem;
5751
+ private MenuItem transformChildrenItem;
50715752 private MenuItem hideItem;
50725753 private MenuItem grabItem;
50735754 private MenuItem backItem;
50745755 private MenuItem frontItem;
50755756 private MenuItem cameraItem;
50765757 private MenuItem compositeItem;
5077
- private MenuItem randomItem;
5758
+ private MenuItem switchItem;
50785759 private MenuItem physicsItem;
50795760 private MenuItem frameselectorItem;
50805761 private MenuItem scriptNodeItem;
....@@ -5114,7 +5795,7 @@
51145795 private MenuItem blobItem;
51155796 private MenuItem latheItem;
51165797 private MenuItem bezierItem;
5117
- private MenuItem checkerItem;
5798
+ private MenuItem overlayItem;
51185799 private MenuItem meshItem;
51195800 // private MenuItem meshGroupItem;
51205801 private MenuItem springItem;
....@@ -5136,11 +5817,6 @@
51365817 private MenuItem doubleItem;
51375818 private MenuItem tripleItem;
51385819
5139
- private MenuItem importGFDItem;
5140
- private MenuItem importVRMLX3DItem;
5141
- private MenuItem import3DSItem;
5142
- private MenuItem importOBJItem;
5143
-
51445820 private MenuItem computeAOItem;
51455821 private MenuItem recompileItem;
51465822 private MenuItem editScriptItem;
....@@ -5150,4 +5826,8 @@
51505826 private MenuItem analyzeItem;
51515827 private MenuItem dumpItem;
51525828 //boolean freezemodel = false;
5829
+
5830
+ Menu cameraMenu;
5831
+ MenuItem editCameraItem;
5832
+ MenuItem restoreCameraItem;
51535833 }