Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
GroupEditor.java
....@@ -74,7 +74,7 @@
7474 this.copy = this.group = copy;
7575 //selectees = this.group.selectees;
7676
77
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7878 SetupUI2(objEditor);
7979 objEditor.SetupUI(true);
8080 SetupViews(objEditor);
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.SAVEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.SAVEONMAKE;
90
+ Globals.SAVEONMAKE = false;
8791 // Object3D keep = GrafreeD.clipboard;
8892 //Object3D obj;
8993 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +98,19 @@
9498
9599 makeSomething(clone, i==group.selection.size()-1);
96100 }
101
+ Globals.SAVEONMAKE = keep;
97102 }
98103
99104 void CloneClipboard(boolean supports)
100105 {
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));
106
+ assert(Grafreed.clipboard.parent == null);
107
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
108
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
109
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
110
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106111 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
112
+ makeSomething(CloneObject(Grafreed.clipboard, false));
113
+ Grafreed.clipboard.get(0).parent = keepparent;
109114 }
110115
111116 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +124,7 @@
119124 // obj.support = null;
120125 if (!supports)
121126 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
127
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123128 obj.parent = parent;
124129 // obj.support = support;
125130 // clone.support = support; // aout 2013
....@@ -148,30 +153,29 @@
148153
149154 //JTextField nameField;
150155
151
- void SetupMenu2(ObjEditor oe)
156
+ void SetupMenu2(GroupEditor oe)
152157 {
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);
158
+ oe.jTree = new cTree();
159
+
164160 Menu menu;
165161 oe.menuBar.add(menu = new Menu("Edit"));
166162 //editItem = menu.add(new MenuItem("Edit"));
167163 //editItem.addActionListener(this);
168
- duplicateItem = menu.add(new MenuItem("Duplicate"));
164
+
165
+// undoItem = menu.add(new MenuItem("Undo"));
166
+// undoItem.addActionListener(this);
167
+// redoItem = menu.add(new MenuItem("Redo"));
168
+// redoItem.addActionListener(this);
169
+// menu.add("-");
170
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
169171 duplicateItem.addActionListener(this);
170
- menu.add("-");
171172 cloneItem = menu.add(new MenuItem("Clone"));
172173 cloneItem.addActionListener(this);
174
+ if (Globals.ADVANCED)
175
+ {
173176 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
174177 cloneSupportItem.addActionListener(this);
178
+ }
175179 menu.add("-");
176180 cutItem = menu.add(new MenuItem("Cut"));
177181 cutItem.addActionListener(this);
....@@ -179,27 +183,123 @@
179183 copyItem.addActionListener(this);
180184 pasteItem = menu.add(new MenuItem("Paste"));
181185 pasteItem.addActionListener(this);
186
+
187
+ menu.add("-");
188
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
189
+ pasteIntoItem.addActionListener(this);
182190 pasteLinkItem = menu.add(new MenuItem("Paste link"));
183191 pasteLinkItem.addActionListener(this);
184192 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
185193 pasteCloneItem.addActionListener(this);
186194 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
187195 // pasteExpandItem.addActionListener(this);
196
+ menu.add("-");
188197 clearItem = menu.add(new MenuItem("Clear"));
189198 clearItem.addActionListener(this);
199
+
200
+ if (Globals.ADVANCED)
201
+ {
202
+ // Deletes the cameras...
190203 clearAllItem = menu.add(new MenuItem("Clear All"));
191204 clearAllItem.addActionListener(this);
205
+ }
206
+
207
+ menuBar.add(cameraMenu = new Menu("View"));
208
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
209
+ //zBufferItem.addActionListener(this);
210
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
211
+ //normalLensItem.addActionListener(this);
212
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
213
+ restoreCameraItem.addActionListener(this);
214
+
215
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
216
+// toggleFullScreenItem.addItemListener(this);
217
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
218
+// cameraMenu.add("-");
219
+//
220
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
221
+// toggleTextureItem.addItemListener(this);
222
+// toggleTextureItem.setState(CameraPane.textureon);
223
+//
224
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
225
+// toggleSwitchItem.addItemListener(this);
226
+// toggleSwitchItem.setState(CameraPane.SWITCH);
227
+
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
229
+ toggleHandleItem.addItemListener(this);
230
+ toggleHandleItem.setState(CameraPane.HANDLES);
231
+
232
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
233
+ togglePaintItem.addItemListener(this);
234
+ togglePaintItem.setState(CameraPane.PAINTMODE);
235
+
236
+ if (Globals.ADVANCED)
237
+ {
238
+ cameraMenu.add("-");
239
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
240
+ toggleLiveItem.addItemListener(this);
241
+ toggleLiveItem.setState(Globals.isLIVE());
192242
243
+ cameraMenu.add(stepItem = new MenuItem("Step"));
244
+ stepItem.addActionListener(this);
245
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
246
+ // toggleDLItem.addItemListener(this);
247
+ // toggleDLItem.setState(false);
248
+
249
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
250
+ toggleRenderItem.addItemListener(this);
251
+ toggleRenderItem.setState(!CameraPane.frozen);
252
+
253
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
254
+ toggleDebugItem.addItemListener(this);
255
+ toggleDebugItem.setState(Globals.DEBUG);
256
+
257
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
258
+ toggleFrustumItem.addItemListener(this);
259
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
260
+
261
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
262
+ toggleFootContactItem.addItemListener(this);
263
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
264
+
265
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
266
+ toggleTimelineItem.addItemListener(this);
267
+ }
268
+
269
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
270
+// toggleRootItem.addItemListener(this);
271
+// toggleRootItem.setState(false);
272
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
273
+// animationItem.addItemListener(this);
274
+// animationItem.setState(CameraPane.ANIMATION);
275
+ cameraMenu.add("-");
276
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
277
+ editCameraItem.addActionListener(this);
278
+
279
+ if (Globals.ADVANCED)
280
+ {
281
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
282
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
283
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
284
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
285
+ oe.cameraMenu.add("-");
286
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
287
+ openWindowItem.addActionListener(this);
288
+ editLeafItem.addActionListener(this);
289
+ lookAtItem.addActionListener(this);
290
+ //lookFromItem.addActinoListener(this);
291
+ //switchViewItem.addActionListener(this);
292
+ }
293
+
193294 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);
295
+ if (Globals.ADVANCED)
296
+ {
198297 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
199298 revertMeshItem.addActionListener(this);
200299 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
201300 resetreferencesItem.addActionListener(this);
202301 menu.add("-");
302
+ }
203303 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
204304 overwriteGeoItem.addActionListener(this);
205305 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -211,79 +311,104 @@
211311 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
212312 overwriteUVItem.addActionListener(this);
213313 menu.add("-");
314
+ if (Globals.ADVANCED)
315
+ {
214316 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
215317 generateMeshItem.addActionListener(this);
216318 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
217319 poseMeshItem.addActionListener(this);
218320 menu.add("-");
321
+ }
219322 resetsupportItem = menu.add(new MenuItem("Reset support"));
220323 resetsupportItem.addActionListener(this);
221324 linkverticesItem = menu.add(new MenuItem("Link to Support"));
222325 linkverticesItem.addActionListener(this);
223326 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224327 relinkverticesItem.addActionListener(this);
328
+
329
+ if (Globals.ADVANCED)
330
+ {
225331 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
226332 setMasterItem.addActionListener(this);
333
+ }
227334
228335 oe.menuBar.add(menu = new Menu("Group"));
229
- grabItem = menu.add(new MenuItem("Grab"));
230
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
231338 backItem = menu.add(new MenuItem("Back"));
232339 backItem.addActionListener(this);
233340 frontItem = menu.add(new MenuItem("Front"));
234341 frontItem.addActionListener(this);
235
- compositeItem = menu.add(new MenuItem("Composite"));
236
- compositeItem.addActionListener(this);
237
- hideItem = menu.add(new MenuItem("Hide"));
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
344
+
345
+ if (Globals.ADVANCED)
346
+ {
347
+ hideItem = menu.add(new MenuItem("Hidden Group"));
238348 hideItem.addActionListener(this);
349
+ }
239350 ungroupItem = menu.add(new MenuItem("Ungroup"));
240351 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);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
248359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
249360 switchGeoItem.addActionListener(this);
250361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
251362 switchTransfoItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
363
+ morphItem = menu.add(new MenuItem("Morph Group"));
253364 morphItem.addActionListener(this);
365
+
366
+ menu.add("-");
367
+ physicsItem = menu.add(new MenuItem("Physics"));
368
+ physicsItem.addActionListener(this);
369
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
370
+ frameselectorItem.addActionListener(this);
254371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
255372 scriptNodeItem.addActionListener(this);
256
- cameraItem = menu.add(new MenuItem("Camera"));
257
- cameraItem.addActionListener(this);
373
+ }
258374
259375 oe.menuBar.add(menu = new Menu("Object"));
260
- textureItem = menu.add(new MenuItem("Texture"));
261
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
262378 billboardItem = menu.add(new MenuItem("Billboard"));
263379 billboardItem.addActionListener(this);
264380 csgItem = menu.add(new MenuItem("CSG"));
265381 csgItem.addActionListener(this);
266
- shadowXItem = menu.add(new MenuItem("Shadow X"));
382
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
267383 shadowXItem.addActionListener(this);
268
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
384
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
269385 shadowYItem.addActionListener(this);
270
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
386
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
271387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
391
+ if (Globals.ADVANCED)
392
+ {
393
+ menu.add("-");
272394 linkerItem = menu.add(new MenuItem("Linker"));
273395 linkerItem.addActionListener(this);
274396 templateItem = menu.add(new MenuItem("Template"));
275397 templateItem.addActionListener(this);
276
- attributeItem = menu.add(new MenuItem("Attribute"));
277
- attributeItem.addActionListener(this);
278398 pointflowItem = menu.add(new MenuItem("Point Flow"));
279399 pointflowItem.addActionListener(this);
400
+ }
280401 menu.add("-");
281402 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
282403 resetTransformItem.addActionListener(this);
283404 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
284405 resetCentroidItem.addActionListener(this);
285
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
- transformgeometryItem.addActionListener(this);
406
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
407
+ resetCentroidXZItem.addActionListener(this);
408
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
409
+ transformGeometryItem.addActionListener(this);
410
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
411
+ transformChildrenItem.addActionListener(this);
287412
288413 oe.menuBar.add(menu = new Menu("Geometry"));
289414 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -294,8 +419,11 @@
294419 genNormalsCADItem.addActionListener(this);
295420 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296421 genNormalsMESHItem.addActionListener(this);
422
+ if (Globals.ADVANCED)
423
+ {
297424 genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
298425 genNormalsMINEItem.addActionListener(this);
426
+ }
299427 stripifyItem = menu.add(new MenuItem("Stripify"));
300428 stripifyItem.addActionListener(this);
301429 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -317,23 +445,34 @@
317445 reduce34MeshItem.addActionListener(this);
318446 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
319447 increaseMeshItem.addActionListener(this);
320
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
321
- smoothMeshItem.addActionListener(this);
322448 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
323449 clipMeshItem.addActionListener(this);
450
+
451
+ if (Globals.ADVANCED)
452
+ {
453
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
454
+ smoothMeshItem.addActionListener(this);
455
+ }
324456
325457 oe.menuBar.add(menu = new Menu("Attributes"));
326458 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327459 clearMaterialsItem.addActionListener(this);
460
+ resetAllItem = menu.add(new MenuItem("Reset All"));
461
+ resetAllItem.addActionListener(this);
462
+ stepAllItem = menu.add(new MenuItem("Step All"));
463
+ stepAllItem.addActionListener(this);
328464 menu.add("-");
329465 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
330466 liveleavesItem.addActionListener(this);
331467 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
332468 unliveleavesItem.addActionListener(this);
469
+ if (Globals.ADVANCED)
470
+ {
333471 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
334472 supportleavesItem.addActionListener(this);
335473 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
336474 unsupportleavesItem.addActionListener(this);
475
+ }
337476 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
338477 hideleavesItem.addActionListener(this);
339478 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -342,6 +481,14 @@
342481 markleavesItem.addActionListener(this);
343482 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
344483 unmarkleavesItem.addActionListener(this);
484
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
485
+ rewindleavesItem.addActionListener(this);
486
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
487
+ unrewindleavesItem.addActionListener(this);
488
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
489
+ randomleavesItem.addActionListener(this);
490
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
491
+ unrandomleavesItem.addActionListener(this);
345492 menu.add("-");
346493 flipVItem = menu.add(new MenuItem("Flip V"));
347494 flipVItem.addActionListener(this);
....@@ -377,35 +524,40 @@
377524 sortbynameItem = menu.add(new MenuItem("Sort by name"));
378525 sortbynameItem.addActionListener(this);
379526 menu.add("-");
527
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
528
+ shareGeometriesItem.addActionListener(this);
529
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
530
+ mergeGeometriesItem.addActionListener(this);
531
+ if (Globals.ADVANCED)
532
+ {
533
+ // Pretty much the same as duplicate and clone.
380534 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381535 extractGeometriesItem.addActionListener(this);
382536 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383537 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);
538
+ }
388539
389540 oe.menuBar.add(menu = new Menu("Insert"));
390541 buildCreateMenu(menu);
391542
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
-
403543 oe.menuBar.add(menu = new Menu("Tools"));
404544 buildToolsMenu(menu);
405545 }
406546
407547 void SetupUI2(ObjEditor oe)
408548 {
549
+ // June 2019
550
+ if (oe == null)
551
+ {
552
+ //super.SetupUI2(this);
553
+ //return;
554
+ }
555
+
556
+ if (copy != group)
557
+ {
558
+ //super.SetupUI2(this);
559
+ }
560
+
409561 //new Exception().printStackTrace();
410562
411563 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -434,98 +586,217 @@
434586 oe.radioPanel.add(dummyButton);
435587 oe.buttonGroup.add(dummyButton);
436588 */
589
+ cGridBag copyOptionsPanel = new cGridBag();
590
+
591
+ copyOptionsPanel.preferredHeight = 1;
592
+
437593 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
438594
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);
595
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ //minButton.setToolTipText("Minimize window");
597
+ //minButton.addActionListener(this);
598
+
599
+ if (Globals.ADVANCED)
600
+ {
601
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ maxButton.setToolTipText("Maximize window");
603
+ maxButton.addActionListener(this);
604
+ }
605
+
606
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
607
+ fullButton.setToolTipText("Full-screen window");
608
+ fullButton.addActionListener(this);
609
+
610
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
448611 screenfitButton.setToolTipText("Screen fit");
449612 screenfitButton.addActionListener(this);
450613
614
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ restoreCameraButton.setToolTipText("Restore viewpoint");
616
+ restoreCameraButton.addActionListener(this);
617
+
618
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ undoButton.setToolTipText("Undo changes");
620
+ undoButton.addActionListener(this);
621
+ undoButton.setEnabled(false);
622
+
623
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ redoButton.setToolTipText("Redo changes");
625
+ redoButton.addActionListener(this);
626
+ redoButton.setEnabled(false);
627
+
628
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ saveButton.setToolTipText("Save changes");
630
+ saveButton.addActionListener(this);
631
+
632
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
633
+ liveCB.setToolTipText("Enable animation");
634
+ liveCB.addItemListener(this);
635
+
636
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637
+ oneStepButton.setToolTipText("Animate one step forward");
638
+ oneStepButton.addActionListener(this);
639
+
640
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
641
+ fastCB.setToolTipText("Fast mode");
642
+ fastCB.addItemListener(this);
643
+
644
+ //oe.toolboxPanel.Return();
645
+
646
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
647
+// trackCB.setToolTipText("Enable tracking");
648
+// trackCB.addItemListener(this);
649
+
451650 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
452651 // 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;
458652
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);
653
+ if (Globals.ADVANCED)
654
+ {
655
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ snapobjectButton.addActionListener(this);
657
+ snapobjectButton.setToolTipText("Snap Object");
658
+ }
659
+
660
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
467661
468
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
469
-
470
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
471663 twoButton.setToolTipText("Show center view only");
472664 twoButton.addActionListener(this);
473
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
665
+ this.fullscreenLayout = twoButton;
666
+
667
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
474668 fourButton.addActionListener(this);
475669 fourButton.setToolTipText("Show left panel only");
476
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
670
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
477671 sixButton.setToolTipText("2-column layout left");
478672 sixButton.addActionListener(this);
479
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
673
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
480674 threeButton.setToolTipText("2-column layout right");
481675 threeButton.addActionListener(this);
482
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
483677 sevenButton.setToolTipText("3-column layout");
484678 sevenButton.addActionListener(this);
485679 //
486680
487
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
488
- rootButton.setToolTipText("Edit object in new tab");
681
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ rootButton.setToolTipText("Edit selection in new tab");
489683 rootButton.addActionListener(this);
490
- oe.aConstraints.gridx += 1;
491
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
684
+
685
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492686 closeButton.setToolTipText("Close tab");
493687 closeButton.addActionListener(this);
494688 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
495689 //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;
504690
505
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
691
+ // INSERT
692
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ gridButton.setToolTipText("Create grid");
694
+ gridButton.addActionListener(this);
695
+
696
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697
+ boxButton.setToolTipText("Create box");
698
+ boxButton.addActionListener(this);
699
+
700
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+ sphereButton.setToolTipText("Create sphere");
702
+ sphereButton.addActionListener(this);
703
+
704
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705
+ coneButton.setToolTipText("Create cone");
706
+ coneButton.addActionListener(this);
707
+
708
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ torusButton.setToolTipText("Create torus");
710
+ torusButton.addActionListener(this);
711
+
712
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ superButton.setToolTipText("Create superellipsoid");
714
+ superButton.addActionListener(this);
715
+
716
+ if (Globals.ADVANCED)
717
+ {
718
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ kleinButton.setToolTipText("Create Klein bottle");
720
+ kleinButton.addActionListener(this);
721
+ }
722
+
723
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ particlesButton.setToolTipText("Create particle system");
725
+ particlesButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.Return();
728
+
729
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ groupButton.setToolTipText("Create group");
731
+ groupButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ compositeButton.setToolTipText("Create composite");
735
+ compositeButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ switchButton.setToolTipText("Create item switcher");
739
+ switchButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ loopButton.setToolTipText("Create loop");
743
+ loopButton.addActionListener(this);
744
+
745
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ textureButton.setToolTipText("Create texture");
747
+ textureButton.addActionListener(this);
748
+
749
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ overlayButton.setToolTipText("Create overlay");
751
+ overlayButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
+ lightButton.setToolTipText("Create light");
755
+ lightButton.addActionListener(this);
756
+
757
+ for (int i=6; --i>=0;)
758
+ {
759
+ oe.toolboxPanel.Return();
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ oe.toolboxPanel.add(new cGridBag());
762
+ oe.toolboxPanel.add(new cGridBag());
763
+ oe.toolboxPanel.add(new cGridBag());
764
+ oe.toolboxPanel.add(new cGridBag());
765
+ oe.toolboxPanel.add(new cGridBag());
766
+ oe.toolboxPanel.add(new cGridBag());
767
+ }
768
+
769
+ // EDIT panel
770
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ editButton.setToolTipText("Pin selection controls");
772
+ editButton.addActionListener(this);
773
+
774
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ uneditButton.setToolTipText("Remove selection controls");
506776 uneditButton.addActionListener(this);
507777
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);
778
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
779
+ allParamsButton.setToolTipText("Show all controle");
520780 allParamsButton.addActionListener(this);
521781
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);
782
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
783
+ clearPanelButton.setToolTipText("Clear edit panel");
784
+ clearPanelButton.addActionListener(this);
785
+
786
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
787
+ unselectButton.setToolTipText("Unselect");
527788 unselectButton.addActionListener(this);
528789
790
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
791
+ flashSelectionButton.setToolTipText("Highlight selection");
792
+ flashSelectionButton.addActionListener(this);
793
+
794
+ editCommandsPanel.preferredHeight = 1;
795
+
796
+ SetPinStates(false);
797
+// oe.treePanel.add(commandsPanel);
798
+// oe.treePanel.Return();
799
+
529800 // oe.aConstraints.gridx += 1;
530801 // oe.aConstraints.weighty = 0;
531802 // oe.aConstraints.gridwidth = 1;
....@@ -537,40 +808,22 @@
537808 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
538809 // gcButton.addActionListener(this);
539810
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;
811
+ cGridBag jSPPanel = new cGridBag();
812
+
813
+ JScrollPane jSP;
551814 //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);
815
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
553816 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;
573817
818
+ oe.treePanel.add(jSPPanel);
819
+ oe.treePanel.Return();
820
+
821
+ oe.treePanel.add(copyOptionsPanel);
822
+ oe.treePanel.Return();
823
+
824
+// mainPanel.setDividerLocation(0.5); //1.0);
825
+// mainPanel.setResizeWeight(0.5);
826
+
574827 //jList.addListSelectionListener(this);
575828 oe.jTree.addTreeSelectionListener(this);
576829 //jTree.setRootVisible(false);
....@@ -595,47 +848,61 @@
595848
596849 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
597850 {
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);
851
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
852
+ colorCB.setToolTipText("Copy color when dropped");
853
+ colorCB.addItemListener(this);
607854
608
- // constraints.gridy += 1;
855
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
856
+ materialCB.setToolTipText("Copy material when dropped");
857
+ materialCB.addItemListener(this);
858
+
859
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
860
+ textureCB.setToolTipText("Copy texture when dropped");
861
+ textureCB.addItemListener(this);
862
+
863
+ panel.Return();
864
+
865
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
866
+ boxCB.setToolTipText("Display bounding boxes");
867
+ boxCB.addItemListener(this);
868
+
869
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
870
+ zoomBoxCB.setToolTipText("Display only for wheel");
871
+ zoomBoxCB.addItemListener(this);
872
+
873
+ if (true) // Globals.ADVANCED)
874
+ {
875
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
876
+// supportCB.setToolTipText("Enable rigging");
877
+// supportCB.addItemListener(this);
878
+
879
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
880
+ freezeCB.setToolTipText("Fast moving camera");
881
+ freezeCB.addItemListener(this);
882
+
609883 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
610884 // localCB.addItemListener(this);
611885
612
- //constraints.gridy += 1;
886
+ panel.Return();
887
+
613888 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
614889 crowdCB.setToolTipText("Used for crowds");
615890 crowdCB.addItemListener(this);
616891
617
- //constraints.gridy += 1;
618892 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
619893 smoothCB.setToolTipText("Snapping delay");
620894 smoothCB.addItemListener(this);
621895
622
- //constraints.gridy += 1;
623896 panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
624897 slowCB.setToolTipText("Smooth interpolation");
625898 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
-
899
+
635900 // constraints.gridy += 1;
636901 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
637902 // speakerMocapCB.addItemListener(this);
638903
904
+ panel.Return();
905
+
639906 if (false)
640907 {
641908 // handled in scripts
....@@ -650,26 +917,72 @@
650917 //constraints.gridy += 1;
651918 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
652919 smoothfocusCB.addItemListener(this);
920
+ panel.Return();
653921 }
654922
655923 //constraints.gridx += 1;
656924 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
657925 // debugCB.addItemListener(this);
658926
659
- //constraints.gridy += 1;
927
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
928
+ trackCB.setToolTipText("Enable tracking target");
929
+ trackCB.addItemListener(this);
930
+
660931 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
932
+ oeilCB.setToolTipText("Move camera when tracking");
661933 oeilCB.addItemListener(this);
662934
663
- //constraints.gridy += 1;
935
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
936
+ shadowCB.setToolTipText("When live compute shadows");
937
+ shadowCB.addItemListener(this);
938
+
939
+ panel.Return();
940
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
941
+ toggleTextureCB.setToolTipText("Load textures");
942
+ toggleTextureCB.addItemListener(this);
943
+
944
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
945
+ toggleSwitchCB.setToolTipText("Choose a single item");
946
+ toggleSwitchCB.addItemListener(this);
947
+
948
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
949
+ autosaveCB.setToolTipText("On structure change");
950
+ autosaveCB.addItemListener(this);
951
+
952
+ panel.Return();
953
+ if (Globals.ADVANCED)
954
+ {
664955 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
665956 lookAtCB.setToolTipText("Look-at target");
666957 lookAtCB.addItemListener(this);
958
+ }
959
+
960
+ }
961
+
962
+ cGridBag fill = new cGridBag();
963
+ fill.preferredHeight = 200;
964
+ cGridBag fill2 = new cGridBag();
965
+ fill2.preferredHeight = 200;
966
+ cGridBag fill3 = new cGridBag();
967
+ fill3.preferredHeight = 200;
968
+
969
+ panel.add(fill);
970
+ panel.add(fill2);
971
+ panel.add(fill3);
667972
668973 }
669974
670975 void EditObject(Object3D obj)
671976 {
672977 cRadio radioButton = new cRadio(obj.name);
978
+
979
+ // June 2019. Patch to avoid bug with transparency.
980
+ radioButton.hadMaterial = obj.material != null;
981
+ if (!radioButton.hadMaterial)
982
+ {
983
+ obj.material = new cMaterial();
984
+ }
985
+
673986 radioButton.SetObject(obj);
674987 radioButton.layout = sevenButton;
675988 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -678,8 +991,11 @@
678991 buttonGroup.add(radioButton);
679992 radioButton.doClick();
680993 }
994
+
681995 void SetupViews(ObjEditor oe)
682996 {
997
+ theFrame = this;
998
+
683999 oe.SetupViews();
6841000
6851001 System.out.println("SetupViews");
....@@ -688,23 +1004,28 @@
6881004 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6891005 }
6901006
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;
1007
+ cToggleButton liveCB;
1008
+ cCheckBox supportCB;
1009
+ cCheckBox localCB;
1010
+ cCheckBox crowdCB;
1011
+ cCheckBox smoothCB;
1012
+ cToggleButton fastCB;
1013
+ cCheckBox slowCB;
1014
+ cCheckBox boxCB;
1015
+ cCheckBox zoomBoxCB;
1016
+ cCheckBox freezeCB;
1017
+ //cToggleButton trackCB;
1018
+ cCheckBox trackCB;
1019
+ cCheckBox smoothfocusCB;
7021020 // JCheckBox speakerMocapCB;
703
- JCheckBox speakerCameraCB;
704
- JCheckBox speakerFocusCB;
705
- JCheckBox debugCB;
706
- JCheckBox oeilCB;
707
- JCheckBox lookAtCB;
1021
+ cCheckBox speakerCameraCB;
1022
+ cCheckBox speakerFocusCB;
1023
+ cCheckBox debugCB;
1024
+
1025
+ cCheckBox oeilCB;
1026
+ cCheckBox shadowCB;
1027
+ cCheckBox autosaveCB;
1028
+ cCheckBox lookAtCB;
7081029
7091030 // static int COLOR = 1;
7101031 // static int MATERIAL = 2;
....@@ -712,9 +1033,9 @@
7121033
7131034 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7141035
715
- JCheckBox colorCB;
716
- JCheckBox materialCB;
717
- JCheckBox textureCB;
1036
+ cCheckBox colorCB;
1037
+ cCheckBox materialCB;
1038
+ cCheckBox textureCB;
7181039
7191040 public void itemStateChanged(ItemEvent e)
7201041 {
....@@ -742,6 +1063,7 @@
7421063 } else if(e.getSource() == liveCB)
7431064 {
7441065 cameraView.ToggleLive();
1066
+ refreshContents(false);
7451067 }
7461068 else if(e.getSource() == supportCB)
7471069 {
....@@ -806,6 +1128,18 @@
8061128 {
8071129 cameraView.ToggleOeil();
8081130 }
1131
+ else if(e.getSource() == shadowCB)
1132
+ {
1133
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1134
+ }
1135
+ else if(e.getSource() == freezeCB)
1136
+ {
1137
+ Globals.FREEZEONMOVE ^= true;
1138
+ }
1139
+ else if(e.getSource() == autosaveCB)
1140
+ {
1141
+ Globals.SAVEONMAKE ^= true;
1142
+ }
8091143 else if(e.getSource() == lookAtCB)
8101144 {
8111145 cameraView.ToggleLookAt();
....@@ -822,7 +1156,8 @@
8221156
8231157 /**/
8241158 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
825
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1159
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1160
+ TreePath path = objEditor.jTree.getSelectionPath();
8261161 if ((path == null) || (path.getPathCount() <= 1)) {
8271162 // We can't move the root node or an empty selection
8281163 return;
....@@ -885,8 +1220,6 @@
8851220 }
8861221 }
8871222
888
- String string = (String) object;
889
-
8901223 System.out.println("Transfer = " + object + "; drop : " + target);
8911224 // if( object instanceof java.io.File[])
8921225 // {
....@@ -894,7 +1227,11 @@
8941227 // objEditor.DropFile((java.io.File[]) object, true);
8951228 // return;
8961229 // }
897
- if (string.charAt(0) == '/')
1230
+
1231
+ String string = object.toString();
1232
+
1233
+ // File path for Mac and Windows
1234
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8981235 {
8991236 // file(s)
9001237 String[] names = string.split("\n");
....@@ -921,7 +1258,7 @@
9211258
9221259 flashIt = false;
9231260 CameraPane pane = (CameraPane) target;
924
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1261
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9251262 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9261263
9271264 if (group.selection.size() == 1)
....@@ -937,23 +1274,33 @@
9371274
9381275 assert target == objEditor.jTree;
9391276 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1277
+ Object3D destinationLeaf;
9401278 try {
941
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1279
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9421280 } catch (Exception e) {
9431281 System.out.println("destinationPath : " + destinationPath);
9441282 return;
9451283 }
9461284
947
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1285
+ for (int i=group.selection.size(); --i>=0;)
9481286 {
1287
+ Object3D child = (Object3D)group.selection.elementAt(i);
1288
+
1289
+ // Cannot move into itself
1290
+ if (child == destinationLeaf)
1291
+ return;
1292
+ }
1293
+
1294
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1295
+// {
9491296 loadClipboard(true);
9501297 objEditor.jTree.setSelectionPath(destinationPath);
951
- pasteInto(false);
952
- } else {
953
- loadClipboard(false);
954
- objEditor.jTree.setSelectionPath(destinationPath);
955
- pasteInto(false); // true); // ???
956
- }
1298
+ pasteInto(false, false);
1299
+// } else {
1300
+// loadClipboard(false);
1301
+// objEditor.jTree.setSelectionPath(destinationPath);
1302
+// pasteInto(false, false); // true); // ???
1303
+// }
9571304 }
9581305 public void dropActionChanged(DropTargetDragEvent dtde)
9591306 // Called if the user has modified the current drop gesture
....@@ -1058,85 +1405,107 @@
10581405 {
10591406 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10601407 //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);
1408
+// gridItem = menu.add(new MenuItem("Grid"));
1409
+// gridItem.addActionListener(this);
1410
+// rectoidItem = menu.add(new MenuItem("Box"));
1411
+// rectoidItem.addActionListener(this);
1412
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1413
+// ellipsoidItem.addActionListener(this);
1414
+// coneItem = menu.add(new MenuItem("Cone"));
1415
+// coneItem.addActionListener(this);
1416
+// torusItem = menu.add(new MenuItem("Torus"));
1417
+// torusItem.addActionListener(this);
1418
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1419
+// superItem.addActionListener(this);
1420
+
1421
+ cameraItem = menu.add(new MenuItem("Camera"));
1422
+ cameraItem.addActionListener(this);
1423
+
1424
+ if (!Globals.ADVANCED)
1425
+ {
10731426 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10741427 kleinItem.addActionListener(this);
1075
- particleItem = menu.add(new MenuItem("Particle system"));
1076
- particleItem.addActionListener(this);
1428
+ }
1429
+
1430
+// particleItem = menu.add(new MenuItem("Particle system"));
1431
+// particleItem.addActionListener(this);
1432
+ if (Globals.ADVANCED)
1433
+ {
10771434 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10781435 ragdollItem.addActionListener(this);
10791436 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10801437 ragdoll2Item.addActionListener(this);
1438
+ }
10811439 menu.add("-");
1082
- meshItem = menu.add(new MenuItem("Mesh"));
1440
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10831441 meshItem.addActionListener(this);
10841442 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10851443 // meshGroupItem.addActionListener(this);
1444
+ if (Globals.ADVANCED)
1445
+ {
10861446 springItem = menu.add(new MenuItem("Spring"));
10871447 springItem.addActionListener(this);
10881448 flagItem = menu.add(new MenuItem("Flag"));
10891449 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);
10941450 blobItem = menu.add(new MenuItem("Blob"));
10951451 blobItem.addActionListener(this);
10961452 latheItem = menu.add(new MenuItem("Lathe"));
10971453 latheItem.addActionListener(this);
1098
- lightItem = menu.add(new MenuItem("Light"));
1099
- lightItem.addActionListener(this);
1454
+ }
1455
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1456
+ bezierItem.addActionListener(this);
1457
+// overlayItem = menu.add(new MenuItem("Overlay"));
1458
+// overlayItem.addActionListener(this);
1459
+// lightItem = menu.add(new MenuItem("Light"));
1460
+// lightItem.addActionListener(this);
11001461 menu.add("-");
11011462 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11021463 //superLoopItem.addActionListener(this);
1103
- loopItem = menu.add(new MenuItem("Loop"));
1104
- loopItem.addActionListener(this);
1464
+// loopItem = menu.add(new MenuItem("Loop"));
1465
+// loopItem.addActionListener(this);
11051466 doubleItem = menu.add(new MenuItem("Fork"));
11061467 doubleItem.addActionListener(this);
1468
+ if (Globals.ADVANCED)
1469
+ {
11071470 tripleItem = menu.add(new MenuItem("Trident"));
11081471 tripleItem.addActionListener(this);
1472
+ }
11091473 }
11101474
11111475 void buildToolsMenu(Menu menu)
11121476 {
11131477 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11141478 animationItem.addItemListener(this);
1115
- animationItem.setState(CameraPane.ANIMATION);
1479
+ animationItem.setState(Globals.ANIMATION);
1480
+
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
11161483
11171484 menu.add("-");
11181485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11191486 parseverticesItem.addActionListener(this);
11201487 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11211488 textureFieldItem.addActionListener(this);
1122
- alignItem = menu.add(new MenuItem("Align"));
1489
+ alignItem = menu.add(new MenuItem("Align Objects"));
11231490 alignItem.addActionListener(this);
1124
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1125
- mirrorItem.addActionListener(this);
11261491 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11271492 reduceMorphItem.addActionListener(this);
11281493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11291494 reduce34MorphItem.addActionListener(this);
1130
-
1131
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1132
- computeAOItem.addActionListener(this);
11331495 menu.add("-");
1134
-
11351496 menu.add(memoryItem = new MenuItem("Memory Usage"));
11361497 memoryItem.addActionListener(this);
1498
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1499
+ computeAOItem.addActionListener(this);
1500
+
1501
+ if (Globals.ADVANCED)
1502
+ {
1503
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1504
+ mirrorItem.addActionListener(this);
1505
+ menu.add("-");
11371506 menu.add(analyzeItem = new MenuItem("Analyze"));
11381507 analyzeItem.addActionListener(this);
1139
- menu.add(dumpItem = new MenuItem("Dump"));
1508
+ menu.add(dumpItem = new MenuItem("Print"));
11401509 dumpItem.addActionListener(this);
11411510 // menu.add(pathItem = new MenuItem("From-to path"));
11421511 // pathItem.addActionListener(this);
....@@ -1154,6 +1523,7 @@
11541523 menu.add("-");
11551524 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11561525 editScriptItem.addActionListener(this);
1526
+ }
11571527 }
11581528
11591529 void ScreenFit()
....@@ -1276,9 +1646,24 @@
12761646 shadow.material = new cMaterial(obj.material);
12771647 shadow.material.diffuse = 0.0001f;
12781648 shadow.material.specular = 0.0001f;
1649
+ //shadow.projectedVertices[1].x = 300;
12791650
12801651 makeSomething(shadow);
12811652 }
1653
+
1654
+ private void ClearUnpinned()
1655
+ {
1656
+ //for (Object3D obj : listUI)
1657
+ for (int i=listUI.size(); --i>=0;)
1658
+ {
1659
+ Object3D obj = listUI.elementAt(i);
1660
+ if (!obj.pinned)
1661
+ {
1662
+ obj.CloseUI();
1663
+ listUI.remove(i);
1664
+ }
1665
+ }
1666
+ }
12821667
12831668 /**
12841669 * applyExample
....@@ -1482,9 +1867,9 @@
14821867
14831868 void Overwrite(int mask)
14841869 {
1485
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1870
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14861871 {
1487
- Object3D content = GrafreeD.clipboard.get(0);
1872
+ Object3D content = Grafreed.clipboard.get(0);
14881873
14891874 if (content instanceof cGroup && ((cGroup)content).transientlink )
14901875 content = ((cGroup)content).get(0);
....@@ -1523,7 +1908,7 @@
15231908 {
15241909 ScreenFit();
15251910 } else
1526
- if (source == switchItem)
1911
+ if (source == switchViewItem)
15271912 {
15281913 cVector v1 = new cVector();
15291914 cVector v2 = new cVector();
....@@ -1532,11 +1917,11 @@
15321917 objEditor.cameraView.renderCamera.setAim(v2, v1);
15331918 objEditor.cameraView.repaint();
15341919 } else
1535
- if (source == rectoidItem)
1920
+ if (source == rectoidItem || source == boxButton)
15361921 {
15371922 makeSomething(new Box());
15381923 } else
1539
- if (source == particleItem)
1924
+ if (source == particleItem || source == particlesButton)
15401925 {
15411926 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15421927 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1615,27 +2000,27 @@
16152000
16162001 makeSomething(obj);
16172002 } else
1618
- if (source == gridItem)
2003
+ if (source == gridItem || source == gridButton)
16192004 {
16202005 makeSomething(new Grid());
16212006 } else
1622
- if (source == ellipsoidItem)
2007
+ if (source == ellipsoidItem || source == sphereButton)
16232008 {
16242009 makeSomething(new Sphere());
16252010 } else
1626
- if (source == coneItem)
2011
+ if (source == coneItem || source == coneButton)
16272012 {
16282013 makeSomething(new Cone());
16292014 } else
1630
- if (source == torusItem)
2015
+ if (source == torusItem || source == torusButton)
16312016 {
16322017 makeSomething(new Torus());
16332018 } else
1634
- if (source == superItem)
2019
+ if (source == superItem || source == superButton)
16352020 {
16362021 makeSomething(new Superellipsoid());
16372022 } else
1638
- if (source == kleinItem)
2023
+ if (source == kleinItem || source == kleinButton)
16392024 {
16402025 makeSomething(new Klein());
16412026 } else
....@@ -1655,7 +2040,7 @@
16552040 {
16562041 makeSomething(new BezierSurface());
16572042 } else
1658
- if (source == checkerItem)
2043
+ if (source == overlayItem || source == overlayButton)
16592044 {
16602045 /*
16612046 Object3D obj = new BezierSurface(5,8);
....@@ -1703,7 +2088,7 @@
17032088 s.setup();
17042089 makeSomething(s);
17052090 } else
1706
- if (source == lightItem)
2091
+ if (source == lightItem || source == lightButton)
17072092 {
17082093 makeSomething(new Light());
17092094 } else
....@@ -1753,30 +2138,30 @@
17532138
17542139 group(g);
17552140 } else
1756
- if (source == loopItem)
2141
+ if (source == loopItem || source == loopButton)
17572142 {
17582143 Composite csg = new GroupLeaf();
17592144 csg.count = 5;
17602145 group(csg);
1761
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
17622147 csg.addChild(child);
17632148 child.addChild(csg);
17642149 } else
17652150 if (source == doubleItem)
17662151 {
1767
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
17682153 csg.count = 5;
17692154 group(csg);
1770
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
17712156 csg.addChild(child);
17722157 child.addChild(csg);
1773
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
17742159 csg.addChild(child);
17752160 child.addChild(csg);
17762161 } else
17772162 if (source == tripleItem)
17782163 {
1779
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
17802165 csg.count = 4;
17812166 group(csg);
17822167 Composite child = new cGroup();
....@@ -1788,23 +2173,6 @@
17882173 child = new cGroup();
17892174 csg.addChild(child);
17902175 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");
18082176 } else
18092177 if (source == computeAOItem)
18102178 {
....@@ -1824,7 +2192,7 @@
18242192 if (source == invariantsItem)
18252193 {
18262194 System.out.println("Invariants:");
1827
- GrafreeD.grafreeD.universe.invariants();
2195
+ Grafreed.grafreeD.universe.invariants();
18282196 } else
18292197 if (source == memoryItem)
18302198 {
....@@ -1843,19 +2211,47 @@
18432211 {
18442212 DumpObject();
18452213 } else
2214
+ if (source == minButton)
2215
+ {
2216
+ Minimize();
2217
+ } else
2218
+ if (source == maxButton)
2219
+ {
2220
+ Maximize();
2221
+ } else
2222
+ if (source == fullButton)
2223
+ {
2224
+ ToggleFullScreen();
2225
+ } else
2226
+ if (source == undoButton)
2227
+ {
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
2230
+ } else
2231
+ if (source == redoButton)
2232
+ {
2233
+ Redo();
2234
+ } else
2235
+ if (source == saveButton)
2236
+ {
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
2239
+ } else
2240
+ if (source == oneStepButton)
2241
+ {
2242
+ Globals.ONESTEP = true;
2243
+ cameraView.repaint();
2244
+ } else
18462245 if (source == screenfitButton)
18472246 {
1848
- //Reload(lastConverter, lastFilename, true);
18492247 ScreenFit();
18502248 } else
18512249 if (source == screenfitpointButton)
18522250 {
1853
- //Reload(lastConverter, lastFilename, true);
18542251 ScreenFitPoint();
18552252 } else
18562253 if (source == snapobjectButton)
18572254 {
1858
- //Reload(lastConverter, lastFilename, true);
18592255 SnapObject();
18602256 } else
18612257 // if (event.getSource() == recompileButton)
....@@ -1892,12 +2288,20 @@
18922288 {
18932289 loadClipboard(true);
18942290 } else
2291
+ if (source == undoItem)
2292
+ {
2293
+ Undo();
2294
+ } else
2295
+ if (source == redoItem)
2296
+ {
2297
+ Redo();
2298
+ } else
18952299 if (source == duplicateItem)
18962300 {
1897
- Object3D keep = GrafreeD.clipboard;
2301
+ Object3D keep = Grafreed.clipboard;
18982302 loadClipboard(false);
18992303 paste(false);
1900
- GrafreeD.clipboard = keep;
2304
+ Grafreed.clipboard = keep;
19012305 } else
19022306 if (source == cloneItem)
19032307 {
....@@ -1915,13 +2319,17 @@
19152319 {
19162320 paste(false);
19172321 } else
2322
+ if (source == pasteIntoItem)
2323
+ {
2324
+ pasteInto(true, false);
2325
+ } else
19182326 if (source == pasteLinkItem)
19192327 {
1920
- pasteInto(false);
2328
+ pasteInto(false, false);
19212329 } else
19222330 if (source == pasteCloneItem)
19232331 {
1924
- pasteInto(true);
2332
+ pasteInto(true, true);
19252333 } else
19262334 if (source == pasteExpandItem)
19272335 {
....@@ -2113,9 +2521,9 @@
21132521 // group.selection.get(0).setMasterThis(content); // should be identity
21142522 // refreshContents();
21152523 // }
2116
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2524
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21172525 {
2118
- Object3D content = GrafreeD.clipboard.get(0);
2526
+ Object3D content = Grafreed.clipboard.get(0);
21192527
21202528 if (content instanceof cGroup && ((cGroup)content).transientlink )
21212529 content = ((cGroup)content).get(0);
....@@ -2123,11 +2531,11 @@
21232531 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21242532 for (int i=0; i<group.selection.size(); i++)
21252533 {
2126
- boolean random = CameraPane.RANDOM;
2127
- CameraPane.RANDOM = false; // parse all random nodes
2534
+ boolean random = CameraPane.SWITCH;
2535
+ CameraPane.SWITCH = false; // parse all random nodes
21282536 group.selection.get(i).linkVerticesThis(content);
21292537 // group.selection.get(i).setMasterThis(content); // should be identity
2130
- CameraPane.RANDOM = random;
2538
+ CameraPane.SWITCH = random;
21312539 }
21322540 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21332541 refreshContents();
....@@ -2137,20 +2545,20 @@
21372545 {
21382546 for (int i=0; i<group.selection.size(); i++)
21392547 {
2140
- boolean random = CameraPane.RANDOM;
2141
- CameraPane.RANDOM = false; // parse all random nodes
2548
+ boolean random = CameraPane.SWITCH;
2549
+ CameraPane.SWITCH = false; // parse all random nodes
21422550 group.selection.get(i).linkVerticesThis(null);
2143
- CameraPane.RANDOM = random;
2551
+ CameraPane.SWITCH = random;
21442552 }
21452553
21462554 refreshContents();
21472555 } else
21482556 if (source == relinkverticesItem)
21492557 {
2150
- boolean random = CameraPane.RANDOM;
2151
- CameraPane.RANDOM = false; // parse all random nodes
2558
+ boolean random = CameraPane.SWITCH;
2559
+ CameraPane.SWITCH = false; // parse all random nodes
21522560 group.selection.RelinkToSupport();
2153
- CameraPane.RANDOM = random;
2561
+ CameraPane.SWITCH = random;
21542562
21552563 refreshContents();
21562564 } else
....@@ -2165,9 +2573,9 @@
21652573 } else
21662574 if (source == setMasterItem)
21672575 {
2168
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2576
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21692577 {
2170
- Object3D content = GrafreeD.clipboard.get(0);
2578
+ Object3D content = Grafreed.clipboard.get(0);
21712579
21722580 if (content instanceof cGroup && ((cGroup)content).transientlink )
21732581 content = ((cGroup)content).get(0);
....@@ -2180,9 +2588,9 @@
21802588 {
21812589 if (group.selection.size() == 1)
21822590 {
2183
- if (GrafreeD.clipboard.size() == 1)
2591
+ if (Grafreed.clipboard.size() == 1)
21842592 {
2185
- Object3D content = GrafreeD.clipboard.get(0);
2593
+ Object3D content = Grafreed.clipboard.get(0);
21862594
21872595 if (content instanceof cGroup && ((cGroup)content).transientlink )
21882596 content = ((cGroup)content).get(0);
....@@ -2199,7 +2607,7 @@
21992607 {
22002608 RevertMeshes();
22012609 } else
2202
- if (source == resetMeshItem)
2610
+ if (source == resetAllItem)
22032611 {
22042612 ResetAll();
22052613 } else
....@@ -2219,9 +2627,9 @@
22192627 {
22202628 ClearSelection(true);
22212629 } else
2222
- if (source == grabItem)
2630
+ if (source == grabItem || source == groupButton)
22232631 {
2224
- group(new cGroup(), true);
2632
+ group(new cGroup(), false); // true);
22252633 } else
22262634 if (source == hideItem)
22272635 {
....@@ -2239,16 +2647,16 @@
22392647 {
22402648 makeSomething(new Camera());
22412649 } else
2242
- if (source == compositeItem)
2650
+ if (source == compositeItem || source == compositeButton)
22432651 {
22442652 group(new Composite());
22452653 } else
2246
- if (source == randomItem)
2654
+ if (source == switchItem || source == switchButton)
22472655 {
22482656 RandomNode random = new RandomNode();
22492657 group(random);
22502658 if (random.size() > 0)
2251
- random.name = random.get(0).name + "Rnd";
2659
+ random.name = random.get(0).name + "Switch";
22522660 } else
22532661 if (source == physicsItem)
22542662 {
....@@ -2345,7 +2753,7 @@
23452753 {
23462754 group(new cLinker());
23472755 } else
2348
- if (source == textureItem)
2756
+ if (source == textureItem || source == textureButton)
23492757 {
23502758 group(new TextureNode());
23512759 } else
....@@ -2365,17 +2773,30 @@
23652773 {
23662774 CastShadow(2);
23672775 } else
2368
- if (source == ungroupItem)
2776
+ if (source == ungroupItem || source == ungroupButton)
23692777 {
2370
- //ungroup();
2778
+ boolean hasRoot = false;
2779
+
23712780 for (int i=0; i<group.selection.size(); i++)
23722781 {
2373
- Ungroup(group.selection.get(i));
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
23742787 }
23752788
2376
- ClearSelection(false);
2377
-
2378
- refreshContents();
2789
+ if (!hasRoot)
2790
+ {
2791
+ for (int i=0; i<group.selection.size(); i++)
2792
+ {
2793
+ Ungroup(group.selection.get(i));
2794
+ }
2795
+
2796
+ ClearSelection(false);
2797
+
2798
+ refreshContents();
2799
+ }
23792800 } else
23802801 if (source == genUVItem)
23812802 {
....@@ -2387,7 +2808,7 @@
23872808 } else
23882809 if (source == genNormalsMESHItem)
23892810 {
2390
- GenNormals(true); // TODO
2811
+ GenNormalsMESH();
23912812 } else
23922813 if (source == genNormalsORGANItem)
23932814 {
....@@ -2452,6 +2873,22 @@
24522873 if (source == unmarkleavesItem)
24532874 {
24542875 MarkLeaves(false);
2876
+ } else
2877
+ if (source == rewindleavesItem)
2878
+ {
2879
+ RewindLeaves(true);
2880
+ } else
2881
+ if (source == unrewindleavesItem)
2882
+ {
2883
+ RewindLeaves(false);
2884
+ } else
2885
+ if (source == randomleavesItem)
2886
+ {
2887
+ RandomLeaves(true);
2888
+ } else
2889
+ if (source == unrandomleavesItem)
2890
+ {
2891
+ RandomLeaves(false);
24552892 } else
24562893 if (source == flipVItem)
24572894 {
....@@ -2537,9 +2974,13 @@
25372974 {
25382975 SmoothMesh();
25392976 } else
2540
- if (source == transformgeometryItem)
2977
+ if (source == transformGeometryItem)
25412978 {
25422979 TransformGeometry();
2980
+ } else
2981
+ if (source == transformChildrenItem)
2982
+ {
2983
+ TransformChildren();
25432984 } else
25442985 if (source == resetTransformItem)
25452986 {
....@@ -2547,7 +2988,11 @@
25472988 } else
25482989 if (source == resetCentroidItem)
25492990 {
2550
- ResetCentroid();
2991
+ ResetCentroid(true);
2992
+ } else
2993
+ if (source == resetCentroidXZItem)
2994
+ {
2995
+ ResetCentroid(false);
25512996 } else
25522997 if (source == resetParentItem)
25532998 {
....@@ -2679,6 +3124,10 @@
26793124 if (source == twoButton)
26803125 {
26813126 radio.layout = twoButton;
3127
+
3128
+ if (CameraPane.FULLSCREEN)
3129
+ fullscreenLayout = radio.layout;
3130
+
26823131 // bug
26833132 //gridPanel.setDividerLocation(1.0);
26843133 //bigPanel.setDividerLocation(0.0);
....@@ -2711,10 +3160,31 @@
27113160 bigThree.ClearUI();
27123161 bigThree.add(centralPanel);
27133162 bigThree.FlushUI();
3163
+
3164
+ cameraView.requestFocusInWindow();
3165
+
3166
+// refreshContents(true);
3167
+//
3168
+// try
3169
+// {
3170
+// java.awt.Robot bot = new java.awt.Robot();
3171
+// int mask = InputEvent.BUTTON1_MASK;
3172
+// bot.mouseMove(100, 100);
3173
+// bot.mousePress(mask);
3174
+// bot.mouseRelease(mask);
3175
+// }
3176
+// catch (Exception e)
3177
+// {
3178
+//
3179
+// }
3180
+
27143181 } else
27153182 if (source == threeButton)
27163183 {
27173184 radio.layout = threeButton;
3185
+
3186
+ if (CameraPane.FULLSCREEN)
3187
+ fullscreenLayout = radio.layout;
27183188
27193189 // bigThree.remove(scenePanel);
27203190 // bigThree.remove(centralPanel);
....@@ -2747,10 +3217,15 @@
27473217 bigThree.add(centralPanel);
27483218 bigThree.add(XYZPanel);
27493219 bigThree.FlushUI();
3220
+
3221
+ cameraView.requestFocusInWindow();
27503222 } else
27513223 if (source == fourButton)
27523224 {
27533225 radio.layout = fourButton;
3226
+
3227
+ if (CameraPane.FULLSCREEN)
3228
+ fullscreenLayout = radio.layout;
27543229
27553230 // bigThree.remove(scenePanel);
27563231 // bigThree.remove(centralPanel);
....@@ -2782,10 +3257,15 @@
27823257 bigThree.ClearUI();
27833258 bigThree.add(scenePanel);
27843259 bigThree.FlushUI();
3260
+
3261
+ cameraView.requestFocusInWindow();
27853262 } else
27863263 if (source == sixButton)
27873264 {
27883265 radio.layout = sixButton;
3266
+
3267
+ if (CameraPane.FULLSCREEN)
3268
+ fullscreenLayout = radio.layout;
27893269
27903270 // bigThree.remove(scenePanel);
27913271 // bigThree.remove(centralPanel);
....@@ -2818,10 +3298,15 @@
28183298 bigThree.add(scenePanel);
28193299 bigThree.add(centralPanel);
28203300 bigThree.FlushUI();
3301
+
3302
+ cameraView.requestFocusInWindow();
28213303 } else
28223304 if (source == sevenButton)
28233305 {
28243306 radio.layout = sevenButton;
3307
+
3308
+ if (CameraPane.FULLSCREEN)
3309
+ fullscreenLayout = radio.layout;
28253310
28263311 // bigThree.remove(scenePanel);
28273312 // bigThree.remove(centralPanel);
....@@ -2855,6 +3340,8 @@
28553340 bigThree.add(centralPanel);
28563341 bigThree.add(XYZPanel);
28573342 bigThree.FlushUI();
3343
+
3344
+ cameraView.requestFocusInWindow();
28583345 } else
28593346 if (source == rootButton)
28603347 {
....@@ -2866,6 +3353,7 @@
28663353 EditObject(obj);
28673354 }
28683355
3356
+ cameraView.requestFocusInWindow();
28693357 refreshContents(true);
28703358 } else
28713359 if (source == closeButton)
....@@ -2875,22 +3363,37 @@
28753363 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28763364 {
28773365 ab = (cRadio)e.nextElement();
2878
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3366
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28793367 {
3368
+ // Patch to avoid bug with transparency.
3369
+ if (!ab.hadMaterial)
3370
+ {
3371
+ ab.object.material = null;
3372
+ }
3373
+
28803374 buttonGroup.remove(ab);
28813375 radioPanel.remove(ab);
28823376
2883
- ab.GetObject().editWindow = null;
3377
+ //ab.GetObject().editWindow = null;
3378
+ ab.GetObject().manipWindow = null;
28843379 // ab.GetObject().objectUI = null; // ?????????
28853380
28863381 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28873382 break;
28883383 }
28893384 }
3385
+
3386
+ cameraView.requestFocusInWindow();
28903387 refreshContents(true);
28913388 } else
28923389 if (source == editItem || source == editButton)
28933390 {
3391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3392
+ {
3393
+ Object3D child = (Object3D)e.nextElement();
3394
+ child.pinned = true;
3395
+ }
3396
+
28943397 EditSelection(false);
28953398 } else
28963399 if (source == uneditButton)
....@@ -2900,12 +3403,13 @@
29003403 Object3D child = (Object3D)e.nextElement();
29013404 if(child.editWindow != null)
29023405 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3406
+ child.pinned = false;
29033407 child.CloseUI();
29043408 listUI.remove(child);
29053409
2906
- child.editWindow = null; // ???????????
3410
+ //child.editWindow = null; // ???????????
29073411 }
2908
- objEditor.ctrlPanel.validate();
3412
+ objEditor.ctrlPanel.FlushUI();
29093413 //objEditor.jTree.clearSelection();
29103414 //objEditor.ResetSliders();
29113415 refreshContents(true);
....@@ -2916,6 +3420,7 @@
29163420 //copy.ClearUI();
29173421 for (Object3D obj : listUI)
29183422 {
3423
+ obj.pinned = false;
29193424 obj.CloseUI();
29203425 }
29213426 listUI.clear();
....@@ -2925,7 +3430,7 @@
29253430 {
29263431 assert(copy == group);
29273432
2928
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3433
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29293434
29303435 for (Object3D obj : listUI)
29313436 {
....@@ -2989,20 +3494,44 @@
29893494 frontView.object = group;
29903495 sideView.object = group;
29913496 }
2992
- group.editWindow = this;
3497
+
3498
+// fix "+" issue
3499
+ //group.editWindow = this;
3500
+ group.manipWindow = this;
3501
+
29933502 /*
29943503 currentLayout = radio.layout;
29953504 if (currentLayout == null)
29963505 currentLayout = sevenButton;
29973506 */
29983507 radio.layout.doClick();
3508
+
3509
+ ClearUnpinned();
3510
+ SetPinStates(group.selection.size() > 0);
3511
+ if (group.selection.size() == 1)
3512
+ EditSelection(false);
29993513 keepparent = group.parent;
30003514 // PARENT = NULL or not???
30013515 //group.parent = null; // ROOT
30023516 //group.attributes = -1;
30033517 ResetModel();
3518
+
3519
+ cameraView.requestFocusInWindow();
30043520 refreshContents(true);
3005
- }
3521
+ } else if (event.getSource() == editCameraItem)
3522
+ {
3523
+ cameraView.ProtectCamera();
3524
+ cameraView.repaint();
3525
+ return;
3526
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3527
+ {
3528
+ cameraView.RevertCamera();
3529
+ cameraView.repaint();
3530
+ return;
3531
+ // } else if (event.getSource() == textureButton)
3532
+ // {
3533
+ // return; // true;
3534
+ }
30063535 else
30073536 {
30083537 //return super.action(event, arg);
....@@ -3011,7 +3540,6 @@
30113540 }
30123541
30133542 boolean useclient = false;
3014
- cRadio radio;
30153543
30163544 void ToggleRoot()
30173545 {
....@@ -3063,6 +3591,28 @@
30633591 refreshContents();
30643592 }
30653593
3594
+ void TransformChildren()
3595
+ {
3596
+ Object3D obj;
3597
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3598
+ {
3599
+ obj = (Object3D)e.nextElement();
3600
+ obj.KeepTextureMatrices();
3601
+ obj.TransformChildren();
3602
+ obj.RestoreTextureMatrices();
3603
+
3604
+// if (obj.parent == null)
3605
+// {
3606
+// System.out.println("NULL PARENT!");
3607
+// new Exception().printStackTrace();
3608
+// }
3609
+// else
3610
+// TouchTransform(obj);
3611
+// //obj.parent.Touch();
3612
+ }
3613
+
3614
+ refreshContents();
3615
+ }
30663616
30673617 void ResetTransform()
30683618 {
....@@ -3175,7 +3725,7 @@
31753725 refreshContents();
31763726 }
31773727
3178
- void ResetCentroid()
3728
+ void ResetCentroid(boolean full)
31793729 {
31803730 Object3D obj;
31813731 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3190,12 +3740,16 @@
31903740 LA.matIdentity(Object3D.mat);
31913741 obj.getBounds(minima, maxima, false);
31923742 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3193
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3743
+ if (full)
3744
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31943745 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31953746 obj.TransformMesh(Object3D.mat);
3747
+
31963748 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3197
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3749
+ if (full)
3750
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31983751 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3752
+
31993753 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32003754 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32013755 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3224,7 +3778,8 @@
32243778
32253779 int size = obj.MemorySize();
32263780
3227
- System.err.println((size/1024) + " KB is the size of " + obj);
3781
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3782
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32283783 }
32293784 }
32303785 catch (Exception e)
....@@ -3261,9 +3816,9 @@
32613816 obj = (Object3D)e.nextElement();
32623817
32633818 System.out.println("Object is: " + obj);
3264
- GrafreeD.AnalyzeObject(obj);
3819
+ Grafreed.AnalyzeObject(obj);
32653820 System.out.println("Boundary rep: " + obj.bRep);
3266
- GrafreeD.AnalyzeObject(obj.bRep);
3821
+ Grafreed.AnalyzeObject(obj.bRep);
32673822
32683823 // System.err.println((size/1024) + " KB is the size of " + obj);
32693824 }
....@@ -3305,6 +3860,13 @@
33053860 void GenNormals(boolean crease)
33063861 {
33073862 group.GenNormalsS(crease);
3863
+
3864
+ refreshContents();
3865
+ }
3866
+
3867
+ void GenNormalsMESH()
3868
+ {
3869
+ group.GenNormalsMeshS();
33083870
33093871 refreshContents();
33103872 }
....@@ -3477,8 +4039,8 @@
34774039
34784040 void ParseVertices()
34794041 {
3480
- boolean epsequal = GrafreeD.epsequal;
3481
- GrafreeD.epsequal = true;
4042
+ boolean epsequal = Grafreed.epsequal;
4043
+ Grafreed.epsequal = true;
34824044
34834045 for (int i=0; i<group.selection.size(); i++)
34844046 {
....@@ -3503,7 +4065,7 @@
35034065 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35044066 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35054067
3506
- g.add(GrafreeD.clipboard);
4068
+ g.add(Grafreed.clipboard);
35074069
35084070 buffer.add(g);
35094071 }
....@@ -3518,7 +4080,7 @@
35184080 makeSomething(buffer, i==group.selection.size()-1);
35194081 }
35204082
3521
- GrafreeD.epsequal = epsequal;
4083
+ Grafreed.epsequal = epsequal;
35224084
35234085 refreshContents();
35244086 }
....@@ -3536,7 +4098,16 @@
35364098 String pigment = Object3D.GetPigment(tex);
35374099 //String bump = Object3D.GetBump(tex);
35384100
3539
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4101
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4102
+
4103
+ try
4104
+ {
4105
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4106
+ }
4107
+ catch (Exception e)
4108
+ {
4109
+ System.err.println("FAIL: " + node);
4110
+ }
35404111
35414112 double s = v.s;
35424113
....@@ -3624,11 +4195,11 @@
36244195
36254196 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36264197
3627
- boolean random = CameraPane.RANDOM;
3628
- CameraPane.RANDOM = false; // parse all random nodes
4198
+ boolean random = CameraPane.SWITCH;
4199
+ CameraPane.SWITCH = false; // parse all random nodes
36294200 lowres.linkVerticesThis(null);
36304201 lowres.linkVerticesThis(sn);
3631
- CameraPane.RANDOM = random;
4202
+ CameraPane.SWITCH = random;
36324203
36334204 System.err.flush();
36344205
....@@ -3668,7 +4239,7 @@
36684239 return;
36694240
36704241 Object3D poses = group.selection.get(0);
3671
- Object3D ref = GrafreeD.clipboard.get(0);
4242
+ Object3D ref = Grafreed.clipboard.get(0);
36724243
36734244 Object3D newgroup = new Object3D("Po:" + poses.name);
36744245
....@@ -3862,9 +4433,9 @@
38624433
38634434 void ClipMesh()
38644435 {
3865
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4436
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38664437 {
3867
- Object3D content = GrafreeD.clipboard.get(0);
4438
+ Object3D content = Grafreed.clipboard.get(0);
38684439
38694440 if (content instanceof cGroup && ((cGroup)content).transientlink )
38704441 content = ((cGroup)content).get(0);
....@@ -3873,7 +4444,7 @@
38734444 // {
38744445 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38754446 // }
3876
- group.selection.ClipMesh(GrafreeD.clipboard);
4447
+ group.selection.ClipMesh(Grafreed.clipboard);
38774448 }
38784449 // group.selection.ClipMesh(GrafreeD.clipboard);
38794450 System.out.println("DONE.");
....@@ -3920,6 +4491,18 @@
39204491 void MarkLeaves(boolean hide)
39214492 {
39224493 group.selection.MarkLeaves(hide);
4494
+ refreshContents();
4495
+ }
4496
+
4497
+ void RewindLeaves(boolean hide)
4498
+ {
4499
+ group.selection.RewindLeaves(hide);
4500
+ refreshContents();
4501
+ }
4502
+
4503
+ void RandomLeaves(boolean hide)
4504
+ {
4505
+ group.selection.RandomLeaves(hide);
39234506 refreshContents();
39244507 }
39254508
....@@ -3994,10 +4577,6 @@
39944577 // }
39954578 // }
39964579
3997
- static boolean allparams = true;
3998
-
3999
- static Vector<Object3D> listUI = new Vector<Object3D>();
4000
-
40014580 void EditSelection(boolean newWindow)
40024581 {
40034582 // aConstraints.gridy = 0;
....@@ -4005,10 +4584,10 @@
40054584 {
40064585 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40074586 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4008
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4587
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40094588
40104589 Object3D elem = (Object3D)group.selection.elementAt(i);
4011
- if(elem != group)
4590
+ if(elem != group || !newWindow)
40124591 {
40134592 // if (!(elem instanceof Composite))
40144593 // newWindow = false;
....@@ -4090,7 +4669,8 @@
40904669 //new Exception().printStackTrace();
40914670
40924671 freezemodel = true;
4093
-
4672
+ ClearUnpinned();
4673
+
40944674 /**/
40954675 //switch (event.id)
40964676 {
....@@ -4098,7 +4678,6 @@
40984678 //case 702: // Event.LIST_DESELECT
40994679 group.deselectAll();
41004680 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4101
- objEditor.ClearInfo(); // .GetMaterial());
41024681 if (tps != null)
41034682 {
41044683 for (int i=0; i < tps.length; i++)
....@@ -4107,33 +4686,39 @@
41074686
41084687 //if (child.parent != null)
41094688 //child.parent.addSelectee(child);
4689
+ objEditor.SetMaterial(child);
41104690 group.addSelectee(child);
4111
- objEditor.SetMaterial(child); // .GetMaterial());
4112
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4113
- System.err.println("info : " + child.GetPath());
41144691 }
41154692 }
4116
- else
4117
- {
4118
- objEditor.SetMaterial(group); // .GetMaterial());
4119
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4120
- System.err.println("info : " + group.GetPath());
4121
- }
4693
+// else
4694
+// {
4695
+// objEditor.SetMaterial(group); // .GetMaterial());
4696
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4697
+// System.err.println("info : " + group.GetPath());
4698
+// }
41224699
4123
- objEditor.SetText(); // jan 2014
4124
-
4125
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4700
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41264701 CameraPane.flash = true;
41274702
4128
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4703
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41294704 // a camera
41304705 {
4131
- CameraPane.camerachangeframe = 0; // don't refuse it
4132
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4706
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4707
+ {
4708
+ CameraPane.camerachangeframe = 0; // don't refuse it
4709
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4710
+ }
41334711 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41344712 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41354713 }
41364714
4715
+ if (tps != null && tps.length == 1)
4716
+ {
4717
+ EditSelection(false);
4718
+ }
4719
+
4720
+ SetPinStates(tps != null && tps.length > 0);
4721
+
41374722 refreshContents();
41384723 //return true;
41394724 }
....@@ -4142,6 +4727,35 @@
41424727
41434728 freezemodel = false;
41444729 }
4730
+
4731
+ void SetPinStates(boolean enabled)
4732
+ {
4733
+ editButton.setEnabled(enabled);
4734
+ uneditButton.setEnabled(enabled);
4735
+ unselectButton.setEnabled(enabled);
4736
+ flashSelectionButton.setEnabled(enabled);
4737
+ }
4738
+
4739
+ void refreshContents(boolean cp)
4740
+ {
4741
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4743
+ {
4744
+ objEditor.ClearInfo(); // .GetMaterial());
4745
+
4746
+ for (int i=0; i < group.selection.Size(); i++)
4747
+ {
4748
+ Object3D child = (Object3D) group.selection.get(i);
4749
+
4750
+ objEditor.AddInfo(child, this, true);
4751
+ System.err.println("info : " + child.GetPath());
4752
+ }
4753
+
4754
+ objEditor.SetText(); // jan 2014
4755
+ }
4756
+
4757
+ super.refreshContents(cp);
4758
+ }
41454759
41464760 void linkSomething(Object3D thing)
41474761 {
....@@ -4213,16 +4827,19 @@
42134827 {
42144828 if (group.selection.isEmpty())
42154829 return;
4216
- GrafreeD.clipboardIsTempGroup = false;
4830
+
4831
+ Grafreed.clipboardIsTempGroup = false;
42174832 Composite tGroup = null;
42184833 if (group.selection.size() > 0) // 1)
42194834 {
42204835 tGroup = new cGroup();
4221
- GrafreeD.clipboardIsTempGroup = true;
4836
+ Grafreed.clipboardIsTempGroup = true;
42224837 }
42234838
42244839 if (cut)
42254840 {
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
42264843 //int indices[] = jList.getSelectedIndices();
42274844 //for (int i = indices.length - 1; i >= 0; i--)
42284845 //jList.remove(indices[i]);
....@@ -4258,16 +4875,16 @@
42584875 //System.out.println("cut " + child);
42594876 //System.out.println("parent = " + child.parent);
42604877 // tmp.addChild(child);
4261
- if (GrafreeD.clipboardIsTempGroup)
4878
+ if (Grafreed.clipboardIsTempGroup)
42624879 tGroup.add/*Child*/(tmp);
42634880 else
4264
- GrafreeD.clipboard = tmp;
4881
+ Grafreed.clipboard = tmp;
42654882 }
42664883 else
4267
- if (GrafreeD.clipboardIsTempGroup)
4884
+ if (Grafreed.clipboardIsTempGroup)
42684885 tGroup.add/*Child*/(child);
42694886 else
4270
- GrafreeD.clipboard = child;
4887
+ Grafreed.clipboard = child;
42714888 }
42724889
42734890 //ResetModel();
....@@ -4299,21 +4916,23 @@
42994916 //System.out.println("cut " + elem);
43004917 //System.out.println("parent = " + elem.parent);
43014918 // tmp.addChild(elem);
4302
- if (GrafreeD.clipboardIsTempGroup)
4919
+ if (Grafreed.clipboardIsTempGroup)
43034920 tGroup.add/*Child*/(tmp);
43044921 else
4305
- GrafreeD.clipboard = tmp;
4922
+ Grafreed.clipboard = tmp;
43064923 }
43074924 else
4308
- if (GrafreeD.clipboardIsTempGroup)
4925
+ if (Grafreed.clipboardIsTempGroup)
43094926 tGroup.add/*Child*/(child);
43104927 else
4311
- GrafreeD.clipboard = child;
4928
+ Grafreed.clipboard = child;
43124929 }
43134930
43144931 }
4315
- if (GrafreeD.clipboardIsTempGroup)
4316
- GrafreeD.clipboard = tGroup;
4932
+
4933
+ if (Grafreed.clipboardIsTempGroup)
4934
+ Grafreed.clipboard = tGroup;
4935
+
43174936 if (cut)
43184937 {
43194938 ResetModel();
....@@ -4323,11 +4942,15 @@
43234942
43244943 void paste(boolean expand)
43254944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
43264949 // if (GrafreeD.clipboard == null)
43274950 // return;
43284951 boolean first = true;
43294952
4330
- if (GrafreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
43314954 {
43324955 Composite temp;
43334956
....@@ -4338,7 +4961,7 @@
43384961 temp = (Composite)Applet3D.clipboard.deepCopy();
43394962 */
43404963 Object3D elem;
4341
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4964
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43424965 {
43434966 Object3D child = (Object3D)e.nextElement();
43444967
....@@ -4372,21 +4995,22 @@
43724995 //Object3D cb = Applet3D.clipboard;
43734996 //temp.addChild(cb);
43744997 //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());
4998
+ assert(Grafreed.clipboard.parent == null);
4999
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5000
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5001
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5002
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43805003 else
4381
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4382
- GrafreeD.clipboard.get(0).parent = keepparent;
5004
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5005
+ Grafreed.clipboard.get(0).parent = keepparent;
43835006 }
43845007
5008
+ Globals.SAVEONMAKE = keep;
43855009 ResetModel();
43865010 refreshContents();
43875011 }
43885012
4389
- void pasteInto(boolean copyit)
5013
+ void pasteInto(boolean copyit, boolean clone)
43905014 {
43915015 // if (GrafreeD.clipboard == null)
43925016 // return;
....@@ -4415,15 +5039,22 @@
44155039 if (copyit)
44165040 {
44175041 // paste(false);
4418
- CloneClipboard(false); // sept 2014
5042
+ if (clone)
5043
+ {
5044
+ CloneClipboard(false); // sept 2014
5045
+ }
5046
+ else
5047
+ {
5048
+ paste(false);
5049
+ }
44195050 }
44205051 else
44215052 {
44225053 boolean first = true;
44235054
4424
- if (GrafreeD.clipboardIsTempGroup)
5055
+ if (Grafreed.clipboardIsTempGroup)
44255056 {
4426
- Composite temp = (Composite)GrafreeD.clipboard;
5057
+ Composite temp = (Composite)Grafreed.clipboard;
44275058 Object3D copy;
44285059 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44295060 {
....@@ -4433,7 +5064,7 @@
44335064 }
44345065 } else
44355066 {
4436
- linkSomething(GrafreeD.clipboard); //.get(0));
5067
+ linkSomething(Grafreed.clipboard); //.get(0));
44375068 }
44385069 }
44395070 }
....@@ -4510,6 +5141,10 @@
45105141
45115142 void group(Object3D csg, boolean grab)
45125143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
45135148 if (//false) // why??
45145149 !group.selection.isEmpty())
45155150 {
....@@ -4623,10 +5258,15 @@
46235258 //node.add(csg);
46245259 //makeSomething(node);
46255260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
46265262 }
46275263
46285264 void Ungroup(Object3D g)
46295265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
46305270 if (g instanceof HiddenObject)
46315271 {
46325272 HiddenObject h = (HiddenObject) g;
....@@ -4643,6 +5283,7 @@
46435283 objEditor.makeSomething(g.get(i), false);
46445284 }
46455285 }
5286
+ Globals.SAVEONMAKE = keep;
46465287 }
46475288
46485289 void ungroup()
....@@ -4838,21 +5479,6 @@
48385479 }
48395480 */
48405481
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
-
48565482 /*
48575483 public void Callback(Object obj)
48585484 {
....@@ -4876,26 +5502,9 @@
48765502 }
48775503 */
48785504
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
-
48965505 String GetFile(String dialogName)
48975506 {
4898
- if (GrafreeD.standAlone)
5507
+ if (Grafreed.standAlone)
48995508 {
49005509 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49015510 browser.show();
....@@ -4959,10 +5568,33 @@
49595568 cButton flashSelectionButton;
49605569 cButton editButton;
49615570 cButton uneditButton;
5571
+ JCheckBox allParamsButton;
49625572 cButton clearpanelButton;
4963
- cButton allParamsButton;
49645573 cButton unselectButton;
49655574
5575
+ cButton restoreCameraButton;
5576
+
5577
+ cButton saveButton;
5578
+ cButton oneStepButton;
5579
+
5580
+ cButton groupButton;
5581
+ cButton ungroupButton;
5582
+ cButton compositeButton;
5583
+ cButton switchButton;
5584
+ cButton loopButton;
5585
+ cButton textureButton;
5586
+
5587
+ cButton gridButton;
5588
+ cButton boxButton;
5589
+ cButton sphereButton;
5590
+ cButton coneButton;
5591
+ cButton torusButton;
5592
+ cButton superButton;
5593
+ cButton kleinButton;
5594
+ cButton particlesButton;
5595
+ cButton overlayButton;
5596
+ cButton lightButton;
5597
+
49665598 cButton screenfitButton;
49675599 cButton screenfitpointButton;
49685600 cButton snapobjectButton;
....@@ -4974,14 +5606,6 @@
49745606
49755607 cButton setsupportButton;
49765608
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
-
49855609 //
49865610 //Composite
49875611 Object3D // to do !!
....@@ -4991,9 +5615,11 @@
49915615 //JTree jTree;
49925616 private MenuItem lookAtItem;
49935617 private MenuItem lookFromItem;
4994
- private MenuItem switchItem;
5618
+ private MenuItem switchViewItem;
49955619 private MenuItem cutItem;
4996
- private MenuItem duplicateItem;
5620
+ private MenuItem undoItem;
5621
+ private MenuItem redoItem;
5622
+ private JMenuItem duplicateItem;
49975623 private MenuItem cloneItem;
49985624 private MenuItem cloneSupportItem;
49995625 private MenuItem overwriteGeoItem;
....@@ -5006,7 +5632,7 @@
50065632 private MenuItem linkverticesItem;
50075633 private MenuItem relinkverticesItem;
50085634 private MenuItem setMasterItem;
5009
- private MenuItem resetMeshItem;
5635
+ private MenuItem resetAllItem;
50105636 private MenuItem stepAllItem;
50115637 private MenuItem revertMeshItem;
50125638 private MenuItem poseMeshItem;
....@@ -5017,6 +5643,7 @@
50175643 private MenuItem mergeGeometriesItem;
50185644 private MenuItem copyItem;
50195645 private MenuItem pasteItem;
5646
+ private MenuItem pasteIntoItem;
50205647 private MenuItem pasteLinkItem;
50215648 private MenuItem pasteCloneItem;
50225649 private MenuItem pasteExpandItem;
....@@ -5055,6 +5682,10 @@
50555682 private MenuItem showleavesItem;
50565683 private MenuItem markleavesItem;
50575684 private MenuItem unmarkleavesItem;
5685
+ private MenuItem rewindleavesItem;
5686
+ private MenuItem unrewindleavesItem;
5687
+ private MenuItem randomleavesItem;
5688
+ private MenuItem unrandomleavesItem;
50585689
50595690 private MenuItem flipVItem;
50605691 private MenuItem unflipVItem;
....@@ -5066,15 +5697,17 @@
50665697 private MenuItem panoTexturesItem;
50675698
50685699 private MenuItem resetCentroidItem;
5069
- private MenuItem transformgeometryItem;
5700
+ private MenuItem resetCentroidXZItem;
50705701 private MenuItem resetTransformItem;
5702
+ private MenuItem transformGeometryItem;
5703
+ private MenuItem transformChildrenItem;
50715704 private MenuItem hideItem;
50725705 private MenuItem grabItem;
50735706 private MenuItem backItem;
50745707 private MenuItem frontItem;
50755708 private MenuItem cameraItem;
50765709 private MenuItem compositeItem;
5077
- private MenuItem randomItem;
5710
+ private MenuItem switchItem;
50785711 private MenuItem physicsItem;
50795712 private MenuItem frameselectorItem;
50805713 private MenuItem scriptNodeItem;
....@@ -5114,7 +5747,7 @@
51145747 private MenuItem blobItem;
51155748 private MenuItem latheItem;
51165749 private MenuItem bezierItem;
5117
- private MenuItem checkerItem;
5750
+ private MenuItem overlayItem;
51185751 private MenuItem meshItem;
51195752 // private MenuItem meshGroupItem;
51205753 private MenuItem springItem;
....@@ -5136,11 +5769,6 @@
51365769 private MenuItem doubleItem;
51375770 private MenuItem tripleItem;
51385771
5139
- private MenuItem importGFDItem;
5140
- private MenuItem importVRMLX3DItem;
5141
- private MenuItem import3DSItem;
5142
- private MenuItem importOBJItem;
5143
-
51445772 private MenuItem computeAOItem;
51455773 private MenuItem recompileItem;
51465774 private MenuItem editScriptItem;
....@@ -5150,4 +5778,8 @@
51505778 private MenuItem analyzeItem;
51515779 private MenuItem dumpItem;
51525780 //boolean freezemodel = false;
5781
+
5782
+ Menu cameraMenu;
5783
+ MenuItem editCameraItem;
5784
+ MenuItem restoreCameraItem;
51535785 }