Normand Briere
2019-06-24 c67da2e5d8655704601d6d06e8bc60aabe212253
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,11 +576,35 @@
477576 */
478577 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
479578
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 = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
+ maxButton.setToolTipText("Maximize window");
585
+ maxButton.addActionListener(this);
586
+
587
+ oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ fullButton.setToolTipText("Full-screen window");
589
+ fullButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ undoButton.setToolTipText("Undo changes");
593
+ undoButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ redoButton.setToolTipText("Redo changes");
597
+ redoButton.addActionListener(this);
598
+
599
+ oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ saveButton.setToolTipText("Save changes");
601
+ saveButton.addActionListener(this);
602
+
480603 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
481
- liveCB.setToolTipText("Enabled animation");
604
+ liveCB.setToolTipText("Enable animation");
482605 liveCB.addItemListener(this);
483606
484
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
607
+ oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
485608 oneStepButton.setToolTipText("Animate one step forward");
486609 oneStepButton.addActionListener(this);
487610
....@@ -489,11 +612,11 @@
489612 fastCB.setToolTipText("Fast mode");
490613 fastCB.addItemListener(this);
491614
492
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
615
+ oe.toolbarPanel.add(trackCB = new cCheckBox(":", 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 = new cButton("@", !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);
633
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
511634 flashSelectionButton.setToolTipText("Show 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,19 @@
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
+ if (Globals.ADVANCED)
819
+ {
692820 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
693821 lookAtCB.setToolTipText("Look-at target");
694822 lookAtCB.addItemListener(this);
823
+ }
695824
696825 }
697826
....@@ -706,6 +835,14 @@
706835 void EditObject(Object3D obj)
707836 {
708837 cRadio radioButton = new cRadio(obj.name);
838
+
839
+ // Patch to avoid bug with transparency.
840
+ radioButton.hadMaterial = obj.material != null;
841
+ if (!radioButton.hadMaterial)
842
+ {
843
+ obj.material = new cMaterial();
844
+ }
845
+
709846 radioButton.SetObject(obj);
710847 radioButton.layout = sevenButton;
711848 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -714,8 +851,11 @@
714851 buttonGroup.add(radioButton);
715852 radioButton.doClick();
716853 }
854
+
717855 void SetupViews(ObjEditor oe)
718856 {
857
+ theFrame = this;
858
+
719859 oe.SetupViews();
720860
721861 System.out.println("SetupViews");
....@@ -739,7 +879,9 @@
739879 JCheckBox speakerCameraCB;
740880 JCheckBox speakerFocusCB;
741881 JCheckBox debugCB;
882
+
742883 JCheckBox oeilCB;
884
+ JCheckBox shadowCB;
743885 JCheckBox lookAtCB;
744886
745887 // static int COLOR = 1;
....@@ -778,6 +920,7 @@
778920 } else if(e.getSource() == liveCB)
779921 {
780922 cameraView.ToggleLive();
923
+ refreshContents(false);
781924 }
782925 else if(e.getSource() == supportCB)
783926 {
....@@ -841,6 +984,10 @@
841984 else if(e.getSource() == oeilCB)
842985 {
843986 cameraView.ToggleOeil();
987
+ }
988
+ else if(e.getSource() == shadowCB)
989
+ {
990
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
844991 }
845992 else if(e.getSource() == lookAtCB)
846993 {
....@@ -930,7 +1077,9 @@
9301077 // objEditor.DropFile((java.io.File[]) object, true);
9311078 // return;
9321079 // }
933
- if (string.charAt(0) == '/')
1080
+
1081
+ // File path for Mac and Windows
1082
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9341083 {
9351084 // file(s)
9361085 String[] names = string.split("\n");
....@@ -957,7 +1106,7 @@
9571106
9581107 flashIt = false;
9591108 CameraPane pane = (CameraPane) target;
960
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1109
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9611110 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9621111
9631112 if (group.selection.size() == 1)
....@@ -1164,13 +1313,13 @@
11641313 parseverticesItem.addActionListener(this);
11651314 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11661315 textureFieldItem.addActionListener(this);
1167
- alignItem = menu.add(new MenuItem("Align Object"));
1316
+ alignItem = menu.add(new MenuItem("Align Objects"));
11681317 alignItem.addActionListener(this);
11691318 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11701319 reduceMorphItem.addActionListener(this);
11711320 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11721321 reduce34MorphItem.addActionListener(this);
1173
-
1322
+ menu.add("-");
11741323 menu.add(computeAOItem = new MenuItem("Compute AO"));
11751324 computeAOItem.addActionListener(this);
11761325
....@@ -1183,7 +1332,7 @@
11831332 memoryItem.addActionListener(this);
11841333 menu.add(analyzeItem = new MenuItem("Analyze"));
11851334 analyzeItem.addActionListener(this);
1186
- menu.add(dumpItem = new MenuItem("Dump"));
1335
+ menu.add(dumpItem = new MenuItem("Print"));
11871336 dumpItem.addActionListener(this);
11881337 // menu.add(pathItem = new MenuItem("From-to path"));
11891338 // pathItem.addActionListener(this);
....@@ -1324,6 +1473,7 @@
13241473 shadow.material = new cMaterial(obj.material);
13251474 shadow.material.diffuse = 0.0001f;
13261475 shadow.material.specular = 0.0001f;
1476
+ //shadow.projectedVertices[1].x = 300;
13271477
13281478 makeSomething(shadow);
13291479 }
....@@ -1530,9 +1680,9 @@
15301680
15311681 void Overwrite(int mask)
15321682 {
1533
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1683
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15341684 {
1535
- Object3D content = GrafreeD.clipboard.get(0);
1685
+ Object3D content = Grafreed.clipboard.get(0);
15361686
15371687 if (content instanceof cGroup && ((cGroup)content).transientlink )
15381688 content = ((cGroup)content).get(0);
....@@ -1837,23 +1987,6 @@
18371987 csg.addChild(child);
18381988 child.addChild(csg);
18391989 } 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
18571990 if (source == computeAOItem)
18581991 {
18591992 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1872,7 +2005,7 @@
18722005 if (source == invariantsItem)
18732006 {
18742007 System.out.println("Invariants:");
1875
- GrafreeD.grafreeD.universe.invariants();
2008
+ Grafreed.grafreeD.universe.invariants();
18762009 } else
18772010 if (source == memoryItem)
18782011 {
....@@ -1890,6 +2023,30 @@
18902023 if (source == dumpItem)
18912024 {
18922025 DumpObject();
2026
+ } else
2027
+ if (source == minButton)
2028
+ {
2029
+ Minimize();
2030
+ } else
2031
+ if (source == maxButton)
2032
+ {
2033
+ Maximize();
2034
+ } else
2035
+ if (source == fullButton)
2036
+ {
2037
+ ToggleFullScreen();
2038
+ } else
2039
+ if (source == undoButton)
2040
+ {
2041
+ Undo();
2042
+ } else
2043
+ if (source == redoButton)
2044
+ {
2045
+ Redo();
2046
+ } else
2047
+ if (source == saveButton)
2048
+ {
2049
+ Save();
18932050 } else
18942051 if (source == oneStepButton)
18952052 {
....@@ -1945,12 +2102,20 @@
19452102 {
19462103 loadClipboard(true);
19472104 } else
2105
+ if (source == undoItem)
2106
+ {
2107
+ Undo();
2108
+ } else
2109
+ if (source == redoItem)
2110
+ {
2111
+ Redo();
2112
+ } else
19482113 if (source == duplicateItem)
19492114 {
1950
- Object3D keep = GrafreeD.clipboard;
2115
+ Object3D keep = Grafreed.clipboard;
19512116 loadClipboard(false);
19522117 paste(false);
1953
- GrafreeD.clipboard = keep;
2118
+ Grafreed.clipboard = keep;
19542119 } else
19552120 if (source == cloneItem)
19562121 {
....@@ -2170,9 +2335,9 @@
21702335 // group.selection.get(0).setMasterThis(content); // should be identity
21712336 // refreshContents();
21722337 // }
2173
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2338
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21742339 {
2175
- Object3D content = GrafreeD.clipboard.get(0);
2340
+ Object3D content = Grafreed.clipboard.get(0);
21762341
21772342 if (content instanceof cGroup && ((cGroup)content).transientlink )
21782343 content = ((cGroup)content).get(0);
....@@ -2222,9 +2387,9 @@
22222387 } else
22232388 if (source == setMasterItem)
22242389 {
2225
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2390
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22262391 {
2227
- Object3D content = GrafreeD.clipboard.get(0);
2392
+ Object3D content = Grafreed.clipboard.get(0);
22282393
22292394 if (content instanceof cGroup && ((cGroup)content).transientlink )
22302395 content = ((cGroup)content).get(0);
....@@ -2237,9 +2402,9 @@
22372402 {
22382403 if (group.selection.size() == 1)
22392404 {
2240
- if (GrafreeD.clipboard.size() == 1)
2405
+ if (Grafreed.clipboard.size() == 1)
22412406 {
2242
- Object3D content = GrafreeD.clipboard.get(0);
2407
+ Object3D content = Grafreed.clipboard.get(0);
22432408
22442409 if (content instanceof cGroup && ((cGroup)content).transientlink )
22452410 content = ((cGroup)content).get(0);
....@@ -2256,7 +2421,7 @@
22562421 {
22572422 RevertMeshes();
22582423 } else
2259
- if (source == resetMeshItem)
2424
+ if (source == resetAllItem)
22602425 {
22612426 ResetAll();
22622427 } else
....@@ -2444,7 +2609,7 @@
24442609 } else
24452610 if (source == genNormalsMESHItem)
24462611 {
2447
- GenNormals(true); // TODO
2612
+ GenNormalsMESH();
24482613 } else
24492614 if (source == genNormalsORGANItem)
24502615 {
....@@ -2509,6 +2674,22 @@
25092674 if (source == unmarkleavesItem)
25102675 {
25112676 MarkLeaves(false);
2677
+ } else
2678
+ if (source == rewindleavesItem)
2679
+ {
2680
+ RewindLeaves(true);
2681
+ } else
2682
+ if (source == unrewindleavesItem)
2683
+ {
2684
+ RewindLeaves(false);
2685
+ } else
2686
+ if (source == randomleavesItem)
2687
+ {
2688
+ RandomLeaves(true);
2689
+ } else
2690
+ if (source == unrandomleavesItem)
2691
+ {
2692
+ RandomLeaves(false);
25122693 } else
25132694 if (source == flipVItem)
25142695 {
....@@ -2594,9 +2775,13 @@
25942775 {
25952776 SmoothMesh();
25962777 } else
2597
- if (source == transformgeometryItem)
2778
+ if (source == transformGeometryItem)
25982779 {
25992780 TransformGeometry();
2781
+ } else
2782
+ if (source == transformChildrenItem)
2783
+ {
2784
+ TransformChildren();
26002785 } else
26012786 if (source == resetTransformItem)
26022787 {
....@@ -2604,7 +2789,11 @@
26042789 } else
26052790 if (source == resetCentroidItem)
26062791 {
2607
- ResetCentroid();
2792
+ ResetCentroid(true);
2793
+ } else
2794
+ if (source == resetCentroidXZItem)
2795
+ {
2796
+ ResetCentroid(false);
26082797 } else
26092798 if (source == resetParentItem)
26102799 {
....@@ -2768,6 +2957,24 @@
27682957 bigThree.ClearUI();
27692958 bigThree.add(centralPanel);
27702959 bigThree.FlushUI();
2960
+
2961
+ cameraView.requestFocusInWindow();
2962
+
2963
+// refreshContents(true);
2964
+//
2965
+// try
2966
+// {
2967
+// java.awt.Robot bot = new java.awt.Robot();
2968
+// int mask = InputEvent.BUTTON1_MASK;
2969
+// bot.mouseMove(100, 100);
2970
+// bot.mousePress(mask);
2971
+// bot.mouseRelease(mask);
2972
+// }
2973
+// catch (Exception e)
2974
+// {
2975
+//
2976
+// }
2977
+
27712978 } else
27722979 if (source == threeButton)
27732980 {
....@@ -2804,6 +3011,8 @@
28043011 bigThree.add(centralPanel);
28053012 bigThree.add(XYZPanel);
28063013 bigThree.FlushUI();
3014
+
3015
+ cameraView.requestFocusInWindow();
28073016 } else
28083017 if (source == fourButton)
28093018 {
....@@ -2839,6 +3048,8 @@
28393048 bigThree.ClearUI();
28403049 bigThree.add(scenePanel);
28413050 bigThree.FlushUI();
3051
+
3052
+ cameraView.requestFocusInWindow();
28423053 } else
28433054 if (source == sixButton)
28443055 {
....@@ -2875,6 +3086,8 @@
28753086 bigThree.add(scenePanel);
28763087 bigThree.add(centralPanel);
28773088 bigThree.FlushUI();
3089
+
3090
+ cameraView.requestFocusInWindow();
28783091 } else
28793092 if (source == sevenButton)
28803093 {
....@@ -2912,6 +3125,8 @@
29123125 bigThree.add(centralPanel);
29133126 bigThree.add(XYZPanel);
29143127 bigThree.FlushUI();
3128
+
3129
+ cameraView.requestFocusInWindow();
29153130 } else
29163131 if (source == rootButton)
29173132 {
....@@ -2923,6 +3138,7 @@
29233138 EditObject(obj);
29243139 }
29253140
3141
+ cameraView.requestFocusInWindow();
29263142 refreshContents(true);
29273143 } else
29283144 if (source == closeButton)
....@@ -2932,8 +3148,14 @@
29323148 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29333149 {
29343150 ab = (cRadio)e.nextElement();
2935
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3151
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29363152 {
3153
+ // Patch to avoid bug with transparency.
3154
+ if (!ab.hadMaterial)
3155
+ {
3156
+ ab.object.material = null;
3157
+ }
3158
+
29373159 buttonGroup.remove(ab);
29383160 radioPanel.remove(ab);
29393161
....@@ -2944,6 +3166,8 @@
29443166 break;
29453167 }
29463168 }
3169
+
3170
+ cameraView.requestFocusInWindow();
29473171 refreshContents(true);
29483172 } else
29493173 if (source == editItem || source == editButton)
....@@ -2960,7 +3184,7 @@
29603184 child.CloseUI();
29613185 listUI.remove(child);
29623186
2963
- child.editWindow = null; // ???????????
3187
+ //child.editWindow = null; // ???????????
29643188 }
29653189 objEditor.ctrlPanel.FlushUI();
29663190 //objEditor.jTree.clearSelection();
....@@ -3046,7 +3270,10 @@
30463270 frontView.object = group;
30473271 sideView.object = group;
30483272 }
3049
- group.editWindow = this;
3273
+
3274
+// fix "+" issue
3275
+ //group.editWindow = this;
3276
+
30503277 /*
30513278 currentLayout = radio.layout;
30523279 if (currentLayout == null)
....@@ -3058,8 +3285,23 @@
30583285 //group.parent = null; // ROOT
30593286 //group.attributes = -1;
30603287 ResetModel();
3288
+
3289
+ cameraView.requestFocusInWindow();
30613290 refreshContents(true);
3062
- }
3291
+ } else if (event.getSource() == editCameraItem)
3292
+ {
3293
+ cameraView.ProtectCamera();
3294
+ cameraView.repaint();
3295
+ return;
3296
+ } else if (event.getSource() == revertCameraItem)
3297
+ {
3298
+ cameraView.RevertCamera();
3299
+ cameraView.repaint();
3300
+ return;
3301
+ // } else if (event.getSource() == textureButton)
3302
+ // {
3303
+ // return; // true;
3304
+ }
30633305 else
30643306 {
30653307 //return super.action(event, arg);
....@@ -3068,7 +3310,6 @@
30683310 }
30693311
30703312 boolean useclient = false;
3071
- cRadio radio;
30723313
30733314 void ToggleRoot()
30743315 {
....@@ -3120,6 +3361,28 @@
31203361 refreshContents();
31213362 }
31223363
3364
+ void TransformChildren()
3365
+ {
3366
+ Object3D obj;
3367
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3368
+ {
3369
+ obj = (Object3D)e.nextElement();
3370
+ obj.KeepTextureMatrices();
3371
+ obj.TransformChildren();
3372
+ obj.RestoreTextureMatrices();
3373
+
3374
+// if (obj.parent == null)
3375
+// {
3376
+// System.out.println("NULL PARENT!");
3377
+// new Exception().printStackTrace();
3378
+// }
3379
+// else
3380
+// TouchTransform(obj);
3381
+// //obj.parent.Touch();
3382
+ }
3383
+
3384
+ refreshContents();
3385
+ }
31233386
31243387 void ResetTransform()
31253388 {
....@@ -3232,7 +3495,7 @@
32323495 refreshContents();
32333496 }
32343497
3235
- void ResetCentroid()
3498
+ void ResetCentroid(boolean full)
32363499 {
32373500 Object3D obj;
32383501 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3247,12 +3510,16 @@
32473510 LA.matIdentity(Object3D.mat);
32483511 obj.getBounds(minima, maxima, false);
32493512 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3250
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3513
+ if (full)
3514
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32513515 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32523516 obj.TransformMesh(Object3D.mat);
3517
+
32533518 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3254
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3519
+ if (full)
3520
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32553521 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3522
+
32563523 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32573524 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32583525 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3281,7 +3548,8 @@
32813548
32823549 int size = obj.MemorySize();
32833550
3284
- System.err.println((size/1024) + " KB is the size of " + obj);
3551
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3552
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32853553 }
32863554 }
32873555 catch (Exception e)
....@@ -3318,9 +3586,9 @@
33183586 obj = (Object3D)e.nextElement();
33193587
33203588 System.out.println("Object is: " + obj);
3321
- GrafreeD.AnalyzeObject(obj);
3589
+ Grafreed.AnalyzeObject(obj);
33223590 System.out.println("Boundary rep: " + obj.bRep);
3323
- GrafreeD.AnalyzeObject(obj.bRep);
3591
+ Grafreed.AnalyzeObject(obj.bRep);
33243592
33253593 // System.err.println((size/1024) + " KB is the size of " + obj);
33263594 }
....@@ -3362,6 +3630,13 @@
33623630 void GenNormals(boolean crease)
33633631 {
33643632 group.GenNormalsS(crease);
3633
+
3634
+ refreshContents();
3635
+ }
3636
+
3637
+ void GenNormalsMESH()
3638
+ {
3639
+ group.GenNormalsMeshS();
33653640
33663641 refreshContents();
33673642 }
....@@ -3534,8 +3809,8 @@
35343809
35353810 void ParseVertices()
35363811 {
3537
- boolean epsequal = GrafreeD.epsequal;
3538
- GrafreeD.epsequal = true;
3812
+ boolean epsequal = Grafreed.epsequal;
3813
+ Grafreed.epsequal = true;
35393814
35403815 for (int i=0; i<group.selection.size(); i++)
35413816 {
....@@ -3560,7 +3835,7 @@
35603835 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35613836 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35623837
3563
- g.add(GrafreeD.clipboard);
3838
+ g.add(Grafreed.clipboard);
35643839
35653840 buffer.add(g);
35663841 }
....@@ -3575,7 +3850,7 @@
35753850 makeSomething(buffer, i==group.selection.size()-1);
35763851 }
35773852
3578
- GrafreeD.epsequal = epsequal;
3853
+ Grafreed.epsequal = epsequal;
35793854
35803855 refreshContents();
35813856 }
....@@ -3593,7 +3868,16 @@
35933868 String pigment = Object3D.GetPigment(tex);
35943869 //String bump = Object3D.GetBump(tex);
35953870
3596
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3871
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3872
+
3873
+ try
3874
+ {
3875
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3876
+ }
3877
+ catch (Exception e)
3878
+ {
3879
+ System.err.println("FAIL: " + node);
3880
+ }
35973881
35983882 double s = v.s;
35993883
....@@ -3725,7 +4009,7 @@
37254009 return;
37264010
37274011 Object3D poses = group.selection.get(0);
3728
- Object3D ref = GrafreeD.clipboard.get(0);
4012
+ Object3D ref = Grafreed.clipboard.get(0);
37294013
37304014 Object3D newgroup = new Object3D("Po:" + poses.name);
37314015
....@@ -3919,9 +4203,9 @@
39194203
39204204 void ClipMesh()
39214205 {
3922
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4206
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39234207 {
3924
- Object3D content = GrafreeD.clipboard.get(0);
4208
+ Object3D content = Grafreed.clipboard.get(0);
39254209
39264210 if (content instanceof cGroup && ((cGroup)content).transientlink )
39274211 content = ((cGroup)content).get(0);
....@@ -3930,7 +4214,7 @@
39304214 // {
39314215 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39324216 // }
3933
- group.selection.ClipMesh(GrafreeD.clipboard);
4217
+ group.selection.ClipMesh(Grafreed.clipboard);
39344218 }
39354219 // group.selection.ClipMesh(GrafreeD.clipboard);
39364220 System.out.println("DONE.");
....@@ -3977,6 +4261,18 @@
39774261 void MarkLeaves(boolean hide)
39784262 {
39794263 group.selection.MarkLeaves(hide);
4264
+ refreshContents();
4265
+ }
4266
+
4267
+ void RewindLeaves(boolean hide)
4268
+ {
4269
+ group.selection.RewindLeaves(hide);
4270
+ refreshContents();
4271
+ }
4272
+
4273
+ void RandomLeaves(boolean hide)
4274
+ {
4275
+ group.selection.RandomLeaves(hide);
39804276 refreshContents();
39814277 }
39824278
....@@ -4065,7 +4361,7 @@
40654361 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40664362
40674363 Object3D elem = (Object3D)group.selection.elementAt(i);
4068
- if(elem != group)
4364
+ if(elem != group || !newWindow)
40694365 {
40704366 // if (!(elem instanceof Composite))
40714367 // newWindow = false;
....@@ -4155,7 +4451,6 @@
41554451 //case 702: // Event.LIST_DESELECT
41564452 group.deselectAll();
41574453 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4158
- objEditor.ClearInfo(); // .GetMaterial());
41594454 if (tps != null)
41604455 {
41614456 for (int i=0; i < tps.length; i++)
....@@ -4164,10 +4459,8 @@
41644459
41654460 //if (child.parent != null)
41664461 //child.parent.addSelectee(child);
4462
+ objEditor.SetMaterial(child);
41674463 group.addSelectee(child);
4168
- objEditor.SetMaterial(child); // .GetMaterial());
4169
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4170
- System.err.println("info : " + child.GetPath());
41714464 }
41724465 }
41734466 // else
....@@ -4177,16 +4470,17 @@
41774470 // System.err.println("info : " + group.GetPath());
41784471 // }
41794472
4180
- objEditor.SetText(); // jan 2014
4181
-
4182
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4473
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41834474 CameraPane.flash = true;
41844475
4185
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4476
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41864477 // a camera
41874478 {
4188
- CameraPane.camerachangeframe = 0; // don't refuse it
4189
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4479
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4480
+ {
4481
+ CameraPane.camerachangeframe = 0; // don't refuse it
4482
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4483
+ }
41904484 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41914485 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41924486 }
....@@ -4199,6 +4493,26 @@
41994493
42004494 freezemodel = false;
42014495 }
4496
+
4497
+ void refreshContents(boolean cp)
4498
+ {
4499
+ if (!Globals.MOUSEDRAGGED)
4500
+ {
4501
+ objEditor.ClearInfo(); // .GetMaterial());
4502
+
4503
+ for (int i=0; i < group.selection.Size(); i++)
4504
+ {
4505
+ Object3D child = (Object3D) group.selection.get(i);
4506
+
4507
+ objEditor.AddInfo(child, this, true);
4508
+ System.err.println("info : " + child.GetPath());
4509
+ }
4510
+
4511
+ objEditor.SetText(); // jan 2014
4512
+ }
4513
+
4514
+ super.refreshContents(cp);
4515
+ }
42024516
42034517 void linkSomething(Object3D thing)
42044518 {
....@@ -4270,16 +4584,18 @@
42704584 {
42714585 if (group.selection.isEmpty())
42724586 return;
4273
- GrafreeD.clipboardIsTempGroup = false;
4587
+
4588
+ Grafreed.clipboardIsTempGroup = false;
42744589 Composite tGroup = null;
42754590 if (group.selection.size() > 0) // 1)
42764591 {
42774592 tGroup = new cGroup();
4278
- GrafreeD.clipboardIsTempGroup = true;
4593
+ Grafreed.clipboardIsTempGroup = true;
42794594 }
42804595
42814596 if (cut)
42824597 {
4598
+ Save();
42834599 //int indices[] = jList.getSelectedIndices();
42844600 //for (int i = indices.length - 1; i >= 0; i--)
42854601 //jList.remove(indices[i]);
....@@ -4315,16 +4631,16 @@
43154631 //System.out.println("cut " + child);
43164632 //System.out.println("parent = " + child.parent);
43174633 // tmp.addChild(child);
4318
- if (GrafreeD.clipboardIsTempGroup)
4634
+ if (Grafreed.clipboardIsTempGroup)
43194635 tGroup.add/*Child*/(tmp);
43204636 else
4321
- GrafreeD.clipboard = tmp;
4637
+ Grafreed.clipboard = tmp;
43224638 }
43234639 else
4324
- if (GrafreeD.clipboardIsTempGroup)
4640
+ if (Grafreed.clipboardIsTempGroup)
43254641 tGroup.add/*Child*/(child);
43264642 else
4327
- GrafreeD.clipboard = child;
4643
+ Grafreed.clipboard = child;
43284644 }
43294645
43304646 //ResetModel();
....@@ -4356,21 +4672,23 @@
43564672 //System.out.println("cut " + elem);
43574673 //System.out.println("parent = " + elem.parent);
43584674 // tmp.addChild(elem);
4359
- if (GrafreeD.clipboardIsTempGroup)
4675
+ if (Grafreed.clipboardIsTempGroup)
43604676 tGroup.add/*Child*/(tmp);
43614677 else
4362
- GrafreeD.clipboard = tmp;
4678
+ Grafreed.clipboard = tmp;
43634679 }
43644680 else
4365
- if (GrafreeD.clipboardIsTempGroup)
4681
+ if (Grafreed.clipboardIsTempGroup)
43664682 tGroup.add/*Child*/(child);
43674683 else
4368
- GrafreeD.clipboard = child;
4684
+ Grafreed.clipboard = child;
43694685 }
43704686
43714687 }
4372
- if (GrafreeD.clipboardIsTempGroup)
4373
- GrafreeD.clipboard = tGroup;
4688
+
4689
+ if (Grafreed.clipboardIsTempGroup)
4690
+ Grafreed.clipboard = tGroup;
4691
+
43744692 if (cut)
43754693 {
43764694 ResetModel();
....@@ -4384,7 +4702,7 @@
43844702 // return;
43854703 boolean first = true;
43864704
4387
- if (GrafreeD.clipboardIsTempGroup)
4705
+ if (Grafreed.clipboardIsTempGroup)
43884706 {
43894707 Composite temp;
43904708
....@@ -4395,7 +4713,7 @@
43954713 temp = (Composite)Applet3D.clipboard.deepCopy();
43964714 */
43974715 Object3D elem;
4398
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4716
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43994717 {
44004718 Object3D child = (Object3D)e.nextElement();
44014719
....@@ -4429,14 +4747,14 @@
44294747 //Object3D cb = Applet3D.clipboard;
44304748 //temp.addChild(cb);
44314749 //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());
4750
+ assert(Grafreed.clipboard.parent == null);
4751
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4752
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4753
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4754
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44374755 else
4438
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4439
- GrafreeD.clipboard.get(0).parent = keepparent;
4756
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4757
+ Grafreed.clipboard.get(0).parent = keepparent;
44404758 }
44414759
44424760 ResetModel();
....@@ -4485,9 +4803,9 @@
44854803 {
44864804 boolean first = true;
44874805
4488
- if (GrafreeD.clipboardIsTempGroup)
4806
+ if (Grafreed.clipboardIsTempGroup)
44894807 {
4490
- Composite temp = (Composite)GrafreeD.clipboard;
4808
+ Composite temp = (Composite)Grafreed.clipboard;
44914809 Object3D copy;
44924810 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44934811 {
....@@ -4497,7 +4815,7 @@
44974815 }
44984816 } else
44994817 {
4500
- linkSomething(GrafreeD.clipboard); //.get(0));
4818
+ linkSomething(Grafreed.clipboard); //.get(0));
45014819 }
45024820 }
45034821 }
....@@ -4902,21 +5220,6 @@
49025220 }
49035221 */
49045222
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
-
49205223 /*
49215224 public void Callback(Object obj)
49225225 {
....@@ -4940,26 +5243,9 @@
49405243 }
49415244 */
49425245
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
-
49605246 String GetFile(String dialogName)
49615247 {
4962
- if (GrafreeD.standAlone)
5248
+ if (Grafreed.standAlone)
49635249 {
49645250 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49655251 browser.show();
....@@ -5027,6 +5313,12 @@
50275313 cButton clearpanelButton;
50285314 cButton unselectButton;
50295315
5316
+ cButton minButton;
5317
+ cButton maxButton;
5318
+ cButton fullButton;
5319
+ cButton undoButton;
5320
+ cButton redoButton;
5321
+ cButton saveButton;
50305322 cButton oneStepButton;
50315323
50325324 cButton screenfitButton;
....@@ -5040,14 +5332,6 @@
50405332
50415333 cButton setsupportButton;
50425334
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
-
50515335 //
50525336 //Composite
50535337 Object3D // to do !!
....@@ -5059,6 +5343,8 @@
50595343 private MenuItem lookFromItem;
50605344 private MenuItem switchItem;
50615345 private MenuItem cutItem;
5346
+ private MenuItem undoItem;
5347
+ private MenuItem redoItem;
50625348 private MenuItem duplicateItem;
50635349 private MenuItem cloneItem;
50645350 private MenuItem cloneSupportItem;
....@@ -5072,7 +5358,7 @@
50725358 private MenuItem linkverticesItem;
50735359 private MenuItem relinkverticesItem;
50745360 private MenuItem setMasterItem;
5075
- private MenuItem resetMeshItem;
5361
+ private MenuItem resetAllItem;
50765362 private MenuItem stepAllItem;
50775363 private MenuItem revertMeshItem;
50785364 private MenuItem poseMeshItem;
....@@ -5122,6 +5408,10 @@
51225408 private MenuItem showleavesItem;
51235409 private MenuItem markleavesItem;
51245410 private MenuItem unmarkleavesItem;
5411
+ private MenuItem rewindleavesItem;
5412
+ private MenuItem unrewindleavesItem;
5413
+ private MenuItem randomleavesItem;
5414
+ private MenuItem unrandomleavesItem;
51255415
51265416 private MenuItem flipVItem;
51275417 private MenuItem unflipVItem;
....@@ -5133,8 +5423,10 @@
51335423 private MenuItem panoTexturesItem;
51345424
51355425 private MenuItem resetCentroidItem;
5136
- private MenuItem transformgeometryItem;
5426
+ private MenuItem resetCentroidXZItem;
51375427 private MenuItem resetTransformItem;
5428
+ private MenuItem transformGeometryItem;
5429
+ private MenuItem transformChildrenItem;
51385430 private MenuItem hideItem;
51395431 private MenuItem grabItem;
51405432 private MenuItem backItem;
....@@ -5203,11 +5495,6 @@
52035495 private MenuItem doubleItem;
52045496 private MenuItem tripleItem;
52055497
5206
- private MenuItem importGFDItem;
5207
- private MenuItem importVRMLX3DItem;
5208
- private MenuItem import3DSItem;
5209
- private MenuItem importOBJItem;
5210
-
52115498 private MenuItem computeAOItem;
52125499 private MenuItem recompileItem;
52135500 private MenuItem editScriptItem;
....@@ -5217,4 +5504,8 @@
52175504 private MenuItem analyzeItem;
52185505 private MenuItem dumpItem;
52195506 //boolean freezemodel = false;
5507
+
5508
+ Menu cameraMenu;
5509
+ MenuItem editCameraItem;
5510
+ MenuItem revertCameraItem;
52205511 }