Normand Briere
2019-06-26 89b25e7cc97f6fe221dfd41c4d463500f8a31bc1
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);
....@@ -98,14 +98,14 @@
9898
9999 void CloneClipboard(boolean supports)
100100 {
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));
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));
106106 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
107
+ makeSomething(CloneObject(Grafreed.clipboard, false));
108
+ Grafreed.clipboard.get(0).parent = keepparent;
109109 }
110110
111111 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +119,7 @@
119119 // obj.support = null;
120120 if (!supports)
121121 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
122
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123123 obj.parent = parent;
124124 // obj.support = support;
125125 // clone.support = support; // aout 2013
....@@ -148,28 +148,21 @@
148148
149149 //JTextField nameField;
150150
151
- void SetupMenu2(ObjEditor oe)
151
+ void SetupMenu2(GroupEditor oe)
152152 {
153
- if (Globals.ADVANCED)
154
- {
155
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
156
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
157
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
158
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
159
- oe.cameraMenu.add("-");
160
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
161
- openWindowItem.addActionListener(this);
162
- editLeafItem.addActionListener(this);
163
- lookAtItem.addActionListener(this);
164
- //lookFromItem.addActinoListener(this);
165
- //switchItem.addActionListener(this);
166
- }
167
-
153
+ oe.jTree = new cTree();
154
+
168155 Menu menu;
169156 oe.menuBar.add(menu = new Menu("Edit"));
170157 //editItem = menu.add(new MenuItem("Edit"));
171158 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
159
+
160
+// undoItem = menu.add(new MenuItem("Undo"));
161
+// undoItem.addActionListener(this);
162
+// redoItem = menu.add(new MenuItem("Redo"));
163
+// redoItem.addActionListener(this);
164
+// menu.add("-");
165
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173166 duplicateItem.addActionListener(this);
174167 cloneItem = menu.add(new MenuItem("Clone"));
175168 cloneItem.addActionListener(this);
....@@ -185,7 +178,6 @@
185178 copyItem.addActionListener(this);
186179 pasteItem = menu.add(new MenuItem("Paste"));
187180 pasteItem.addActionListener(this);
188
- menu.add("-");
189181
190182 menu.add("-");
191183 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -206,14 +198,97 @@
206198 clearAllItem = menu.add(new MenuItem("Clear All"));
207199 clearAllItem.addActionListener(this);
208200 }
201
+
202
+ menuBar.add(cameraMenu = new Menu("View"));
203
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
204
+ //zBufferItem.addActionListener(this);
205
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
206
+ //normalLensItem.addActionListener(this);
207
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
208
+ restoreCameraItem.addActionListener(this);
209
+
210
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
211
+// toggleFullScreenItem.addItemListener(this);
212
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
213
+// cameraMenu.add("-");
214
+//
215
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
216
+// toggleTextureItem.addItemListener(this);
217
+// toggleTextureItem.setState(CameraPane.textureon);
218
+//
219
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
220
+// toggleSwitchItem.addItemListener(this);
221
+// toggleSwitchItem.setState(CameraPane.SWITCH);
222
+
223
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
224
+ toggleHandleItem.addItemListener(this);
225
+ toggleHandleItem.setState(CameraPane.HANDLES);
226
+
227
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
228
+ togglePaintItem.addItemListener(this);
229
+ togglePaintItem.setState(CameraPane.PAINTMODE);
230
+
231
+ if (Globals.ADVANCED)
232
+ {
233
+ cameraMenu.add("-");
234
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
235
+ toggleLiveItem.addItemListener(this);
236
+ toggleLiveItem.setState(Globals.isLIVE());
209237
238
+ cameraMenu.add(stepItem = new MenuItem("Step"));
239
+ stepItem.addActionListener(this);
240
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
241
+ // toggleDLItem.addItemListener(this);
242
+ // toggleDLItem.setState(false);
243
+
244
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
245
+ toggleRenderItem.addItemListener(this);
246
+ toggleRenderItem.setState(!CameraPane.frozen);
247
+
248
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
249
+ toggleDebugItem.addItemListener(this);
250
+ toggleDebugItem.setState(Globals.DEBUG);
251
+
252
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
253
+ toggleFrustumItem.addItemListener(this);
254
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
255
+
256
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
257
+ toggleFootContactItem.addItemListener(this);
258
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
259
+
260
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
261
+ toggleTimelineItem.addItemListener(this);
262
+ }
263
+
264
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
265
+// toggleRootItem.addItemListener(this);
266
+// toggleRootItem.setState(false);
267
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
268
+// animationItem.addItemListener(this);
269
+// animationItem.setState(CameraPane.ANIMATION);
270
+ cameraMenu.add("-");
271
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
272
+ editCameraItem.addActionListener(this);
273
+
274
+ if (Globals.ADVANCED)
275
+ {
276
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
277
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
278
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
279
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
280
+ oe.cameraMenu.add("-");
281
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
282
+ openWindowItem.addActionListener(this);
283
+ editLeafItem.addActionListener(this);
284
+ lookAtItem.addActionListener(this);
285
+ //lookFromItem.addActinoListener(this);
286
+ //switchViewItem.addActionListener(this);
287
+ }
288
+
210289 oe.menuBar.add(menu = new Menu("Setting"));
211290 if (Globals.ADVANCED)
212291 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217292 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218293 revertMeshItem.addActionListener(this);
219294 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -253,21 +328,29 @@
253328 }
254329
255330 oe.menuBar.add(menu = new Menu("Group"));
256
- grabItem = menu.add(new MenuItem("Grab"));
257
- grabItem.addActionListener(this);
331
+// grabItem = menu.add(new MenuItem("Grab"));
332
+// grabItem.addActionListener(this);
258333 backItem = menu.add(new MenuItem("Back"));
259334 backItem.addActionListener(this);
260335 frontItem = menu.add(new MenuItem("Front"));
261336 frontItem.addActionListener(this);
262
- compositeItem = menu.add(new MenuItem("Composite"));
263
- compositeItem.addActionListener(this);
337
+// compositeItem = menu.add(new MenuItem("Composite"));
338
+// compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
264342 hideItem = menu.add(new MenuItem("Hidden Group"));
265343 hideItem.addActionListener(this);
344
+ }
266345 ungroupItem = menu.add(new MenuItem("Ungroup"));
267346 ungroupItem.addActionListener(this);
268
- menu.add("-");
269
- randomItem = menu.add(new MenuItem("Switch node"));
270
- randomItem.addActionListener(this);
347
+
348
+// menu.add("-");
349
+//
350
+// switchItem = menu.add(new MenuItem("Switch node"));
351
+// switchItem.addActionListener(this);
352
+ if (Globals.ADVANCED)
353
+ {
271354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
272355 switchGeoItem.addActionListener(this);
273356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -275,8 +358,6 @@
275358 morphItem = menu.add(new MenuItem("Morph Group"));
276359 morphItem.addActionListener(this);
277360
278
- if (Globals.ADVANCED)
279
- {
280361 menu.add("-");
281362 physicsItem = menu.add(new MenuItem("Physics"));
282363 physicsItem.addActionListener(this);
....@@ -284,22 +365,20 @@
284365 frameselectorItem.addActionListener(this);
285366 scriptNodeItem = menu.add(new MenuItem("Script Node"));
286367 scriptNodeItem.addActionListener(this);
287
- cameraItem = menu.add(new MenuItem("Camera"));
288
- cameraItem.addActionListener(this);
289368 }
290369
291370 oe.menuBar.add(menu = new Menu("Object"));
292
- textureItem = menu.add(new MenuItem("Texture"));
293
- textureItem.addActionListener(this);
371
+// textureItem = menu.add(new MenuItem("Texture"));
372
+// textureItem.addActionListener(this);
294373 billboardItem = menu.add(new MenuItem("Billboard"));
295374 billboardItem.addActionListener(this);
296375 csgItem = menu.add(new MenuItem("CSG"));
297376 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
377
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299378 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
379
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301380 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
381
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303382 shadowZItem.addActionListener(this);
304383 if (Globals.ADVANCED)
305384 {
....@@ -318,8 +397,12 @@
318397 resetTransformItem.addActionListener(this);
319398 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
320399 resetCentroidItem.addActionListener(this);
321
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
322
- transformgeometryItem.addActionListener(this);
400
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
401
+ resetCentroidXZItem.addActionListener(this);
402
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
403
+ transformGeometryItem.addActionListener(this);
404
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
405
+ transformChildrenItem.addActionListener(this);
323406
324407 oe.menuBar.add(menu = new Menu("Geometry"));
325408 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -368,6 +451,10 @@
368451 oe.menuBar.add(menu = new Menu("Attributes"));
369452 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
370453 clearMaterialsItem.addActionListener(this);
454
+ resetAllItem = menu.add(new MenuItem("Reset All"));
455
+ resetAllItem.addActionListener(this);
456
+ stepAllItem = menu.add(new MenuItem("Step All"));
457
+ stepAllItem.addActionListener(this);
371458 menu.add("-");
372459 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
373460 liveleavesItem.addActionListener(this);
....@@ -388,6 +475,14 @@
388475 markleavesItem.addActionListener(this);
389476 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
390477 unmarkleavesItem.addActionListener(this);
478
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
479
+ rewindleavesItem.addActionListener(this);
480
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
481
+ unrewindleavesItem.addActionListener(this);
482
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
483
+ randomleavesItem.addActionListener(this);
484
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
485
+ unrandomleavesItem.addActionListener(this);
391486 menu.add("-");
392487 flipVItem = menu.add(new MenuItem("Flip V"));
393488 flipVItem.addActionListener(this);
....@@ -422,38 +517,41 @@
422517 sortbysizeItem.addActionListener(this);
423518 sortbynameItem = menu.add(new MenuItem("Sort by name"));
424519 sortbynameItem.addActionListener(this);
520
+ menu.add("-");
521
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
522
+ shareGeometriesItem.addActionListener(this);
523
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
524
+ mergeGeometriesItem.addActionListener(this);
425525 if (Globals.ADVANCED)
426526 {
427
- menu.add("-");
527
+ // Pretty much the same as duplicate and clone.
428528 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
429529 extractGeometriesItem.addActionListener(this);
430530 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
431531 cloneGeometriesItem.addActionListener(this);
432
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
433
- shareGeometriesItem.addActionListener(this);
434
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
435
- mergeGeometriesItem.addActionListener(this);
436532 }
437533
438534 oe.menuBar.add(menu = new Menu("Insert"));
439535 buildCreateMenu(menu);
440536
441
- oe.menuBar.add(menu = new Menu("Include"));
442
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
443
- importGFDItem.addActionListener(this);
444
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
445
- importVRMLX3DItem.addActionListener(this);
446
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
447
- importOBJItem.addActionListener(this);
448
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
449
- import3DSItem.addActionListener(this);
450
-
451537 oe.menuBar.add(menu = new Menu("Tools"));
452538 buildToolsMenu(menu);
453539 }
454540
455541 void SetupUI2(ObjEditor oe)
456542 {
543
+ // June 2019
544
+ if (oe == null)
545
+ {
546
+ //super.SetupUI2(this);
547
+ //return;
548
+ }
549
+
550
+ if (copy != group)
551
+ {
552
+ //super.SetupUI2(this);
553
+ }
554
+
457555 //new Exception().printStackTrace();
458556
459557 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -482,97 +580,212 @@
482580 oe.radioPanel.add(dummyButton);
483581 oe.buttonGroup.add(dummyButton);
484582 */
583
+ cGridBag copyOptionsPanel = new cGridBag();
584
+
585
+ copyOptionsPanel.preferredHeight = 2;
586
+
485587 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
486588
487
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
488
- liveCB.setToolTipText("Enabled animation");
589
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
590
+ //minButton.setToolTipText("Minimize window");
591
+ //minButton.addActionListener(this);
592
+
593
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
+ maxButton.setToolTipText("Maximize window");
595
+ maxButton.addActionListener(this);
596
+
597
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598
+ fullButton.setToolTipText("Full-screen window");
599
+ fullButton.addActionListener(this);
600
+
601
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ restoreCameraButton.setToolTipText("Restore viewpoint");
603
+ restoreCameraButton.addActionListener(this);
604
+
605
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
+ undoButton.setToolTipText("Undo changes");
607
+ undoButton.addActionListener(this);
608
+ undoButton.setEnabled(false);
609
+
610
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ redoButton.setToolTipText("Redo changes");
612
+ redoButton.addActionListener(this);
613
+ redoButton.setEnabled(false);
614
+
615
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ saveButton.setToolTipText("Save changes");
617
+ saveButton.addActionListener(this);
618
+
619
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
620
+ liveCB.setToolTipText("Enable animation");
489621 liveCB.addItemListener(this);
490622
491
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
623
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492624 oneStepButton.setToolTipText("Animate one step forward");
493625 oneStepButton.addActionListener(this);
494626
495
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
627
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
496628 fastCB.setToolTipText("Fast mode");
497629 fastCB.addItemListener(this);
498630
499
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
500
- trackCB.setToolTipText("Enable tracking");
501
- trackCB.addItemListener(this);
502
-
503
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
631
+ //oe.toolboxPanel.Return();
632
+
633
+ copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504634 screenfitButton.setToolTipText("Screen fit");
505635 screenfitButton.addActionListener(this);
636
+
637
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
638
+// trackCB.setToolTipText("Enable tracking");
639
+// trackCB.addItemListener(this);
506640
507641 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
508642 // screenfitpointButton.addActionListener(this);
509643
510644 if (Globals.ADVANCED)
511645 {
512
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
646
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
513647 snapobjectButton.addActionListener(this);
514648 snapobjectButton.setToolTipText("Snap Object");
515649 }
516650
517
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
518
- flashSelectionButton.setToolTipText("Show selection");
519
- flashSelectionButton.addActionListener(this);
651
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
520652
521
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
522
-
523
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
653
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
524654 twoButton.setToolTipText("Show center view only");
525655 twoButton.addActionListener(this);
526
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
656
+ this.fullscreenLayout = twoButton;
657
+
658
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
527659 fourButton.addActionListener(this);
528660 fourButton.setToolTipText("Show left panel only");
529
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
661
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
530662 sixButton.setToolTipText("2-column layout left");
531663 sixButton.addActionListener(this);
532
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
533665 threeButton.setToolTipText("2-column layout right");
534666 threeButton.addActionListener(this);
535
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
667
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
536668 sevenButton.setToolTipText("3-column layout");
537669 sevenButton.addActionListener(this);
538670 //
539671
540
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
672
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541673 rootButton.setToolTipText("Edit selection in new tab");
542674 rootButton.addActionListener(this);
543675
544
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
545677 closeButton.setToolTipText("Close tab");
546678 closeButton.addActionListener(this);
547679 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
548680 //clearButton.addActionListener(this);
549
-
550
- cGridBag commandsPanel = new cGridBag();
681
+
682
+ // INSERT
683
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ gridButton.setToolTipText("Create grid");
685
+ gridButton.addActionListener(this);
686
+
687
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ boxButton.setToolTipText("Create box");
689
+ boxButton.addActionListener(this);
690
+
691
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
692
+ sphereButton.setToolTipText("Create sphere");
693
+ sphereButton.addActionListener(this);
694
+
695
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696
+ coneButton.setToolTipText("Create cone");
697
+ coneButton.addActionListener(this);
698
+
699
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ torusButton.setToolTipText("Create torus");
701
+ torusButton.addActionListener(this);
702
+
703
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+ superButton.setToolTipText("Create superellipsoid");
705
+ superButton.addActionListener(this);
706
+
707
+ if (Globals.ADVANCED)
708
+ {
709
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
710
+ kleinButton.setToolTipText("Create Klein bottle");
711
+ kleinButton.addActionListener(this);
712
+ }
551713
552
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
714
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ particlesButton.setToolTipText("Create particle system");
716
+ particlesButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.Return();
719
+
720
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
721
+ groupButton.setToolTipText("Create group");
722
+ groupButton.addActionListener(this);
723
+
724
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ compositeButton.setToolTipText("Create composite");
726
+ compositeButton.addActionListener(this);
727
+
728
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
+ switchButton.setToolTipText("Create switch");
730
+ switchButton.addActionListener(this);
731
+
732
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ loopButton.setToolTipText("Create loop");
734
+ loopButton.addActionListener(this);
735
+
736
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
737
+ textureButton.setToolTipText("Create texture");
738
+ textureButton.addActionListener(this);
739
+
740
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ overlayButton.setToolTipText("Create overlay");
742
+ overlayButton.addActionListener(this);
743
+
744
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ lightButton.setToolTipText("Create light");
746
+ lightButton.addActionListener(this);
747
+
748
+ for (int i=6; --i>=0;)
749
+ {
750
+ oe.toolboxPanel.Return();
751
+ oe.toolboxPanel.add(new cGridBag());
752
+ oe.toolboxPanel.add(new cGridBag());
753
+ oe.toolboxPanel.add(new cGridBag());
754
+ oe.toolboxPanel.add(new cGridBag());
755
+ oe.toolboxPanel.add(new cGridBag());
756
+ oe.toolboxPanel.add(new cGridBag());
757
+ oe.toolboxPanel.add(new cGridBag());
758
+ }
759
+
760
+ // EDIT panel
761
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
553762 editButton.setToolTipText("Edit selection");
554763 editButton.addActionListener(this);
555764
556
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
765
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
557766 uneditButton.setToolTipText("Unedit selection");
558767 uneditButton.addActionListener(this);
559768
560
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
769
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
561770 allParamsButton.setToolTipText("Edit all params");
562771 allParamsButton.addActionListener(this);
563772
564
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
773
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565774 clearPanelButton.setToolTipText("Clear edit panel");
566775 clearPanelButton.addActionListener(this);
567776
568
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
777
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569778 unselectButton.setToolTipText("Unselect");
570779 unselectButton.addActionListener(this);
571780
572
- commandsPanel.preferredHeight = 1;
781
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
782
+ flashSelectionButton.setToolTipText("Highlight selection");
783
+ flashSelectionButton.addActionListener(this);
573784
574
- oe.treePanel.add(commandsPanel);
575
- oe.treePanel.Return();
785
+ editCommandsPanel.preferredHeight = 1;
786
+
787
+// oe.treePanel.add(commandsPanel);
788
+// oe.treePanel.Return();
576789
577790 // oe.aConstraints.gridx += 1;
578791 // oe.aConstraints.weighty = 0;
....@@ -589,27 +802,12 @@
589802
590803 JScrollPane jSP;
591804 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
592
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
805
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
593806 ResetModel();
594807
595808 oe.treePanel.add(jSPPanel);
596809 oe.treePanel.Return();
597810
598
- cGridBag copyOptionsPanel = new cGridBag();
599
-
600
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
601
- colorCB.setToolTipText("Copy color when dropped");
602
- colorCB.addItemListener(this);
603
-
604
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
605
- materialCB.setToolTipText("Copy material when dropped");
606
- materialCB.addItemListener(this);
607
-
608
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
609
- textureCB.setToolTipText("Copy texture when dropped");
610
- textureCB.addItemListener(this);
611
-
612
- copyOptionsPanel.preferredHeight = 1;
613811 oe.treePanel.add(copyOptionsPanel);
614812 oe.treePanel.Return();
615813
....@@ -640,6 +838,20 @@
640838
641839 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
642840 {
841
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
842
+ colorCB.setToolTipText("Copy color when dropped");
843
+ colorCB.addItemListener(this);
844
+
845
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
846
+ materialCB.setToolTipText("Copy material when dropped");
847
+ materialCB.addItemListener(this);
848
+
849
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
850
+ textureCB.setToolTipText("Copy texture when dropped");
851
+ textureCB.addItemListener(this);
852
+
853
+ panel.Return();
854
+
643855 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
644856 boxCB.setToolTipText("Display bounding boxes");
645857 boxCB.addItemListener(this);
....@@ -648,7 +860,7 @@
648860 zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
649861 zoomBoxCB.addItemListener(this);
650862
651
- if (Globals.ADVANCED)
863
+ if (true) // Globals.ADVANCED)
652864 {
653865 panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
654866 supportCB.setToolTipText("Enable rigging");
....@@ -657,6 +869,8 @@
657869 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
658870 // localCB.addItemListener(this);
659871
872
+ panel.Return();
873
+
660874 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
661875 crowdCB.setToolTipText("Used for crowds");
662876 crowdCB.addItemListener(this);
....@@ -673,6 +887,8 @@
673887 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
674888 // speakerMocapCB.addItemListener(this);
675889
890
+ panel.Return();
891
+
676892 if (false)
677893 {
678894 // handled in scripts
....@@ -687,32 +903,72 @@
687903 //constraints.gridy += 1;
688904 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
689905 smoothfocusCB.addItemListener(this);
906
+ panel.Return();
690907 }
691908
692909 //constraints.gridx += 1;
693910 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
694911 // debugCB.addItemListener(this);
695912
913
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
914
+ trackCB.setToolTipText("Enable tracking target");
915
+ trackCB.addItemListener(this);
916
+
696917 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
918
+ oeilCB.setToolTipText("Move camera when tracking");
697919 oeilCB.addItemListener(this);
698920
921
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
922
+ shadowCB.setToolTipText("Compute shadows when live");
923
+ shadowCB.addItemListener(this);
924
+
925
+ panel.Return();
926
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
927
+ toggleTextureCB.setToolTipText("Load textures");
928
+ toggleTextureCB.addItemListener(this);
929
+
930
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
931
+ toggleSwitchCB.setToolTipText("Use switch");
932
+ toggleSwitchCB.addItemListener(this);
933
+
934
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
935
+ autosaveCB.setToolTipText("Auto-save on structure change");
936
+ autosaveCB.addItemListener(this);
937
+
938
+ panel.Return();
939
+ if (Globals.ADVANCED)
940
+ {
699941 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
700942 lookAtCB.setToolTipText("Look-at target");
701943 lookAtCB.addItemListener(this);
944
+ }
702945
703946 }
704947
705948 cGridBag fill = new cGridBag();
706
-
707949 fill.preferredHeight = 200;
950
+ cGridBag fill2 = new cGridBag();
951
+ fill2.preferredHeight = 200;
952
+ cGridBag fill3 = new cGridBag();
953
+ fill3.preferredHeight = 200;
708954
709955 panel.add(fill);
956
+ panel.add(fill2);
957
+ panel.add(fill3);
710958
711959 }
712960
713961 void EditObject(Object3D obj)
714962 {
715963 cRadio radioButton = new cRadio(obj.name);
964
+
965
+ // Patch to avoid bug with transparency.
966
+ radioButton.hadMaterial = obj.material != null;
967
+ if (!radioButton.hadMaterial)
968
+ {
969
+ obj.material = new cMaterial();
970
+ }
971
+
716972 radioButton.SetObject(obj);
717973 radioButton.layout = sevenButton;
718974 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -721,8 +977,11 @@
721977 buttonGroup.add(radioButton);
722978 radioButton.doClick();
723979 }
980
+
724981 void SetupViews(ObjEditor oe)
725982 {
983
+ theFrame = this;
984
+
726985 oe.SetupViews();
727986
728987 System.out.println("SetupViews");
....@@ -731,23 +990,27 @@
731990 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
732991 }
733992
734
- JCheckBox liveCB;
735
- JCheckBox supportCB;
736
- JCheckBox localCB;
737
- JCheckBox crowdCB;
738
- JCheckBox smoothCB;
739
- JCheckBox fastCB;
740
- JCheckBox slowCB;
741
- JCheckBox boxCB;
742
- JCheckBox zoomBoxCB;
743
- JCheckBox trackCB;
744
- JCheckBox smoothfocusCB;
993
+ cToggleButton liveCB;
994
+ cCheckBox supportCB;
995
+ cCheckBox localCB;
996
+ cCheckBox crowdCB;
997
+ cCheckBox smoothCB;
998
+ cToggleButton fastCB;
999
+ cCheckBox slowCB;
1000
+ cCheckBox boxCB;
1001
+ cCheckBox zoomBoxCB;
1002
+ //cToggleButton trackCB;
1003
+ cCheckBox trackCB;
1004
+ cCheckBox smoothfocusCB;
7451005 // JCheckBox speakerMocapCB;
746
- JCheckBox speakerCameraCB;
747
- JCheckBox speakerFocusCB;
748
- JCheckBox debugCB;
749
- JCheckBox oeilCB;
750
- JCheckBox lookAtCB;
1006
+ cCheckBox speakerCameraCB;
1007
+ cCheckBox speakerFocusCB;
1008
+ cCheckBox debugCB;
1009
+
1010
+ cCheckBox oeilCB;
1011
+ cCheckBox shadowCB;
1012
+ cCheckBox autosaveCB;
1013
+ cCheckBox lookAtCB;
7511014
7521015 // static int COLOR = 1;
7531016 // static int MATERIAL = 2;
....@@ -755,9 +1018,9 @@
7551018
7561019 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7571020
758
- JCheckBox colorCB;
759
- JCheckBox materialCB;
760
- JCheckBox textureCB;
1021
+ cCheckBox colorCB;
1022
+ cCheckBox materialCB;
1023
+ cCheckBox textureCB;
7611024
7621025 public void itemStateChanged(ItemEvent e)
7631026 {
....@@ -785,6 +1048,7 @@
7851048 } else if(e.getSource() == liveCB)
7861049 {
7871050 cameraView.ToggleLive();
1051
+ refreshContents(false);
7881052 }
7891053 else if(e.getSource() == supportCB)
7901054 {
....@@ -849,6 +1113,14 @@
8491113 {
8501114 cameraView.ToggleOeil();
8511115 }
1116
+ else if(e.getSource() == shadowCB)
1117
+ {
1118
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1119
+ }
1120
+ else if(e.getSource() == autosaveCB)
1121
+ {
1122
+ Globals.SAVEONMAKE ^= true;
1123
+ }
8521124 else if(e.getSource() == lookAtCB)
8531125 {
8541126 cameraView.ToggleLookAt();
....@@ -865,7 +1137,8 @@
8651137
8661138 /**/
8671139 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
868
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1140
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1141
+ TreePath path = objEditor.jTree.getSelectionPath();
8691142 if ((path == null) || (path.getPathCount() <= 1)) {
8701143 // We can't move the root node or an empty selection
8711144 return;
....@@ -937,7 +1210,9 @@
9371210 // objEditor.DropFile((java.io.File[]) object, true);
9381211 // return;
9391212 // }
940
- if (string.charAt(0) == '/')
1213
+
1214
+ // File path for Mac and Windows
1215
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9411216 {
9421217 // file(s)
9431218 String[] names = string.split("\n");
....@@ -964,7 +1239,7 @@
9641239
9651240 flashIt = false;
9661241 CameraPane pane = (CameraPane) target;
967
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1242
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9681243 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9691244
9701245 if (group.selection.size() == 1)
....@@ -980,23 +1255,33 @@
9801255
9811256 assert target == objEditor.jTree;
9821257 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1258
+ Object3D destinationLeaf;
9831259 try {
984
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1260
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9851261 } catch (Exception e) {
9861262 System.out.println("destinationPath : " + destinationPath);
9871263 return;
9881264 }
9891265
990
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1266
+ for (int i=group.selection.size(); --i>=0;)
9911267 {
1268
+ Object3D child = (Object3D)group.selection.elementAt(i);
1269
+
1270
+ // Cannot move into itself
1271
+ if (child == destinationLeaf)
1272
+ return;
1273
+ }
1274
+
1275
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1276
+// {
9921277 loadClipboard(true);
9931278 objEditor.jTree.setSelectionPath(destinationPath);
9941279 pasteInto(false, false);
995
- } else {
996
- loadClipboard(false);
997
- objEditor.jTree.setSelectionPath(destinationPath);
998
- pasteInto(false, false); // true); // ???
999
- }
1280
+// } else {
1281
+// loadClipboard(false);
1282
+// objEditor.jTree.setSelectionPath(destinationPath);
1283
+// pasteInto(false, false); // true); // ???
1284
+// }
10001285 }
10011286 public void dropActionChanged(DropTargetDragEvent dtde)
10021287 // Called if the user has modified the current drop gesture
....@@ -1101,22 +1386,30 @@
11011386 {
11021387 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11031388 //heightFieldItem.addActionListener(this);
1104
- gridItem = menu.add(new MenuItem("Grid"));
1105
- gridItem.addActionListener(this);
1106
- rectoidItem = menu.add(new MenuItem("Box"));
1107
- rectoidItem.addActionListener(this);
1108
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1109
- ellipsoidItem.addActionListener(this);
1110
- coneItem = menu.add(new MenuItem("Cone"));
1111
- coneItem.addActionListener(this);
1112
- torusItem = menu.add(new MenuItem("Torus"));
1113
- torusItem.addActionListener(this);
1114
- superItem = menu.add(new MenuItem("Superellipsoid"));
1115
- superItem.addActionListener(this);
1389
+// gridItem = menu.add(new MenuItem("Grid"));
1390
+// gridItem.addActionListener(this);
1391
+// rectoidItem = menu.add(new MenuItem("Box"));
1392
+// rectoidItem.addActionListener(this);
1393
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1394
+// ellipsoidItem.addActionListener(this);
1395
+// coneItem = menu.add(new MenuItem("Cone"));
1396
+// coneItem.addActionListener(this);
1397
+// torusItem = menu.add(new MenuItem("Torus"));
1398
+// torusItem.addActionListener(this);
1399
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1400
+// superItem.addActionListener(this);
1401
+
1402
+ cameraItem = menu.add(new MenuItem("Camera"));
1403
+ cameraItem.addActionListener(this);
1404
+
1405
+ if (!Globals.ADVANCED)
1406
+ {
11161407 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11171408 kleinItem.addActionListener(this);
1118
- particleItem = menu.add(new MenuItem("Particle system"));
1119
- particleItem.addActionListener(this);
1409
+ }
1410
+
1411
+// particleItem = menu.add(new MenuItem("Particle system"));
1412
+// particleItem.addActionListener(this);
11201413 if (Globals.ADVANCED)
11211414 {
11221415 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1142,15 +1435,15 @@
11421435 }
11431436 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11441437 bezierItem.addActionListener(this);
1145
- overlayItem = menu.add(new MenuItem("Overlay"));
1146
- overlayItem.addActionListener(this);
1147
- lightItem = menu.add(new MenuItem("Light"));
1148
- lightItem.addActionListener(this);
1438
+// overlayItem = menu.add(new MenuItem("Overlay"));
1439
+// overlayItem.addActionListener(this);
1440
+// lightItem = menu.add(new MenuItem("Light"));
1441
+// lightItem.addActionListener(this);
11491442 menu.add("-");
11501443 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11511444 //superLoopItem.addActionListener(this);
1152
- loopItem = menu.add(new MenuItem("Loop"));
1153
- loopItem.addActionListener(this);
1445
+// loopItem = menu.add(new MenuItem("Loop"));
1446
+// loopItem.addActionListener(this);
11541447 doubleItem = menu.add(new MenuItem("Fork"));
11551448 doubleItem.addActionListener(this);
11561449 if (Globals.ADVANCED)
....@@ -1190,7 +1483,7 @@
11901483 memoryItem.addActionListener(this);
11911484 menu.add(analyzeItem = new MenuItem("Analyze"));
11921485 analyzeItem.addActionListener(this);
1193
- menu.add(dumpItem = new MenuItem("Dump"));
1486
+ menu.add(dumpItem = new MenuItem("Print"));
11941487 dumpItem.addActionListener(this);
11951488 // menu.add(pathItem = new MenuItem("From-to path"));
11961489 // pathItem.addActionListener(this);
....@@ -1331,6 +1624,7 @@
13311624 shadow.material = new cMaterial(obj.material);
13321625 shadow.material.diffuse = 0.0001f;
13331626 shadow.material.specular = 0.0001f;
1627
+ //shadow.projectedVertices[1].x = 300;
13341628
13351629 makeSomething(shadow);
13361630 }
....@@ -1537,9 +1831,9 @@
15371831
15381832 void Overwrite(int mask)
15391833 {
1540
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1834
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15411835 {
1542
- Object3D content = GrafreeD.clipboard.get(0);
1836
+ Object3D content = Grafreed.clipboard.get(0);
15431837
15441838 if (content instanceof cGroup && ((cGroup)content).transientlink )
15451839 content = ((cGroup)content).get(0);
....@@ -1578,7 +1872,7 @@
15781872 {
15791873 ScreenFit();
15801874 } else
1581
- if (source == switchItem)
1875
+ if (source == switchViewItem)
15821876 {
15831877 cVector v1 = new cVector();
15841878 cVector v2 = new cVector();
....@@ -1587,11 +1881,11 @@
15871881 objEditor.cameraView.renderCamera.setAim(v2, v1);
15881882 objEditor.cameraView.repaint();
15891883 } else
1590
- if (source == rectoidItem)
1884
+ if (source == rectoidItem || source == boxButton)
15911885 {
15921886 makeSomething(new Box());
15931887 } else
1594
- if (source == particleItem)
1888
+ if (source == particleItem || source == particlesButton)
15951889 {
15961890 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15971891 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1670,27 +1964,27 @@
16701964
16711965 makeSomething(obj);
16721966 } else
1673
- if (source == gridItem)
1967
+ if (source == gridItem || source == gridButton)
16741968 {
16751969 makeSomething(new Grid());
16761970 } else
1677
- if (source == ellipsoidItem)
1971
+ if (source == ellipsoidItem || source == sphereButton)
16781972 {
16791973 makeSomething(new Sphere());
16801974 } else
1681
- if (source == coneItem)
1975
+ if (source == coneItem || source == coneButton)
16821976 {
16831977 makeSomething(new Cone());
16841978 } else
1685
- if (source == torusItem)
1979
+ if (source == torusItem || source == torusButton)
16861980 {
16871981 makeSomething(new Torus());
16881982 } else
1689
- if (source == superItem)
1983
+ if (source == superItem || source == superButton)
16901984 {
16911985 makeSomething(new Superellipsoid());
16921986 } else
1693
- if (source == kleinItem)
1987
+ if (source == kleinItem || source == kleinButton)
16941988 {
16951989 makeSomething(new Klein());
16961990 } else
....@@ -1710,7 +2004,7 @@
17102004 {
17112005 makeSomething(new BezierSurface());
17122006 } else
1713
- if (source == overlayItem)
2007
+ if (source == overlayItem || source == overlayButton)
17142008 {
17152009 /*
17162010 Object3D obj = new BezierSurface(5,8);
....@@ -1758,7 +2052,7 @@
17582052 s.setup();
17592053 makeSomething(s);
17602054 } else
1761
- if (source == lightItem)
2055
+ if (source == lightItem || source == lightButton)
17622056 {
17632057 makeSomething(new Light());
17642058 } else
....@@ -1808,7 +2102,7 @@
18082102
18092103 group(g);
18102104 } else
1811
- if (source == loopItem)
2105
+ if (source == loopItem || source == loopButton)
18122106 {
18132107 Composite csg = new GroupLeaf();
18142108 csg.count = 5;
....@@ -1844,23 +2138,6 @@
18442138 csg.addChild(child);
18452139 child.addChild(csg);
18462140 } else
1847
-
1848
- if (source == importGFDItem)
1849
- {
1850
- ImportGFD();
1851
- } else
1852
- if (source == importVRMLX3DItem)
1853
- {
1854
- ImportVRMLX3D();
1855
- } else
1856
- if (source == import3DSItem)
1857
- {
1858
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1859
- } else
1860
- if (source == importOBJItem)
1861
- {
1862
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1863
- } else
18642141 if (source == computeAOItem)
18652142 {
18662143 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1879,7 +2156,7 @@
18792156 if (source == invariantsItem)
18802157 {
18812158 System.out.println("Invariants:");
1882
- GrafreeD.grafreeD.universe.invariants();
2159
+ Grafreed.grafreeD.universe.invariants();
18832160 } else
18842161 if (source == memoryItem)
18852162 {
....@@ -1897,6 +2174,30 @@
18972174 if (source == dumpItem)
18982175 {
18992176 DumpObject();
2177
+ } else
2178
+ if (source == minButton)
2179
+ {
2180
+ Minimize();
2181
+ } else
2182
+ if (source == maxButton)
2183
+ {
2184
+ Maximize();
2185
+ } else
2186
+ if (source == fullButton)
2187
+ {
2188
+ ToggleFullScreen();
2189
+ } else
2190
+ if (source == undoButton)
2191
+ {
2192
+ Undo();
2193
+ } else
2194
+ if (source == redoButton)
2195
+ {
2196
+ Redo();
2197
+ } else
2198
+ if (source == saveButton)
2199
+ {
2200
+ Save();
19002201 } else
19012202 if (source == oneStepButton)
19022203 {
....@@ -1952,12 +2253,20 @@
19522253 {
19532254 loadClipboard(true);
19542255 } else
2256
+ if (source == undoItem)
2257
+ {
2258
+ Undo();
2259
+ } else
2260
+ if (source == redoItem)
2261
+ {
2262
+ Redo();
2263
+ } else
19552264 if (source == duplicateItem)
19562265 {
1957
- Object3D keep = GrafreeD.clipboard;
2266
+ Object3D keep = Grafreed.clipboard;
19582267 loadClipboard(false);
19592268 paste(false);
1960
- GrafreeD.clipboard = keep;
2269
+ Grafreed.clipboard = keep;
19612270 } else
19622271 if (source == cloneItem)
19632272 {
....@@ -2177,9 +2486,9 @@
21772486 // group.selection.get(0).setMasterThis(content); // should be identity
21782487 // refreshContents();
21792488 // }
2180
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2489
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21812490 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2491
+ Object3D content = Grafreed.clipboard.get(0);
21832492
21842493 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852494 content = ((cGroup)content).get(0);
....@@ -2229,9 +2538,9 @@
22292538 } else
22302539 if (source == setMasterItem)
22312540 {
2232
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2541
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22332542 {
2234
- Object3D content = GrafreeD.clipboard.get(0);
2543
+ Object3D content = Grafreed.clipboard.get(0);
22352544
22362545 if (content instanceof cGroup && ((cGroup)content).transientlink )
22372546 content = ((cGroup)content).get(0);
....@@ -2244,9 +2553,9 @@
22442553 {
22452554 if (group.selection.size() == 1)
22462555 {
2247
- if (GrafreeD.clipboard.size() == 1)
2556
+ if (Grafreed.clipboard.size() == 1)
22482557 {
2249
- Object3D content = GrafreeD.clipboard.get(0);
2558
+ Object3D content = Grafreed.clipboard.get(0);
22502559
22512560 if (content instanceof cGroup && ((cGroup)content).transientlink )
22522561 content = ((cGroup)content).get(0);
....@@ -2263,7 +2572,7 @@
22632572 {
22642573 RevertMeshes();
22652574 } else
2266
- if (source == resetMeshItem)
2575
+ if (source == resetAllItem)
22672576 {
22682577 ResetAll();
22692578 } else
....@@ -2283,9 +2592,9 @@
22832592 {
22842593 ClearSelection(true);
22852594 } else
2286
- if (source == grabItem)
2595
+ if (source == grabItem || source == groupButton)
22872596 {
2288
- group(new cGroup(), true);
2597
+ group(new cGroup(), false); // true);
22892598 } else
22902599 if (source == hideItem)
22912600 {
....@@ -2303,11 +2612,11 @@
23032612 {
23042613 makeSomething(new Camera());
23052614 } else
2306
- if (source == compositeItem)
2615
+ if (source == compositeItem || source == compositeButton)
23072616 {
23082617 group(new Composite());
23092618 } else
2310
- if (source == randomItem)
2619
+ if (source == switchItem || source == switchButton)
23112620 {
23122621 RandomNode random = new RandomNode();
23132622 group(random);
....@@ -2409,7 +2718,7 @@
24092718 {
24102719 group(new cLinker());
24112720 } else
2412
- if (source == textureItem)
2721
+ if (source == textureItem || source == textureButton)
24132722 {
24142723 group(new TextureNode());
24152724 } else
....@@ -2429,7 +2738,7 @@
24292738 {
24302739 CastShadow(2);
24312740 } else
2432
- if (source == ungroupItem)
2741
+ if (source == ungroupItem || source == ungroupButton)
24332742 {
24342743 //ungroup();
24352744 for (int i=0; i<group.selection.size(); i++)
....@@ -2451,7 +2760,7 @@
24512760 } else
24522761 if (source == genNormalsMESHItem)
24532762 {
2454
- GenNormals(true); // TODO
2763
+ GenNormalsMESH();
24552764 } else
24562765 if (source == genNormalsORGANItem)
24572766 {
....@@ -2516,6 +2825,22 @@
25162825 if (source == unmarkleavesItem)
25172826 {
25182827 MarkLeaves(false);
2828
+ } else
2829
+ if (source == rewindleavesItem)
2830
+ {
2831
+ RewindLeaves(true);
2832
+ } else
2833
+ if (source == unrewindleavesItem)
2834
+ {
2835
+ RewindLeaves(false);
2836
+ } else
2837
+ if (source == randomleavesItem)
2838
+ {
2839
+ RandomLeaves(true);
2840
+ } else
2841
+ if (source == unrandomleavesItem)
2842
+ {
2843
+ RandomLeaves(false);
25192844 } else
25202845 if (source == flipVItem)
25212846 {
....@@ -2601,9 +2926,13 @@
26012926 {
26022927 SmoothMesh();
26032928 } else
2604
- if (source == transformgeometryItem)
2929
+ if (source == transformGeometryItem)
26052930 {
26062931 TransformGeometry();
2932
+ } else
2933
+ if (source == transformChildrenItem)
2934
+ {
2935
+ TransformChildren();
26072936 } else
26082937 if (source == resetTransformItem)
26092938 {
....@@ -2611,7 +2940,11 @@
26112940 } else
26122941 if (source == resetCentroidItem)
26132942 {
2614
- ResetCentroid();
2943
+ ResetCentroid(true);
2944
+ } else
2945
+ if (source == resetCentroidXZItem)
2946
+ {
2947
+ ResetCentroid(false);
26152948 } else
26162949 if (source == resetParentItem)
26172950 {
....@@ -2743,6 +3076,10 @@
27433076 if (source == twoButton)
27443077 {
27453078 radio.layout = twoButton;
3079
+
3080
+ if (CameraPane.FULLSCREEN)
3081
+ fullscreenLayout = radio.layout;
3082
+
27463083 // bug
27473084 //gridPanel.setDividerLocation(1.0);
27483085 //bigPanel.setDividerLocation(0.0);
....@@ -2775,10 +3112,31 @@
27753112 bigThree.ClearUI();
27763113 bigThree.add(centralPanel);
27773114 bigThree.FlushUI();
3115
+
3116
+ cameraView.requestFocusInWindow();
3117
+
3118
+// refreshContents(true);
3119
+//
3120
+// try
3121
+// {
3122
+// java.awt.Robot bot = new java.awt.Robot();
3123
+// int mask = InputEvent.BUTTON1_MASK;
3124
+// bot.mouseMove(100, 100);
3125
+// bot.mousePress(mask);
3126
+// bot.mouseRelease(mask);
3127
+// }
3128
+// catch (Exception e)
3129
+// {
3130
+//
3131
+// }
3132
+
27783133 } else
27793134 if (source == threeButton)
27803135 {
27813136 radio.layout = threeButton;
3137
+
3138
+ if (CameraPane.FULLSCREEN)
3139
+ fullscreenLayout = radio.layout;
27823140
27833141 // bigThree.remove(scenePanel);
27843142 // bigThree.remove(centralPanel);
....@@ -2811,10 +3169,15 @@
28113169 bigThree.add(centralPanel);
28123170 bigThree.add(XYZPanel);
28133171 bigThree.FlushUI();
3172
+
3173
+ cameraView.requestFocusInWindow();
28143174 } else
28153175 if (source == fourButton)
28163176 {
28173177 radio.layout = fourButton;
3178
+
3179
+ if (CameraPane.FULLSCREEN)
3180
+ fullscreenLayout = radio.layout;
28183181
28193182 // bigThree.remove(scenePanel);
28203183 // bigThree.remove(centralPanel);
....@@ -2846,10 +3209,15 @@
28463209 bigThree.ClearUI();
28473210 bigThree.add(scenePanel);
28483211 bigThree.FlushUI();
3212
+
3213
+ cameraView.requestFocusInWindow();
28493214 } else
28503215 if (source == sixButton)
28513216 {
28523217 radio.layout = sixButton;
3218
+
3219
+ if (CameraPane.FULLSCREEN)
3220
+ fullscreenLayout = radio.layout;
28533221
28543222 // bigThree.remove(scenePanel);
28553223 // bigThree.remove(centralPanel);
....@@ -2882,10 +3250,15 @@
28823250 bigThree.add(scenePanel);
28833251 bigThree.add(centralPanel);
28843252 bigThree.FlushUI();
3253
+
3254
+ cameraView.requestFocusInWindow();
28853255 } else
28863256 if (source == sevenButton)
28873257 {
28883258 radio.layout = sevenButton;
3259
+
3260
+ if (CameraPane.FULLSCREEN)
3261
+ fullscreenLayout = radio.layout;
28893262
28903263 // bigThree.remove(scenePanel);
28913264 // bigThree.remove(centralPanel);
....@@ -2919,6 +3292,8 @@
29193292 bigThree.add(centralPanel);
29203293 bigThree.add(XYZPanel);
29213294 bigThree.FlushUI();
3295
+
3296
+ cameraView.requestFocusInWindow();
29223297 } else
29233298 if (source == rootButton)
29243299 {
....@@ -2930,6 +3305,7 @@
29303305 EditObject(obj);
29313306 }
29323307
3308
+ cameraView.requestFocusInWindow();
29333309 refreshContents(true);
29343310 } else
29353311 if (source == closeButton)
....@@ -2939,22 +3315,37 @@
29393315 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29403316 {
29413317 ab = (cRadio)e.nextElement();
2942
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3318
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29433319 {
3320
+ // Patch to avoid bug with transparency.
3321
+ if (!ab.hadMaterial)
3322
+ {
3323
+ ab.object.material = null;
3324
+ }
3325
+
29443326 buttonGroup.remove(ab);
29453327 radioPanel.remove(ab);
29463328
2947
- ab.GetObject().editWindow = null;
3329
+ //ab.GetObject().editWindow = null;
3330
+ ab.GetObject().manipWindow = null;
29483331 // ab.GetObject().objectUI = null; // ?????????
29493332
29503333 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29513334 break;
29523335 }
29533336 }
3337
+
3338
+ cameraView.requestFocusInWindow();
29543339 refreshContents(true);
29553340 } else
29563341 if (source == editItem || source == editButton)
29573342 {
3343
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3344
+ {
3345
+ Object3D child = (Object3D)e.nextElement();
3346
+ child.pinned = true;
3347
+ }
3348
+
29583349 EditSelection(false);
29593350 } else
29603351 if (source == uneditButton)
....@@ -2964,10 +3355,11 @@
29643355 Object3D child = (Object3D)e.nextElement();
29653356 if(child.editWindow != null)
29663357 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3358
+ child.pinned = false;
29673359 child.CloseUI();
29683360 listUI.remove(child);
29693361
2970
- child.editWindow = null; // ???????????
3362
+ //child.editWindow = null; // ???????????
29713363 }
29723364 objEditor.ctrlPanel.FlushUI();
29733365 //objEditor.jTree.clearSelection();
....@@ -2980,6 +3372,7 @@
29803372 //copy.ClearUI();
29813373 for (Object3D obj : listUI)
29823374 {
3375
+ obj.pinned = true;
29833376 obj.CloseUI();
29843377 }
29853378 listUI.clear();
....@@ -2989,7 +3382,7 @@
29893382 {
29903383 assert(copy == group);
29913384
2992
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3385
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29933386
29943387 for (Object3D obj : listUI)
29953388 {
....@@ -3053,7 +3446,11 @@
30533446 frontView.object = group;
30543447 sideView.object = group;
30553448 }
3056
- group.editWindow = this;
3449
+
3450
+// fix "+" issue
3451
+ //group.editWindow = this;
3452
+ group.manipWindow = this;
3453
+
30573454 /*
30583455 currentLayout = radio.layout;
30593456 if (currentLayout == null)
....@@ -3065,8 +3462,23 @@
30653462 //group.parent = null; // ROOT
30663463 //group.attributes = -1;
30673464 ResetModel();
3465
+
3466
+ cameraView.requestFocusInWindow();
30683467 refreshContents(true);
3069
- }
3468
+ } else if (event.getSource() == editCameraItem)
3469
+ {
3470
+ cameraView.ProtectCamera();
3471
+ cameraView.repaint();
3472
+ return;
3473
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3474
+ {
3475
+ cameraView.RevertCamera();
3476
+ cameraView.repaint();
3477
+ return;
3478
+ // } else if (event.getSource() == textureButton)
3479
+ // {
3480
+ // return; // true;
3481
+ }
30703482 else
30713483 {
30723484 //return super.action(event, arg);
....@@ -3075,7 +3487,6 @@
30753487 }
30763488
30773489 boolean useclient = false;
3078
- cRadio radio;
30793490
30803491 void ToggleRoot()
30813492 {
....@@ -3127,6 +3538,28 @@
31273538 refreshContents();
31283539 }
31293540
3541
+ void TransformChildren()
3542
+ {
3543
+ Object3D obj;
3544
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3545
+ {
3546
+ obj = (Object3D)e.nextElement();
3547
+ obj.KeepTextureMatrices();
3548
+ obj.TransformChildren();
3549
+ obj.RestoreTextureMatrices();
3550
+
3551
+// if (obj.parent == null)
3552
+// {
3553
+// System.out.println("NULL PARENT!");
3554
+// new Exception().printStackTrace();
3555
+// }
3556
+// else
3557
+// TouchTransform(obj);
3558
+// //obj.parent.Touch();
3559
+ }
3560
+
3561
+ refreshContents();
3562
+ }
31303563
31313564 void ResetTransform()
31323565 {
....@@ -3239,7 +3672,7 @@
32393672 refreshContents();
32403673 }
32413674
3242
- void ResetCentroid()
3675
+ void ResetCentroid(boolean full)
32433676 {
32443677 Object3D obj;
32453678 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3254,12 +3687,16 @@
32543687 LA.matIdentity(Object3D.mat);
32553688 obj.getBounds(minima, maxima, false);
32563689 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3257
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3690
+ if (full)
3691
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32583692 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32593693 obj.TransformMesh(Object3D.mat);
3694
+
32603695 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3261
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3696
+ if (full)
3697
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32623698 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3699
+
32633700 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32643701 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32653702 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3288,7 +3725,8 @@
32883725
32893726 int size = obj.MemorySize();
32903727
3291
- System.err.println((size/1024) + " KB is the size of " + obj);
3728
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3729
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32923730 }
32933731 }
32943732 catch (Exception e)
....@@ -3325,9 +3763,9 @@
33253763 obj = (Object3D)e.nextElement();
33263764
33273765 System.out.println("Object is: " + obj);
3328
- GrafreeD.AnalyzeObject(obj);
3766
+ Grafreed.AnalyzeObject(obj);
33293767 System.out.println("Boundary rep: " + obj.bRep);
3330
- GrafreeD.AnalyzeObject(obj.bRep);
3768
+ Grafreed.AnalyzeObject(obj.bRep);
33313769
33323770 // System.err.println((size/1024) + " KB is the size of " + obj);
33333771 }
....@@ -3369,6 +3807,13 @@
33693807 void GenNormals(boolean crease)
33703808 {
33713809 group.GenNormalsS(crease);
3810
+
3811
+ refreshContents();
3812
+ }
3813
+
3814
+ void GenNormalsMESH()
3815
+ {
3816
+ group.GenNormalsMeshS();
33723817
33733818 refreshContents();
33743819 }
....@@ -3541,8 +3986,8 @@
35413986
35423987 void ParseVertices()
35433988 {
3544
- boolean epsequal = GrafreeD.epsequal;
3545
- GrafreeD.epsequal = true;
3989
+ boolean epsequal = Grafreed.epsequal;
3990
+ Grafreed.epsequal = true;
35463991
35473992 for (int i=0; i<group.selection.size(); i++)
35483993 {
....@@ -3567,7 +4012,7 @@
35674012 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35684013 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35694014
3570
- g.add(GrafreeD.clipboard);
4015
+ g.add(Grafreed.clipboard);
35714016
35724017 buffer.add(g);
35734018 }
....@@ -3582,7 +4027,7 @@
35824027 makeSomething(buffer, i==group.selection.size()-1);
35834028 }
35844029
3585
- GrafreeD.epsequal = epsequal;
4030
+ Grafreed.epsequal = epsequal;
35864031
35874032 refreshContents();
35884033 }
....@@ -3600,7 +4045,16 @@
36004045 String pigment = Object3D.GetPigment(tex);
36014046 //String bump = Object3D.GetBump(tex);
36024047
3603
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4048
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4049
+
4050
+ try
4051
+ {
4052
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4053
+ }
4054
+ catch (Exception e)
4055
+ {
4056
+ System.err.println("FAIL: " + node);
4057
+ }
36044058
36054059 double s = v.s;
36064060
....@@ -3732,7 +4186,7 @@
37324186 return;
37334187
37344188 Object3D poses = group.selection.get(0);
3735
- Object3D ref = GrafreeD.clipboard.get(0);
4189
+ Object3D ref = Grafreed.clipboard.get(0);
37364190
37374191 Object3D newgroup = new Object3D("Po:" + poses.name);
37384192
....@@ -3926,9 +4380,9 @@
39264380
39274381 void ClipMesh()
39284382 {
3929
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4383
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39304384 {
3931
- Object3D content = GrafreeD.clipboard.get(0);
4385
+ Object3D content = Grafreed.clipboard.get(0);
39324386
39334387 if (content instanceof cGroup && ((cGroup)content).transientlink )
39344388 content = ((cGroup)content).get(0);
....@@ -3937,7 +4391,7 @@
39374391 // {
39384392 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39394393 // }
3940
- group.selection.ClipMesh(GrafreeD.clipboard);
4394
+ group.selection.ClipMesh(Grafreed.clipboard);
39414395 }
39424396 // group.selection.ClipMesh(GrafreeD.clipboard);
39434397 System.out.println("DONE.");
....@@ -3984,6 +4438,18 @@
39844438 void MarkLeaves(boolean hide)
39854439 {
39864440 group.selection.MarkLeaves(hide);
4441
+ refreshContents();
4442
+ }
4443
+
4444
+ void RewindLeaves(boolean hide)
4445
+ {
4446
+ group.selection.RewindLeaves(hide);
4447
+ refreshContents();
4448
+ }
4449
+
4450
+ void RandomLeaves(boolean hide)
4451
+ {
4452
+ group.selection.RandomLeaves(hide);
39874453 refreshContents();
39884454 }
39894455
....@@ -4058,10 +4524,6 @@
40584524 // }
40594525 // }
40604526
4061
- static boolean allparams = true;
4062
-
4063
- static Vector<Object3D> listUI = new Vector<Object3D>();
4064
-
40654527 void EditSelection(boolean newWindow)
40664528 {
40674529 // aConstraints.gridy = 0;
....@@ -4069,10 +4531,10 @@
40694531 {
40704532 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40714533 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4072
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4534
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40734535
40744536 Object3D elem = (Object3D)group.selection.elementAt(i);
4075
- if(elem != group)
4537
+ if(elem != group || !newWindow)
40764538 {
40774539 // if (!(elem instanceof Composite))
40784540 // newWindow = false;
....@@ -4155,6 +4617,17 @@
41554617
41564618 freezemodel = true;
41574619
4620
+ //for (Object3D obj : listUI)
4621
+ for (int i=listUI.size(); --i>=0;)
4622
+ {
4623
+ Object3D obj = listUI.elementAt(i);
4624
+ if (!obj.pinned)
4625
+ {
4626
+ obj.CloseUI();
4627
+ listUI.remove(i);
4628
+ }
4629
+ }
4630
+
41584631 /**/
41594632 //switch (event.id)
41604633 {
....@@ -4162,7 +4635,6 @@
41624635 //case 702: // Event.LIST_DESELECT
41634636 group.deselectAll();
41644637 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4165
- objEditor.ClearInfo(); // .GetMaterial());
41664638 if (tps != null)
41674639 {
41684640 for (int i=0; i < tps.length; i++)
....@@ -4171,10 +4643,8 @@
41714643
41724644 //if (child.parent != null)
41734645 //child.parent.addSelectee(child);
4646
+ objEditor.SetMaterial(child);
41744647 group.addSelectee(child);
4175
- objEditor.SetMaterial(child); // .GetMaterial());
4176
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4177
- System.err.println("info : " + child.GetPath());
41784648 }
41794649 }
41804650 // else
....@@ -4184,20 +4654,28 @@
41844654 // System.err.println("info : " + group.GetPath());
41854655 // }
41864656
4187
- objEditor.SetText(); // jan 2014
4188
-
4189
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4657
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41904658 CameraPane.flash = true;
41914659
4192
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4660
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41934661 // a camera
41944662 {
4195
- CameraPane.camerachangeframe = 0; // don't refuse it
4196
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4663
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4664
+ {
4665
+ CameraPane.camerachangeframe = 0; // don't refuse it
4666
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4667
+ }
41974668 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41984669 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41994670 }
42004671
4672
+ if (tps != null && tps.length == 1)
4673
+ {
4674
+ EditSelection(false);
4675
+ }
4676
+
4677
+ SetPinStates(tps != null && tps.length > 0);
4678
+
42014679 refreshContents();
42024680 //return true;
42034681 }
....@@ -4206,6 +4684,33 @@
42064684
42074685 freezemodel = false;
42084686 }
4687
+
4688
+ void SetPinStates(boolean enabled)
4689
+ {
4690
+ editButton.setEnabled(enabled);
4691
+ uneditButton.setEnabled(enabled);
4692
+ }
4693
+
4694
+ void refreshContents(boolean cp)
4695
+ {
4696
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4697
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4698
+ {
4699
+ objEditor.ClearInfo(); // .GetMaterial());
4700
+
4701
+ for (int i=0; i < group.selection.Size(); i++)
4702
+ {
4703
+ Object3D child = (Object3D) group.selection.get(i);
4704
+
4705
+ objEditor.AddInfo(child, this, true);
4706
+ System.err.println("info : " + child.GetPath());
4707
+ }
4708
+
4709
+ objEditor.SetText(); // jan 2014
4710
+ }
4711
+
4712
+ super.refreshContents(cp);
4713
+ }
42094714
42104715 void linkSomething(Object3D thing)
42114716 {
....@@ -4277,16 +4782,19 @@
42774782 {
42784783 if (group.selection.isEmpty())
42794784 return;
4280
- GrafreeD.clipboardIsTempGroup = false;
4785
+
4786
+ Grafreed.clipboardIsTempGroup = false;
42814787 Composite tGroup = null;
42824788 if (group.selection.size() > 0) // 1)
42834789 {
42844790 tGroup = new cGroup();
4285
- GrafreeD.clipboardIsTempGroup = true;
4791
+ Grafreed.clipboardIsTempGroup = true;
42864792 }
42874793
42884794 if (cut)
42894795 {
4796
+ if (Globals.SAVEONMAKE)
4797
+ Save();
42904798 //int indices[] = jList.getSelectedIndices();
42914799 //for (int i = indices.length - 1; i >= 0; i--)
42924800 //jList.remove(indices[i]);
....@@ -4322,16 +4830,16 @@
43224830 //System.out.println("cut " + child);
43234831 //System.out.println("parent = " + child.parent);
43244832 // tmp.addChild(child);
4325
- if (GrafreeD.clipboardIsTempGroup)
4833
+ if (Grafreed.clipboardIsTempGroup)
43264834 tGroup.add/*Child*/(tmp);
43274835 else
4328
- GrafreeD.clipboard = tmp;
4836
+ Grafreed.clipboard = tmp;
43294837 }
43304838 else
4331
- if (GrafreeD.clipboardIsTempGroup)
4839
+ if (Grafreed.clipboardIsTempGroup)
43324840 tGroup.add/*Child*/(child);
43334841 else
4334
- GrafreeD.clipboard = child;
4842
+ Grafreed.clipboard = child;
43354843 }
43364844
43374845 //ResetModel();
....@@ -4363,21 +4871,23 @@
43634871 //System.out.println("cut " + elem);
43644872 //System.out.println("parent = " + elem.parent);
43654873 // tmp.addChild(elem);
4366
- if (GrafreeD.clipboardIsTempGroup)
4874
+ if (Grafreed.clipboardIsTempGroup)
43674875 tGroup.add/*Child*/(tmp);
43684876 else
4369
- GrafreeD.clipboard = tmp;
4877
+ Grafreed.clipboard = tmp;
43704878 }
43714879 else
4372
- if (GrafreeD.clipboardIsTempGroup)
4880
+ if (Grafreed.clipboardIsTempGroup)
43734881 tGroup.add/*Child*/(child);
43744882 else
4375
- GrafreeD.clipboard = child;
4883
+ Grafreed.clipboard = child;
43764884 }
43774885
43784886 }
4379
- if (GrafreeD.clipboardIsTempGroup)
4380
- GrafreeD.clipboard = tGroup;
4887
+
4888
+ if (Grafreed.clipboardIsTempGroup)
4889
+ Grafreed.clipboard = tGroup;
4890
+
43814891 if (cut)
43824892 {
43834893 ResetModel();
....@@ -4391,7 +4901,7 @@
43914901 // return;
43924902 boolean first = true;
43934903
4394
- if (GrafreeD.clipboardIsTempGroup)
4904
+ if (Grafreed.clipboardIsTempGroup)
43954905 {
43964906 Composite temp;
43974907
....@@ -4402,7 +4912,7 @@
44024912 temp = (Composite)Applet3D.clipboard.deepCopy();
44034913 */
44044914 Object3D elem;
4405
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4915
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
44064916 {
44074917 Object3D child = (Object3D)e.nextElement();
44084918
....@@ -4436,14 +4946,14 @@
44364946 //Object3D cb = Applet3D.clipboard;
44374947 //temp.addChild(cb);
44384948 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4439
- assert(GrafreeD.clipboard.parent == null);
4440
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4441
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4442
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4443
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4949
+ assert(Grafreed.clipboard.parent == null);
4950
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4951
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4952
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4953
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44444954 else
4445
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4446
- GrafreeD.clipboard.get(0).parent = keepparent;
4955
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4956
+ Grafreed.clipboard.get(0).parent = keepparent;
44474957 }
44484958
44494959 ResetModel();
....@@ -4492,9 +5002,9 @@
44925002 {
44935003 boolean first = true;
44945004
4495
- if (GrafreeD.clipboardIsTempGroup)
5005
+ if (Grafreed.clipboardIsTempGroup)
44965006 {
4497
- Composite temp = (Composite)GrafreeD.clipboard;
5007
+ Composite temp = (Composite)Grafreed.clipboard;
44985008 Object3D copy;
44995009 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45005010 {
....@@ -4504,7 +5014,7 @@
45045014 }
45055015 } else
45065016 {
4507
- linkSomething(GrafreeD.clipboard); //.get(0));
5017
+ linkSomething(Grafreed.clipboard); //.get(0));
45085018 }
45095019 }
45105020 }
....@@ -4909,21 +5419,6 @@
49095419 }
49105420 */
49115421
4912
- void ImportGFD()
4913
- {
4914
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4915
- browser.show();
4916
- String filename = browser.getFile();
4917
- if (filename != null && filename.length() > 0)
4918
- {
4919
- String fullname = browser.getDirectory() + filename;
4920
-
4921
- //Object3D readobj =
4922
- objEditor.ReadGFD(fullname, objEditor);
4923
- //makeSomething(readobj);
4924
- }
4925
- }
4926
-
49275422 /*
49285423 public void Callback(Object obj)
49295424 {
....@@ -4947,26 +5442,9 @@
49475442 }
49485443 */
49495444
4950
- void ImportVRMLX3D()
4951
- {
4952
- if (GrafreeD.standAlone)
4953
- {
4954
- /**/
4955
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4956
- browser.show();
4957
- String filename = browser.getFile();
4958
- if (filename != null && filename.length() > 0)
4959
- {
4960
- String fullname = browser.getDirectory() + filename;
4961
- LoadVRMLX3D(fullname);
4962
- }
4963
- /**/
4964
- }
4965
- }
4966
-
49675445 String GetFile(String dialogName)
49685446 {
4969
- if (GrafreeD.standAlone)
5447
+ if (Grafreed.standAlone)
49705448 {
49715449 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49725450 browser.show();
....@@ -5034,7 +5512,31 @@
50345512 cButton clearpanelButton;
50355513 cButton unselectButton;
50365514
5515
+ cButton restoreCameraButton;
5516
+
5517
+ cButton minButton;
5518
+ cButton maxButton;
5519
+ cButton fullButton;
5520
+ cButton saveButton;
50375521 cButton oneStepButton;
5522
+
5523
+ cButton groupButton;
5524
+ cButton ungroupButton;
5525
+ cButton compositeButton;
5526
+ cButton switchButton;
5527
+ cButton loopButton;
5528
+ cButton textureButton;
5529
+
5530
+ cButton gridButton;
5531
+ cButton boxButton;
5532
+ cButton sphereButton;
5533
+ cButton coneButton;
5534
+ cButton torusButton;
5535
+ cButton superButton;
5536
+ cButton kleinButton;
5537
+ cButton particlesButton;
5538
+ cButton overlayButton;
5539
+ cButton lightButton;
50385540
50395541 cButton screenfitButton;
50405542 cButton screenfitpointButton;
....@@ -5047,14 +5549,6 @@
50475549
50485550 cButton setsupportButton;
50495551
5050
- cButton twoButton;
5051
- cButton sixButton;
5052
- cButton threeButton;
5053
- cButton sevenButton;
5054
- cButton fourButton; // full panel
5055
- cButton oneButton; // full XYZ
5056
- //cButton currentLayout;
5057
-
50585552 //
50595553 //Composite
50605554 Object3D // to do !!
....@@ -5064,9 +5558,11 @@
50645558 //JTree jTree;
50655559 private MenuItem lookAtItem;
50665560 private MenuItem lookFromItem;
5067
- private MenuItem switchItem;
5561
+ private MenuItem switchViewItem;
50685562 private MenuItem cutItem;
5069
- private MenuItem duplicateItem;
5563
+ private MenuItem undoItem;
5564
+ private MenuItem redoItem;
5565
+ private JMenuItem duplicateItem;
50705566 private MenuItem cloneItem;
50715567 private MenuItem cloneSupportItem;
50725568 private MenuItem overwriteGeoItem;
....@@ -5079,7 +5575,7 @@
50795575 private MenuItem linkverticesItem;
50805576 private MenuItem relinkverticesItem;
50815577 private MenuItem setMasterItem;
5082
- private MenuItem resetMeshItem;
5578
+ private MenuItem resetAllItem;
50835579 private MenuItem stepAllItem;
50845580 private MenuItem revertMeshItem;
50855581 private MenuItem poseMeshItem;
....@@ -5129,6 +5625,10 @@
51295625 private MenuItem showleavesItem;
51305626 private MenuItem markleavesItem;
51315627 private MenuItem unmarkleavesItem;
5628
+ private MenuItem rewindleavesItem;
5629
+ private MenuItem unrewindleavesItem;
5630
+ private MenuItem randomleavesItem;
5631
+ private MenuItem unrandomleavesItem;
51325632
51335633 private MenuItem flipVItem;
51345634 private MenuItem unflipVItem;
....@@ -5140,15 +5640,17 @@
51405640 private MenuItem panoTexturesItem;
51415641
51425642 private MenuItem resetCentroidItem;
5143
- private MenuItem transformgeometryItem;
5643
+ private MenuItem resetCentroidXZItem;
51445644 private MenuItem resetTransformItem;
5645
+ private MenuItem transformGeometryItem;
5646
+ private MenuItem transformChildrenItem;
51455647 private MenuItem hideItem;
51465648 private MenuItem grabItem;
51475649 private MenuItem backItem;
51485650 private MenuItem frontItem;
51495651 private MenuItem cameraItem;
51505652 private MenuItem compositeItem;
5151
- private MenuItem randomItem;
5653
+ private MenuItem switchItem;
51525654 private MenuItem physicsItem;
51535655 private MenuItem frameselectorItem;
51545656 private MenuItem scriptNodeItem;
....@@ -5210,11 +5712,6 @@
52105712 private MenuItem doubleItem;
52115713 private MenuItem tripleItem;
52125714
5213
- private MenuItem importGFDItem;
5214
- private MenuItem importVRMLX3DItem;
5215
- private MenuItem import3DSItem;
5216
- private MenuItem importOBJItem;
5217
-
52185715 private MenuItem computeAOItem;
52195716 private MenuItem recompileItem;
52205717 private MenuItem editScriptItem;
....@@ -5224,4 +5721,8 @@
52245721 private MenuItem analyzeItem;
52255722 private MenuItem dumpItem;
52265723 //boolean freezemodel = false;
5724
+
5725
+ Menu cameraMenu;
5726
+ MenuItem editCameraItem;
5727
+ MenuItem restoreCameraItem;
52275728 }