Normand Briere
2019-06-24 914255f70cf047897212839cbf3a6722703f4457
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,40 +148,35 @@
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
-
168153 Menu menu;
169154 oe.menuBar.add(menu = new Menu("Edit"));
170155 //editItem = menu.add(new MenuItem("Edit"));
171156 //editItem.addActionListener(this);
157
+
158
+// undoItem = menu.add(new MenuItem("Undo"));
159
+// undoItem.addActionListener(this);
160
+// redoItem = menu.add(new MenuItem("Redo"));
161
+// redoItem.addActionListener(this);
162
+// menu.add("-");
172163 duplicateItem = menu.add(new MenuItem("Duplicate"));
173164 duplicateItem.addActionListener(this);
165
+ cloneItem = menu.add(new MenuItem("Clone"));
166
+ cloneItem.addActionListener(this);
167
+ if (Globals.ADVANCED)
168
+ {
169
+ cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
170
+ cloneSupportItem.addActionListener(this);
171
+ }
172
+ menu.add("-");
174173 cutItem = menu.add(new MenuItem("Cut"));
175174 cutItem.addActionListener(this);
176175 copyItem = menu.add(new MenuItem("Copy"));
177176 copyItem.addActionListener(this);
178177 pasteItem = menu.add(new MenuItem("Paste"));
179178 pasteItem.addActionListener(this);
180
- menu.add("-");
181
- cloneItem = menu.add(new MenuItem("Clone"));
182
- cloneItem.addActionListener(this);
183
- cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
184
- cloneSupportItem.addActionListener(this);
179
+
185180 menu.add("-");
186181 pasteIntoItem = menu.add(new MenuItem("Paste into"));
187182 pasteIntoItem.addActionListener(this);
....@@ -201,14 +196,97 @@
201196 clearAllItem = menu.add(new MenuItem("Clear All"));
202197 clearAllItem.addActionListener(this);
203198 }
199
+
200
+ menuBar.add(cameraMenu = new Menu("View"));
201
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
202
+ //zBufferItem.addActionListener(this);
203
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204
+ //normalLensItem.addActionListener(this);
205
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
+ revertCameraItem.addActionListener(this);
207
+
208
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
+ toggleFullScreenItem.addItemListener(this);
210
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
+ cameraMenu.add("-");
212
+
213
+ cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
+ toggleTextureItem.addItemListener(this);
215
+ toggleTextureItem.setState(CameraPane.textureon);
216
+
217
+ cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
+ toggleSwitchItem.addItemListener(this);
219
+ toggleSwitchItem.setState(CameraPane.SWITCH);
220
+
221
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
222
+ toggleHandleItem.addItemListener(this);
223
+ toggleHandleItem.setState(CameraPane.HANDLES);
224
+
225
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
226
+ togglePaintItem.addItemListener(this);
227
+ togglePaintItem.setState(CameraPane.PAINTMODE);
228
+
229
+ if (Globals.ADVANCED)
230
+ {
231
+ cameraMenu.add("-");
232
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
233
+ toggleLiveItem.addItemListener(this);
234
+ toggleLiveItem.setState(Globals.isLIVE());
204235
236
+ cameraMenu.add(stepItem = new MenuItem("Step"));
237
+ stepItem.addActionListener(this);
238
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
239
+ // toggleDLItem.addItemListener(this);
240
+ // toggleDLItem.setState(false);
241
+
242
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
243
+ toggleRenderItem.addItemListener(this);
244
+ toggleRenderItem.setState(!CameraPane.frozen);
245
+
246
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
247
+ toggleDebugItem.addItemListener(this);
248
+ toggleDebugItem.setState(Globals.DEBUG);
249
+
250
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
251
+ toggleFrustumItem.addItemListener(this);
252
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
253
+
254
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
255
+ toggleFootContactItem.addItemListener(this);
256
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
257
+
258
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
259
+ toggleTimelineItem.addItemListener(this);
260
+ }
261
+
262
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
263
+// toggleRootItem.addItemListener(this);
264
+// toggleRootItem.setState(false);
265
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
266
+// animationItem.addItemListener(this);
267
+// animationItem.setState(CameraPane.ANIMATION);
268
+ cameraMenu.add("-");
269
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
270
+ editCameraItem.addActionListener(this);
271
+
272
+ if (Globals.ADVANCED)
273
+ {
274
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
+ //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
277
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278
+ oe.cameraMenu.add("-");
279
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
280
+ openWindowItem.addActionListener(this);
281
+ editLeafItem.addActionListener(this);
282
+ lookAtItem.addActionListener(this);
283
+ //lookFromItem.addActinoListener(this);
284
+ //switchItem.addActionListener(this);
285
+ }
286
+
205287 oe.menuBar.add(menu = new Menu("Setting"));
206288 if (Globals.ADVANCED)
207289 {
208
- resetMeshItem = menu.add(new MenuItem("Reset All"));
209
- resetMeshItem.addActionListener(this);
210
- stepAllItem = menu.add(new MenuItem("Step All"));
211
- stepAllItem.addActionListener(this);
212290 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
213291 revertMeshItem.addActionListener(this);
214292 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -272,6 +350,7 @@
272350
273351 if (Globals.ADVANCED)
274352 {
353
+ menu.add("-");
275354 physicsItem = menu.add(new MenuItem("Physics"));
276355 physicsItem.addActionListener(this);
277356 frameselectorItem = menu.add(new MenuItem("Frame Selector"));
....@@ -289,14 +368,15 @@
289368 billboardItem.addActionListener(this);
290369 csgItem = menu.add(new MenuItem("CSG"));
291370 csgItem.addActionListener(this);
292
- shadowXItem = menu.add(new MenuItem("Shadow X"));
371
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
293372 shadowXItem.addActionListener(this);
294
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
373
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
295374 shadowYItem.addActionListener(this);
296
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
375
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
297376 shadowZItem.addActionListener(this);
298377 if (Globals.ADVANCED)
299378 {
379
+ menu.add("-");
300380 linkerItem = menu.add(new MenuItem("Linker"));
301381 linkerItem.addActionListener(this);
302382 attributeItem = menu.add(new MenuItem("Attribute"));
....@@ -305,14 +385,18 @@
305385 templateItem.addActionListener(this);
306386 pointflowItem = menu.add(new MenuItem("Point Flow"));
307387 pointflowItem.addActionListener(this);
308
- menu.add("-");
309388 }
389
+ menu.add("-");
310390 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
311391 resetTransformItem.addActionListener(this);
312392 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
313393 resetCentroidItem.addActionListener(this);
314
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
315
- transformgeometryItem.addActionListener(this);
394
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
395
+ resetCentroidXZItem.addActionListener(this);
396
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
397
+ transformGeometryItem.addActionListener(this);
398
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
399
+ transformChildrenItem.addActionListener(this);
316400
317401 oe.menuBar.add(menu = new Menu("Geometry"));
318402 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -361,6 +445,10 @@
361445 oe.menuBar.add(menu = new Menu("Attributes"));
362446 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
363447 clearMaterialsItem.addActionListener(this);
448
+ resetAllItem = menu.add(new MenuItem("Reset All"));
449
+ resetAllItem.addActionListener(this);
450
+ stepAllItem = menu.add(new MenuItem("Step All"));
451
+ stepAllItem.addActionListener(this);
364452 menu.add("-");
365453 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
366454 liveleavesItem.addActionListener(this);
....@@ -381,6 +469,14 @@
381469 markleavesItem.addActionListener(this);
382470 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
383471 unmarkleavesItem.addActionListener(this);
472
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
473
+ rewindleavesItem.addActionListener(this);
474
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
475
+ unrewindleavesItem.addActionListener(this);
476
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
477
+ randomleavesItem.addActionListener(this);
478
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
479
+ unrandomleavesItem.addActionListener(this);
384480 menu.add("-");
385481 flipVItem = menu.add(new MenuItem("Flip V"));
386482 flipVItem.addActionListener(this);
....@@ -415,38 +511,41 @@
415511 sortbysizeItem.addActionListener(this);
416512 sortbynameItem = menu.add(new MenuItem("Sort by name"));
417513 sortbynameItem.addActionListener(this);
514
+ menu.add("-");
515
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
516
+ shareGeometriesItem.addActionListener(this);
517
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
518
+ mergeGeometriesItem.addActionListener(this);
418519 if (Globals.ADVANCED)
419520 {
420
- menu.add("-");
521
+ // Pretty much the same as duplicate and clone.
421522 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
422523 extractGeometriesItem.addActionListener(this);
423524 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
424525 cloneGeometriesItem.addActionListener(this);
425
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
426
- shareGeometriesItem.addActionListener(this);
427
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
428
- mergeGeometriesItem.addActionListener(this);
429526 }
430527
431528 oe.menuBar.add(menu = new Menu("Insert"));
432529 buildCreateMenu(menu);
433530
434
- oe.menuBar.add(menu = new Menu("Include"));
435
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
436
- importGFDItem.addActionListener(this);
437
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
438
- importVRMLX3DItem.addActionListener(this);
439
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
440
- importOBJItem.addActionListener(this);
441
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
442
- import3DSItem.addActionListener(this);
443
-
444531 oe.menuBar.add(menu = new Menu("Tools"));
445532 buildToolsMenu(menu);
446533 }
447534
448535 void SetupUI2(ObjEditor oe)
449536 {
537
+ // June 2019
538
+ if (oe == null)
539
+ {
540
+ //super.SetupUI2(this);
541
+ //return;
542
+ }
543
+
544
+ if (copy != group)
545
+ {
546
+ //super.SetupUI2(this);
547
+ }
548
+
450549 //new Exception().printStackTrace();
451550
452551 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -477,23 +576,47 @@
477576 */
478577 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
479578
480
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
481
- liveCB.setToolTipText("Enabled animation");
579
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580
+ //minButton.setToolTipText("Minimize window");
581
+ //minButton.addActionListener(this);
582
+
583
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
+ maxButton.setToolTipText("Maximize window");
585
+ maxButton.addActionListener(this);
586
+
587
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ fullButton.setToolTipText("Full-screen window");
589
+ fullButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ undoButton.setToolTipText("Undo changes");
593
+ undoButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ redoButton.setToolTipText("Redo changes");
597
+ redoButton.addActionListener(this);
598
+
599
+ oe.toolbarPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ saveButton.setToolTipText("Save changes");
601
+ saveButton.addActionListener(this);
602
+
603
+ oe.toolbarPanel.add(liveCB = GetCheckBox("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604
+ liveCB.setToolTipText("Enable animation");
482605 liveCB.addItemListener(this);
483606
484
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
485
- oneStepButton.setToolTipText("Animate one step forward");
486
- oneStepButton.addActionListener(this);
487
-
488
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
607
+ oe.toolbarPanel.add(fastCB = GetCheckBox("icons/runfast.png", CameraPane.FAST)); //, constraints);
489608 fastCB.setToolTipText("Fast mode");
490609 fastCB.addItemListener(this);
491610
492
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
611
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ oneStepButton.setToolTipText("Animate one step forward");
613
+ oneStepButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(trackCB = GetCheckBox("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
493616 trackCB.setToolTipText("Enable tracking");
494617 trackCB.addItemListener(this);
495618
496
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
497620 screenfitButton.setToolTipText("Screen fit");
498621 screenfitButton.addActionListener(this);
499622
....@@ -502,70 +625,68 @@
502625
503626 if (Globals.ADVANCED)
504627 {
505
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
628
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
506629 snapobjectButton.addActionListener(this);
507630 snapobjectButton.setToolTipText("Snap Object");
508631 }
509632
510
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
511
- flashSelectionButton.setToolTipText("Show selection");
633
+ oe.toolbarPanel.add(flashSelectionButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ flashSelectionButton.setToolTipText("Highlight selection");
512635 flashSelectionButton.addActionListener(this);
513636
514637 oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
515638
516
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
639
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
517640 twoButton.setToolTipText("Show center view only");
518641 twoButton.addActionListener(this);
519
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
642
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
520643 fourButton.addActionListener(this);
521644 fourButton.setToolTipText("Show left panel only");
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
645
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
523646 sixButton.setToolTipText("2-column layout left");
524647 sixButton.addActionListener(this);
525
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
648
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526649 threeButton.setToolTipText("2-column layout right");
527650 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
651
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
529652 sevenButton.setToolTipText("3-column layout");
530653 sevenButton.addActionListener(this);
531654 //
532655
533
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
656
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
534657 rootButton.setToolTipText("Edit selection in new tab");
535658 rootButton.addActionListener(this);
536659
537
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
660
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538661 closeButton.setToolTipText("Close tab");
539662 closeButton.addActionListener(this);
540663 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
541664 //clearButton.addActionListener(this);
542665
543
- cGridBag commandsPanel = new cGridBag();
544
-
545
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
666
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
546667 editButton.setToolTipText("Edit selection");
547668 editButton.addActionListener(this);
548669
549
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
670
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
550671 uneditButton.setToolTipText("Unedit selection");
551672 uneditButton.addActionListener(this);
552673
553
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
674
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
554675 allParamsButton.setToolTipText("Edit all params");
555676 allParamsButton.addActionListener(this);
556677
557
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
678
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
558679 clearPanelButton.setToolTipText("Clear edit panel");
559680 clearPanelButton.addActionListener(this);
560681
561
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
682
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
562683 unselectButton.setToolTipText("Unselect");
563684 unselectButton.addActionListener(this);
564685
565
- commandsPanel.preferredHeight = 1;
686
+ editCommandsPanel.preferredHeight = 1;
566687
567
- oe.treePanel.add(commandsPanel);
568
- oe.treePanel.Return();
688
+// oe.treePanel.add(commandsPanel);
689
+// oe.treePanel.Return();
569690
570691 // oe.aConstraints.gridx += 1;
571692 // oe.aConstraints.weighty = 0;
....@@ -641,7 +762,7 @@
641762 zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
642763 zoomBoxCB.addItemListener(this);
643764
644
- if (Globals.ADVANCED)
765
+ if (true) // Globals.ADVANCED)
645766 {
646767 panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
647768 supportCB.setToolTipText("Enable rigging");
....@@ -687,11 +808,23 @@
687808 // debugCB.addItemListener(this);
688809
689810 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
+ oeilCB.setToolTipText("Move camera when tracking target");
690812 oeilCB.addItemListener(this);
691813
814
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
+ shadowCB.setToolTipText("Compute shadows when live");
816
+ shadowCB.addItemListener(this);
817
+
818
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
819
+ autosaveCB.setToolTipText("Auto-save on structure change");
820
+ autosaveCB.addItemListener(this);
821
+
822
+ if (Globals.ADVANCED)
823
+ {
692824 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
693825 lookAtCB.setToolTipText("Look-at target");
694826 lookAtCB.addItemListener(this);
827
+ }
695828
696829 }
697830
....@@ -706,6 +839,14 @@
706839 void EditObject(Object3D obj)
707840 {
708841 cRadio radioButton = new cRadio(obj.name);
842
+
843
+ // Patch to avoid bug with transparency.
844
+ radioButton.hadMaterial = obj.material != null;
845
+ if (!radioButton.hadMaterial)
846
+ {
847
+ obj.material = new cMaterial();
848
+ }
849
+
709850 radioButton.SetObject(obj);
710851 radioButton.layout = sevenButton;
711852 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -714,8 +855,11 @@
714855 buttonGroup.add(radioButton);
715856 radioButton.doClick();
716857 }
858
+
717859 void SetupViews(ObjEditor oe)
718860 {
861
+ theFrame = this;
862
+
719863 oe.SetupViews();
720864
721865 System.out.println("SetupViews");
....@@ -724,23 +868,26 @@
724868 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
725869 }
726870
727
- JCheckBox liveCB;
728
- JCheckBox supportCB;
729
- JCheckBox localCB;
730
- JCheckBox crowdCB;
731
- JCheckBox smoothCB;
732
- JCheckBox fastCB;
733
- JCheckBox slowCB;
734
- JCheckBox boxCB;
735
- JCheckBox zoomBoxCB;
736
- JCheckBox trackCB;
737
- JCheckBox smoothfocusCB;
871
+ cCheckBox liveCB;
872
+ cCheckBox supportCB;
873
+ cCheckBox localCB;
874
+ cCheckBox crowdCB;
875
+ cCheckBox smoothCB;
876
+ cCheckBox fastCB;
877
+ cCheckBox slowCB;
878
+ cCheckBox boxCB;
879
+ cCheckBox zoomBoxCB;
880
+ cCheckBox trackCB;
881
+ cCheckBox smoothfocusCB;
738882 // JCheckBox speakerMocapCB;
739
- JCheckBox speakerCameraCB;
740
- JCheckBox speakerFocusCB;
741
- JCheckBox debugCB;
742
- JCheckBox oeilCB;
743
- JCheckBox lookAtCB;
883
+ cCheckBox speakerCameraCB;
884
+ cCheckBox speakerFocusCB;
885
+ cCheckBox debugCB;
886
+
887
+ cCheckBox oeilCB;
888
+ cCheckBox shadowCB;
889
+ cCheckBox autosaveCB;
890
+ cCheckBox lookAtCB;
744891
745892 // static int COLOR = 1;
746893 // static int MATERIAL = 2;
....@@ -748,9 +895,9 @@
748895
749896 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
750897
751
- JCheckBox colorCB;
752
- JCheckBox materialCB;
753
- JCheckBox textureCB;
898
+ cCheckBox colorCB;
899
+ cCheckBox materialCB;
900
+ cCheckBox textureCB;
754901
755902 public void itemStateChanged(ItemEvent e)
756903 {
....@@ -778,6 +925,7 @@
778925 } else if(e.getSource() == liveCB)
779926 {
780927 cameraView.ToggleLive();
928
+ refreshContents(false);
781929 }
782930 else if(e.getSource() == supportCB)
783931 {
....@@ -841,6 +989,14 @@
841989 else if(e.getSource() == oeilCB)
842990 {
843991 cameraView.ToggleOeil();
992
+ }
993
+ else if(e.getSource() == shadowCB)
994
+ {
995
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
996
+ }
997
+ else if(e.getSource() == autosaveCB)
998
+ {
999
+ Globals.SAVEONMAKE ^= true;
8441000 }
8451001 else if(e.getSource() == lookAtCB)
8461002 {
....@@ -930,7 +1086,9 @@
9301086 // objEditor.DropFile((java.io.File[]) object, true);
9311087 // return;
9321088 // }
933
- if (string.charAt(0) == '/')
1089
+
1090
+ // File path for Mac and Windows
1091
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9341092 {
9351093 // file(s)
9361094 String[] names = string.split("\n");
....@@ -957,7 +1115,7 @@
9571115
9581116 flashIt = false;
9591117 CameraPane pane = (CameraPane) target;
960
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1118
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9611119 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9621120
9631121 if (group.selection.size() == 1)
....@@ -1164,13 +1322,13 @@
11641322 parseverticesItem.addActionListener(this);
11651323 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11661324 textureFieldItem.addActionListener(this);
1167
- alignItem = menu.add(new MenuItem("Align Object"));
1325
+ alignItem = menu.add(new MenuItem("Align Objects"));
11681326 alignItem.addActionListener(this);
11691327 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11701328 reduceMorphItem.addActionListener(this);
11711329 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11721330 reduce34MorphItem.addActionListener(this);
1173
-
1331
+ menu.add("-");
11741332 menu.add(computeAOItem = new MenuItem("Compute AO"));
11751333 computeAOItem.addActionListener(this);
11761334
....@@ -1183,7 +1341,7 @@
11831341 memoryItem.addActionListener(this);
11841342 menu.add(analyzeItem = new MenuItem("Analyze"));
11851343 analyzeItem.addActionListener(this);
1186
- menu.add(dumpItem = new MenuItem("Dump"));
1344
+ menu.add(dumpItem = new MenuItem("Print"));
11871345 dumpItem.addActionListener(this);
11881346 // menu.add(pathItem = new MenuItem("From-to path"));
11891347 // pathItem.addActionListener(this);
....@@ -1324,6 +1482,7 @@
13241482 shadow.material = new cMaterial(obj.material);
13251483 shadow.material.diffuse = 0.0001f;
13261484 shadow.material.specular = 0.0001f;
1485
+ //shadow.projectedVertices[1].x = 300;
13271486
13281487 makeSomething(shadow);
13291488 }
....@@ -1530,9 +1689,9 @@
15301689
15311690 void Overwrite(int mask)
15321691 {
1533
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1692
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15341693 {
1535
- Object3D content = GrafreeD.clipboard.get(0);
1694
+ Object3D content = Grafreed.clipboard.get(0);
15361695
15371696 if (content instanceof cGroup && ((cGroup)content).transientlink )
15381697 content = ((cGroup)content).get(0);
....@@ -1837,23 +1996,6 @@
18371996 csg.addChild(child);
18381997 child.addChild(csg);
18391998 } else
1840
-
1841
- if (source == importGFDItem)
1842
- {
1843
- ImportGFD();
1844
- } else
1845
- if (source == importVRMLX3DItem)
1846
- {
1847
- ImportVRMLX3D();
1848
- } else
1849
- if (source == import3DSItem)
1850
- {
1851
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1852
- } else
1853
- if (source == importOBJItem)
1854
- {
1855
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1856
- } else
18571999 if (source == computeAOItem)
18582000 {
18592001 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1872,7 +2014,7 @@
18722014 if (source == invariantsItem)
18732015 {
18742016 System.out.println("Invariants:");
1875
- GrafreeD.grafreeD.universe.invariants();
2017
+ Grafreed.grafreeD.universe.invariants();
18762018 } else
18772019 if (source == memoryItem)
18782020 {
....@@ -1890,6 +2032,30 @@
18902032 if (source == dumpItem)
18912033 {
18922034 DumpObject();
2035
+ } else
2036
+ if (source == minButton)
2037
+ {
2038
+ Minimize();
2039
+ } else
2040
+ if (source == maxButton)
2041
+ {
2042
+ Maximize();
2043
+ } else
2044
+ if (source == fullButton)
2045
+ {
2046
+ ToggleFullScreen();
2047
+ } else
2048
+ if (source == undoButton)
2049
+ {
2050
+ Undo();
2051
+ } else
2052
+ if (source == redoButton)
2053
+ {
2054
+ Redo();
2055
+ } else
2056
+ if (source == saveButton)
2057
+ {
2058
+ Save();
18932059 } else
18942060 if (source == oneStepButton)
18952061 {
....@@ -1945,12 +2111,20 @@
19452111 {
19462112 loadClipboard(true);
19472113 } else
2114
+ if (source == undoItem)
2115
+ {
2116
+ Undo();
2117
+ } else
2118
+ if (source == redoItem)
2119
+ {
2120
+ Redo();
2121
+ } else
19482122 if (source == duplicateItem)
19492123 {
1950
- Object3D keep = GrafreeD.clipboard;
2124
+ Object3D keep = Grafreed.clipboard;
19512125 loadClipboard(false);
19522126 paste(false);
1953
- GrafreeD.clipboard = keep;
2127
+ Grafreed.clipboard = keep;
19542128 } else
19552129 if (source == cloneItem)
19562130 {
....@@ -2170,9 +2344,9 @@
21702344 // group.selection.get(0).setMasterThis(content); // should be identity
21712345 // refreshContents();
21722346 // }
2173
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2347
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21742348 {
2175
- Object3D content = GrafreeD.clipboard.get(0);
2349
+ Object3D content = Grafreed.clipboard.get(0);
21762350
21772351 if (content instanceof cGroup && ((cGroup)content).transientlink )
21782352 content = ((cGroup)content).get(0);
....@@ -2222,9 +2396,9 @@
22222396 } else
22232397 if (source == setMasterItem)
22242398 {
2225
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2399
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22262400 {
2227
- Object3D content = GrafreeD.clipboard.get(0);
2401
+ Object3D content = Grafreed.clipboard.get(0);
22282402
22292403 if (content instanceof cGroup && ((cGroup)content).transientlink )
22302404 content = ((cGroup)content).get(0);
....@@ -2237,9 +2411,9 @@
22372411 {
22382412 if (group.selection.size() == 1)
22392413 {
2240
- if (GrafreeD.clipboard.size() == 1)
2414
+ if (Grafreed.clipboard.size() == 1)
22412415 {
2242
- Object3D content = GrafreeD.clipboard.get(0);
2416
+ Object3D content = Grafreed.clipboard.get(0);
22432417
22442418 if (content instanceof cGroup && ((cGroup)content).transientlink )
22452419 content = ((cGroup)content).get(0);
....@@ -2256,7 +2430,7 @@
22562430 {
22572431 RevertMeshes();
22582432 } else
2259
- if (source == resetMeshItem)
2433
+ if (source == resetAllItem)
22602434 {
22612435 ResetAll();
22622436 } else
....@@ -2444,7 +2618,7 @@
24442618 } else
24452619 if (source == genNormalsMESHItem)
24462620 {
2447
- GenNormals(true); // TODO
2621
+ GenNormalsMESH();
24482622 } else
24492623 if (source == genNormalsORGANItem)
24502624 {
....@@ -2509,6 +2683,22 @@
25092683 if (source == unmarkleavesItem)
25102684 {
25112685 MarkLeaves(false);
2686
+ } else
2687
+ if (source == rewindleavesItem)
2688
+ {
2689
+ RewindLeaves(true);
2690
+ } else
2691
+ if (source == unrewindleavesItem)
2692
+ {
2693
+ RewindLeaves(false);
2694
+ } else
2695
+ if (source == randomleavesItem)
2696
+ {
2697
+ RandomLeaves(true);
2698
+ } else
2699
+ if (source == unrandomleavesItem)
2700
+ {
2701
+ RandomLeaves(false);
25122702 } else
25132703 if (source == flipVItem)
25142704 {
....@@ -2594,9 +2784,13 @@
25942784 {
25952785 SmoothMesh();
25962786 } else
2597
- if (source == transformgeometryItem)
2787
+ if (source == transformGeometryItem)
25982788 {
25992789 TransformGeometry();
2790
+ } else
2791
+ if (source == transformChildrenItem)
2792
+ {
2793
+ TransformChildren();
26002794 } else
26012795 if (source == resetTransformItem)
26022796 {
....@@ -2604,7 +2798,11 @@
26042798 } else
26052799 if (source == resetCentroidItem)
26062800 {
2607
- ResetCentroid();
2801
+ ResetCentroid(true);
2802
+ } else
2803
+ if (source == resetCentroidXZItem)
2804
+ {
2805
+ ResetCentroid(false);
26082806 } else
26092807 if (source == resetParentItem)
26102808 {
....@@ -2768,6 +2966,24 @@
27682966 bigThree.ClearUI();
27692967 bigThree.add(centralPanel);
27702968 bigThree.FlushUI();
2969
+
2970
+ cameraView.requestFocusInWindow();
2971
+
2972
+// refreshContents(true);
2973
+//
2974
+// try
2975
+// {
2976
+// java.awt.Robot bot = new java.awt.Robot();
2977
+// int mask = InputEvent.BUTTON1_MASK;
2978
+// bot.mouseMove(100, 100);
2979
+// bot.mousePress(mask);
2980
+// bot.mouseRelease(mask);
2981
+// }
2982
+// catch (Exception e)
2983
+// {
2984
+//
2985
+// }
2986
+
27712987 } else
27722988 if (source == threeButton)
27732989 {
....@@ -2804,6 +3020,8 @@
28043020 bigThree.add(centralPanel);
28053021 bigThree.add(XYZPanel);
28063022 bigThree.FlushUI();
3023
+
3024
+ cameraView.requestFocusInWindow();
28073025 } else
28083026 if (source == fourButton)
28093027 {
....@@ -2839,6 +3057,8 @@
28393057 bigThree.ClearUI();
28403058 bigThree.add(scenePanel);
28413059 bigThree.FlushUI();
3060
+
3061
+ cameraView.requestFocusInWindow();
28423062 } else
28433063 if (source == sixButton)
28443064 {
....@@ -2875,6 +3095,8 @@
28753095 bigThree.add(scenePanel);
28763096 bigThree.add(centralPanel);
28773097 bigThree.FlushUI();
3098
+
3099
+ cameraView.requestFocusInWindow();
28783100 } else
28793101 if (source == sevenButton)
28803102 {
....@@ -2912,6 +3134,8 @@
29123134 bigThree.add(centralPanel);
29133135 bigThree.add(XYZPanel);
29143136 bigThree.FlushUI();
3137
+
3138
+ cameraView.requestFocusInWindow();
29153139 } else
29163140 if (source == rootButton)
29173141 {
....@@ -2923,6 +3147,7 @@
29233147 EditObject(obj);
29243148 }
29253149
3150
+ cameraView.requestFocusInWindow();
29263151 refreshContents(true);
29273152 } else
29283153 if (source == closeButton)
....@@ -2932,18 +3157,27 @@
29323157 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29333158 {
29343159 ab = (cRadio)e.nextElement();
2935
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3160
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29363161 {
3162
+ // Patch to avoid bug with transparency.
3163
+ if (!ab.hadMaterial)
3164
+ {
3165
+ ab.object.material = null;
3166
+ }
3167
+
29373168 buttonGroup.remove(ab);
29383169 radioPanel.remove(ab);
29393170
2940
- ab.GetObject().editWindow = null;
3171
+ //ab.GetObject().editWindow = null;
3172
+ ab.GetObject().manipWindow = null;
29413173 // ab.GetObject().objectUI = null; // ?????????
29423174
29433175 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29443176 break;
29453177 }
29463178 }
3179
+
3180
+ cameraView.requestFocusInWindow();
29473181 refreshContents(true);
29483182 } else
29493183 if (source == editItem || source == editButton)
....@@ -2960,7 +3194,7 @@
29603194 child.CloseUI();
29613195 listUI.remove(child);
29623196
2963
- child.editWindow = null; // ???????????
3197
+ //child.editWindow = null; // ???????????
29643198 }
29653199 objEditor.ctrlPanel.FlushUI();
29663200 //objEditor.jTree.clearSelection();
....@@ -3046,7 +3280,11 @@
30463280 frontView.object = group;
30473281 sideView.object = group;
30483282 }
3049
- group.editWindow = this;
3283
+
3284
+// fix "+" issue
3285
+ //group.editWindow = this;
3286
+ group.manipWindow = this;
3287
+
30503288 /*
30513289 currentLayout = radio.layout;
30523290 if (currentLayout == null)
....@@ -3058,8 +3296,23 @@
30583296 //group.parent = null; // ROOT
30593297 //group.attributes = -1;
30603298 ResetModel();
3299
+
3300
+ cameraView.requestFocusInWindow();
30613301 refreshContents(true);
3062
- }
3302
+ } else if (event.getSource() == editCameraItem)
3303
+ {
3304
+ cameraView.ProtectCamera();
3305
+ cameraView.repaint();
3306
+ return;
3307
+ } else if (event.getSource() == revertCameraItem)
3308
+ {
3309
+ cameraView.RevertCamera();
3310
+ cameraView.repaint();
3311
+ return;
3312
+ // } else if (event.getSource() == textureButton)
3313
+ // {
3314
+ // return; // true;
3315
+ }
30633316 else
30643317 {
30653318 //return super.action(event, arg);
....@@ -3068,7 +3321,6 @@
30683321 }
30693322
30703323 boolean useclient = false;
3071
- cRadio radio;
30723324
30733325 void ToggleRoot()
30743326 {
....@@ -3120,6 +3372,28 @@
31203372 refreshContents();
31213373 }
31223374
3375
+ void TransformChildren()
3376
+ {
3377
+ Object3D obj;
3378
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3379
+ {
3380
+ obj = (Object3D)e.nextElement();
3381
+ obj.KeepTextureMatrices();
3382
+ obj.TransformChildren();
3383
+ obj.RestoreTextureMatrices();
3384
+
3385
+// if (obj.parent == null)
3386
+// {
3387
+// System.out.println("NULL PARENT!");
3388
+// new Exception().printStackTrace();
3389
+// }
3390
+// else
3391
+// TouchTransform(obj);
3392
+// //obj.parent.Touch();
3393
+ }
3394
+
3395
+ refreshContents();
3396
+ }
31233397
31243398 void ResetTransform()
31253399 {
....@@ -3232,7 +3506,7 @@
32323506 refreshContents();
32333507 }
32343508
3235
- void ResetCentroid()
3509
+ void ResetCentroid(boolean full)
32363510 {
32373511 Object3D obj;
32383512 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3247,12 +3521,16 @@
32473521 LA.matIdentity(Object3D.mat);
32483522 obj.getBounds(minima, maxima, false);
32493523 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3250
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3524
+ if (full)
3525
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32513526 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32523527 obj.TransformMesh(Object3D.mat);
3528
+
32533529 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3254
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3530
+ if (full)
3531
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32553532 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3533
+
32563534 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32573535 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32583536 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3281,7 +3559,8 @@
32813559
32823560 int size = obj.MemorySize();
32833561
3284
- System.err.println((size/1024) + " KB is the size of " + obj);
3562
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3563
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32853564 }
32863565 }
32873566 catch (Exception e)
....@@ -3318,9 +3597,9 @@
33183597 obj = (Object3D)e.nextElement();
33193598
33203599 System.out.println("Object is: " + obj);
3321
- GrafreeD.AnalyzeObject(obj);
3600
+ Grafreed.AnalyzeObject(obj);
33223601 System.out.println("Boundary rep: " + obj.bRep);
3323
- GrafreeD.AnalyzeObject(obj.bRep);
3602
+ Grafreed.AnalyzeObject(obj.bRep);
33243603
33253604 // System.err.println((size/1024) + " KB is the size of " + obj);
33263605 }
....@@ -3362,6 +3641,13 @@
33623641 void GenNormals(boolean crease)
33633642 {
33643643 group.GenNormalsS(crease);
3644
+
3645
+ refreshContents();
3646
+ }
3647
+
3648
+ void GenNormalsMESH()
3649
+ {
3650
+ group.GenNormalsMeshS();
33653651
33663652 refreshContents();
33673653 }
....@@ -3534,8 +3820,8 @@
35343820
35353821 void ParseVertices()
35363822 {
3537
- boolean epsequal = GrafreeD.epsequal;
3538
- GrafreeD.epsequal = true;
3823
+ boolean epsequal = Grafreed.epsequal;
3824
+ Grafreed.epsequal = true;
35393825
35403826 for (int i=0; i<group.selection.size(); i++)
35413827 {
....@@ -3560,7 +3846,7 @@
35603846 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35613847 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35623848
3563
- g.add(GrafreeD.clipboard);
3849
+ g.add(Grafreed.clipboard);
35643850
35653851 buffer.add(g);
35663852 }
....@@ -3575,7 +3861,7 @@
35753861 makeSomething(buffer, i==group.selection.size()-1);
35763862 }
35773863
3578
- GrafreeD.epsequal = epsequal;
3864
+ Grafreed.epsequal = epsequal;
35793865
35803866 refreshContents();
35813867 }
....@@ -3593,7 +3879,16 @@
35933879 String pigment = Object3D.GetPigment(tex);
35943880 //String bump = Object3D.GetBump(tex);
35953881
3596
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3882
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3883
+
3884
+ try
3885
+ {
3886
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3887
+ }
3888
+ catch (Exception e)
3889
+ {
3890
+ System.err.println("FAIL: " + node);
3891
+ }
35973892
35983893 double s = v.s;
35993894
....@@ -3725,7 +4020,7 @@
37254020 return;
37264021
37274022 Object3D poses = group.selection.get(0);
3728
- Object3D ref = GrafreeD.clipboard.get(0);
4023
+ Object3D ref = Grafreed.clipboard.get(0);
37294024
37304025 Object3D newgroup = new Object3D("Po:" + poses.name);
37314026
....@@ -3919,9 +4214,9 @@
39194214
39204215 void ClipMesh()
39214216 {
3922
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4217
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39234218 {
3924
- Object3D content = GrafreeD.clipboard.get(0);
4219
+ Object3D content = Grafreed.clipboard.get(0);
39254220
39264221 if (content instanceof cGroup && ((cGroup)content).transientlink )
39274222 content = ((cGroup)content).get(0);
....@@ -3930,7 +4225,7 @@
39304225 // {
39314226 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39324227 // }
3933
- group.selection.ClipMesh(GrafreeD.clipboard);
4228
+ group.selection.ClipMesh(Grafreed.clipboard);
39344229 }
39354230 // group.selection.ClipMesh(GrafreeD.clipboard);
39364231 System.out.println("DONE.");
....@@ -3977,6 +4272,18 @@
39774272 void MarkLeaves(boolean hide)
39784273 {
39794274 group.selection.MarkLeaves(hide);
4275
+ refreshContents();
4276
+ }
4277
+
4278
+ void RewindLeaves(boolean hide)
4279
+ {
4280
+ group.selection.RewindLeaves(hide);
4281
+ refreshContents();
4282
+ }
4283
+
4284
+ void RandomLeaves(boolean hide)
4285
+ {
4286
+ group.selection.RandomLeaves(hide);
39804287 refreshContents();
39814288 }
39824289
....@@ -4065,7 +4372,7 @@
40654372 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40664373
40674374 Object3D elem = (Object3D)group.selection.elementAt(i);
4068
- if(elem != group)
4375
+ if(elem != group || !newWindow)
40694376 {
40704377 // if (!(elem instanceof Composite))
40714378 // newWindow = false;
....@@ -4155,7 +4462,6 @@
41554462 //case 702: // Event.LIST_DESELECT
41564463 group.deselectAll();
41574464 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4158
- objEditor.ClearInfo(); // .GetMaterial());
41594465 if (tps != null)
41604466 {
41614467 for (int i=0; i < tps.length; i++)
....@@ -4164,10 +4470,8 @@
41644470
41654471 //if (child.parent != null)
41664472 //child.parent.addSelectee(child);
4473
+ objEditor.SetMaterial(child);
41674474 group.addSelectee(child);
4168
- objEditor.SetMaterial(child); // .GetMaterial());
4169
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4170
- System.err.println("info : " + child.GetPath());
41714475 }
41724476 }
41734477 // else
....@@ -4177,16 +4481,17 @@
41774481 // System.err.println("info : " + group.GetPath());
41784482 // }
41794483
4180
- objEditor.SetText(); // jan 2014
4181
-
4182
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4484
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41834485 CameraPane.flash = true;
41844486
4185
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4487
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41864488 // a camera
41874489 {
4188
- CameraPane.camerachangeframe = 0; // don't refuse it
4189
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4490
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4491
+ {
4492
+ CameraPane.camerachangeframe = 0; // don't refuse it
4493
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4494
+ }
41904495 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41914496 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41924497 }
....@@ -4199,6 +4504,26 @@
41994504
42004505 freezemodel = false;
42014506 }
4507
+
4508
+ void refreshContents(boolean cp)
4509
+ {
4510
+ if (!Globals.MOUSEDRAGGED)
4511
+ {
4512
+ objEditor.ClearInfo(); // .GetMaterial());
4513
+
4514
+ for (int i=0; i < group.selection.Size(); i++)
4515
+ {
4516
+ Object3D child = (Object3D) group.selection.get(i);
4517
+
4518
+ objEditor.AddInfo(child, this, true);
4519
+ System.err.println("info : " + child.GetPath());
4520
+ }
4521
+
4522
+ objEditor.SetText(); // jan 2014
4523
+ }
4524
+
4525
+ super.refreshContents(cp);
4526
+ }
42024527
42034528 void linkSomething(Object3D thing)
42044529 {
....@@ -4270,16 +4595,19 @@
42704595 {
42714596 if (group.selection.isEmpty())
42724597 return;
4273
- GrafreeD.clipboardIsTempGroup = false;
4598
+
4599
+ Grafreed.clipboardIsTempGroup = false;
42744600 Composite tGroup = null;
42754601 if (group.selection.size() > 0) // 1)
42764602 {
42774603 tGroup = new cGroup();
4278
- GrafreeD.clipboardIsTempGroup = true;
4604
+ Grafreed.clipboardIsTempGroup = true;
42794605 }
42804606
42814607 if (cut)
42824608 {
4609
+ if (Globals.SAVEONMAKE)
4610
+ Save();
42834611 //int indices[] = jList.getSelectedIndices();
42844612 //for (int i = indices.length - 1; i >= 0; i--)
42854613 //jList.remove(indices[i]);
....@@ -4315,16 +4643,16 @@
43154643 //System.out.println("cut " + child);
43164644 //System.out.println("parent = " + child.parent);
43174645 // tmp.addChild(child);
4318
- if (GrafreeD.clipboardIsTempGroup)
4646
+ if (Grafreed.clipboardIsTempGroup)
43194647 tGroup.add/*Child*/(tmp);
43204648 else
4321
- GrafreeD.clipboard = tmp;
4649
+ Grafreed.clipboard = tmp;
43224650 }
43234651 else
4324
- if (GrafreeD.clipboardIsTempGroup)
4652
+ if (Grafreed.clipboardIsTempGroup)
43254653 tGroup.add/*Child*/(child);
43264654 else
4327
- GrafreeD.clipboard = child;
4655
+ Grafreed.clipboard = child;
43284656 }
43294657
43304658 //ResetModel();
....@@ -4356,21 +4684,23 @@
43564684 //System.out.println("cut " + elem);
43574685 //System.out.println("parent = " + elem.parent);
43584686 // tmp.addChild(elem);
4359
- if (GrafreeD.clipboardIsTempGroup)
4687
+ if (Grafreed.clipboardIsTempGroup)
43604688 tGroup.add/*Child*/(tmp);
43614689 else
4362
- GrafreeD.clipboard = tmp;
4690
+ Grafreed.clipboard = tmp;
43634691 }
43644692 else
4365
- if (GrafreeD.clipboardIsTempGroup)
4693
+ if (Grafreed.clipboardIsTempGroup)
43664694 tGroup.add/*Child*/(child);
43674695 else
4368
- GrafreeD.clipboard = child;
4696
+ Grafreed.clipboard = child;
43694697 }
43704698
43714699 }
4372
- if (GrafreeD.clipboardIsTempGroup)
4373
- GrafreeD.clipboard = tGroup;
4700
+
4701
+ if (Grafreed.clipboardIsTempGroup)
4702
+ Grafreed.clipboard = tGroup;
4703
+
43744704 if (cut)
43754705 {
43764706 ResetModel();
....@@ -4384,7 +4714,7 @@
43844714 // return;
43854715 boolean first = true;
43864716
4387
- if (GrafreeD.clipboardIsTempGroup)
4717
+ if (Grafreed.clipboardIsTempGroup)
43884718 {
43894719 Composite temp;
43904720
....@@ -4395,7 +4725,7 @@
43954725 temp = (Composite)Applet3D.clipboard.deepCopy();
43964726 */
43974727 Object3D elem;
4398
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4728
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43994729 {
44004730 Object3D child = (Object3D)e.nextElement();
44014731
....@@ -4429,14 +4759,14 @@
44294759 //Object3D cb = Applet3D.clipboard;
44304760 //temp.addChild(cb);
44314761 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4432
- assert(GrafreeD.clipboard.parent == null);
4433
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4434
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4435
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4436
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4762
+ assert(Grafreed.clipboard.parent == null);
4763
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4764
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4765
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4766
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44374767 else
4438
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4439
- GrafreeD.clipboard.get(0).parent = keepparent;
4768
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4769
+ Grafreed.clipboard.get(0).parent = keepparent;
44404770 }
44414771
44424772 ResetModel();
....@@ -4485,9 +4815,9 @@
44854815 {
44864816 boolean first = true;
44874817
4488
- if (GrafreeD.clipboardIsTempGroup)
4818
+ if (Grafreed.clipboardIsTempGroup)
44894819 {
4490
- Composite temp = (Composite)GrafreeD.clipboard;
4820
+ Composite temp = (Composite)Grafreed.clipboard;
44914821 Object3D copy;
44924822 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44934823 {
....@@ -4497,7 +4827,7 @@
44974827 }
44984828 } else
44994829 {
4500
- linkSomething(GrafreeD.clipboard); //.get(0));
4830
+ linkSomething(Grafreed.clipboard); //.get(0));
45014831 }
45024832 }
45034833 }
....@@ -4902,21 +5232,6 @@
49025232 }
49035233 */
49045234
4905
- void ImportGFD()
4906
- {
4907
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4908
- browser.show();
4909
- String filename = browser.getFile();
4910
- if (filename != null && filename.length() > 0)
4911
- {
4912
- String fullname = browser.getDirectory() + filename;
4913
-
4914
- //Object3D readobj =
4915
- objEditor.ReadGFD(fullname, objEditor);
4916
- //makeSomething(readobj);
4917
- }
4918
- }
4919
-
49205235 /*
49215236 public void Callback(Object obj)
49225237 {
....@@ -4940,26 +5255,9 @@
49405255 }
49415256 */
49425257
4943
- void ImportVRMLX3D()
4944
- {
4945
- if (GrafreeD.standAlone)
4946
- {
4947
- /**/
4948
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4949
- browser.show();
4950
- String filename = browser.getFile();
4951
- if (filename != null && filename.length() > 0)
4952
- {
4953
- String fullname = browser.getDirectory() + filename;
4954
- LoadVRMLX3D(fullname);
4955
- }
4956
- /**/
4957
- }
4958
- }
4959
-
49605258 String GetFile(String dialogName)
49615259 {
4962
- if (GrafreeD.standAlone)
5260
+ if (Grafreed.standAlone)
49635261 {
49645262 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49655263 browser.show();
....@@ -5027,6 +5325,12 @@
50275325 cButton clearpanelButton;
50285326 cButton unselectButton;
50295327
5328
+ cButton minButton;
5329
+ cButton maxButton;
5330
+ cButton fullButton;
5331
+ cButton undoButton;
5332
+ cButton redoButton;
5333
+ cButton saveButton;
50305334 cButton oneStepButton;
50315335
50325336 cButton screenfitButton;
....@@ -5040,14 +5344,6 @@
50405344
50415345 cButton setsupportButton;
50425346
5043
- cButton twoButton;
5044
- cButton sixButton;
5045
- cButton threeButton;
5046
- cButton sevenButton;
5047
- cButton fourButton; // full panel
5048
- cButton oneButton; // full XYZ
5049
- //cButton currentLayout;
5050
-
50515347 //
50525348 //Composite
50535349 Object3D // to do !!
....@@ -5059,6 +5355,8 @@
50595355 private MenuItem lookFromItem;
50605356 private MenuItem switchItem;
50615357 private MenuItem cutItem;
5358
+ private MenuItem undoItem;
5359
+ private MenuItem redoItem;
50625360 private MenuItem duplicateItem;
50635361 private MenuItem cloneItem;
50645362 private MenuItem cloneSupportItem;
....@@ -5072,7 +5370,7 @@
50725370 private MenuItem linkverticesItem;
50735371 private MenuItem relinkverticesItem;
50745372 private MenuItem setMasterItem;
5075
- private MenuItem resetMeshItem;
5373
+ private MenuItem resetAllItem;
50765374 private MenuItem stepAllItem;
50775375 private MenuItem revertMeshItem;
50785376 private MenuItem poseMeshItem;
....@@ -5122,6 +5420,10 @@
51225420 private MenuItem showleavesItem;
51235421 private MenuItem markleavesItem;
51245422 private MenuItem unmarkleavesItem;
5423
+ private MenuItem rewindleavesItem;
5424
+ private MenuItem unrewindleavesItem;
5425
+ private MenuItem randomleavesItem;
5426
+ private MenuItem unrandomleavesItem;
51255427
51265428 private MenuItem flipVItem;
51275429 private MenuItem unflipVItem;
....@@ -5133,8 +5435,10 @@
51335435 private MenuItem panoTexturesItem;
51345436
51355437 private MenuItem resetCentroidItem;
5136
- private MenuItem transformgeometryItem;
5438
+ private MenuItem resetCentroidXZItem;
51375439 private MenuItem resetTransformItem;
5440
+ private MenuItem transformGeometryItem;
5441
+ private MenuItem transformChildrenItem;
51385442 private MenuItem hideItem;
51395443 private MenuItem grabItem;
51405444 private MenuItem backItem;
....@@ -5203,11 +5507,6 @@
52035507 private MenuItem doubleItem;
52045508 private MenuItem tripleItem;
52055509
5206
- private MenuItem importGFDItem;
5207
- private MenuItem importVRMLX3DItem;
5208
- private MenuItem import3DSItem;
5209
- private MenuItem importOBJItem;
5210
-
52115510 private MenuItem computeAOItem;
52125511 private MenuItem recompileItem;
52135512 private MenuItem editScriptItem;
....@@ -5217,4 +5516,8 @@
52175516 private MenuItem analyzeItem;
52185517 private MenuItem dumpItem;
52195518 //boolean freezemodel = false;
5519
+
5520
+ Menu cameraMenu;
5521
+ MenuItem editCameraItem;
5522
+ MenuItem revertCameraItem;
52205523 }